Skip to content

Commit

Permalink
Migrate v0.11.3-patch4-dev to master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 authored and hoangdat committed Jun 11, 2024
1 parent 1e180f0 commit 2a862e5
Show file tree
Hide file tree
Showing 28 changed files with 161 additions and 76 deletions.
4 changes: 2 additions & 2 deletions contact/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "21d15bc1a6a75e048ee1e3cd751dd0815492ce20"
ref: migrate_cnb_to_master_5Jun
resolved-ref: "49305a382ca77211a0668fd9fe196a3c057cdc8e"
url: "https://github.com/linagora/jmap-dart-client.git"
source: git
version: "0.0.1"
Expand Down
4 changes: 3 additions & 1 deletion contact/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ dependencies:
path: ../model

### Dependencies from git ###
# TODO: We will change it when the PR in upstream repository will be merged
# https://github.com/linagora/jmap-dart-client/pull/87
jmap_dart_client:
git:
url: https://github.com/linagora/jmap-dart-client.git
ref: master
ref: migrate_cnb_to_master_5Jun

### Dependencies from pub.dev ###
equatable: 2.0.5
Expand Down
4 changes: 2 additions & 2 deletions email_recovery/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "21d15bc1a6a75e048ee1e3cd751dd0815492ce20"
ref: migrate_cnb_to_master_5Jun
resolved-ref: "49305a382ca77211a0668fd9fe196a3c057cdc8e"
url: "https://github.com/linagora/jmap-dart-client.git"
source: git
version: "0.0.1"
Expand Down
4 changes: 3 additions & 1 deletion email_recovery/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ dependencies:
sdk: flutter

### Dependencies from git ###
# TODO: We will change it when the PR in upstream repository will be merged
# https://github.com/linagora/jmap-dart-client/pull/87
jmap_dart_client:
git:
url: https://github.com/linagora/jmap-dart-client.git
ref: master
ref: migrate_cnb_to_master_5Jun

### Dependencies from pub.dev ###
equatable: 2.0.5
Expand Down
4 changes: 2 additions & 2 deletions fcm/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "21d15bc1a6a75e048ee1e3cd751dd0815492ce20"
ref: migrate_cnb_to_master_5Jun
resolved-ref: "49305a382ca77211a0668fd9fe196a3c057cdc8e"
url: "https://github.com/linagora/jmap-dart-client.git"
source: git
version: "0.0.1"
Expand Down
4 changes: 3 additions & 1 deletion fcm/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ dependencies:
sdk: flutter

### Dependencies from git ###
# TODO: We will change it when the PR in upstream repository will be merged
# https://github.com/linagora/jmap-dart-client/pull/87
jmap_dart_client:
git:
url: https://github.com/linagora/jmap-dart-client.git
ref: master
ref: migrate_cnb_to_master_5Jun

### Dependencies from pub.dev ###
equatable: 2.0.5
Expand Down
4 changes: 2 additions & 2 deletions forward/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "21d15bc1a6a75e048ee1e3cd751dd0815492ce20"
ref: migrate_cnb_to_master_5Jun
resolved-ref: "49305a382ca77211a0668fd9fe196a3c057cdc8e"
url: "https://github.com/linagora/jmap-dart-client.git"
source: git
version: "0.0.1"
Expand Down
4 changes: 3 additions & 1 deletion forward/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ dependencies:
sdk: flutter

### Dependencies from git ###
# TODO: We will change it when the PR in upstream repository will be merged
# https://github.com/linagora/jmap-dart-client/pull/87
jmap_dart_client:
git:
url: https://github.com/linagora/jmap-dart-client.git
ref: master
ref: migrate_cnb_to_master_5Jun

### Dependencies from pub.dev ###
equatable: 2.0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async' as async;
import 'package:async/async.dart';
import 'package:core/domain/extensions/media_type_extension.dart';
import 'package:core/data/constants/constant.dart';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter/material.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';
Expand Down Expand Up @@ -43,7 +43,7 @@ mixin DragDropFileMixin {
fileName: details.files[i].name,
type: details.files[i].mimeType,
fileSize: bytesList.result![i].length,
isInline: details.files[i].mimeType?.startsWith(MediaTypeExtension.imageType) == true
isInline: details.files[i].mimeType?.startsWith(Constant.imageType) == true
),
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/features/email/domain/model/event_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ enum EventActionType {
KeyWordIdentifierExtension.tentativelyAcceptedEventAttendance.generatePath(): null,
KeyWordIdentifierExtension.rejectedEventAttendance.generatePath(): true,
});
case EventActionType.mailToAttendees:
return PatchObject({});
}
}

Expand All @@ -55,6 +57,8 @@ enum EventActionType {
return AppLocalizations.of(context).youMayAttendThisMeeting;
case EventActionType.no:
return AppLocalizations.of(context).youWillNotAttendThisMeeting;
case EventActionType.mailToAttendees:
return '';
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ import 'package:tmail_ui_user/features/email/domain/usecases/store_opened_email_
import 'package:tmail_ui_user/features/email/presentation/action/email_ui_action.dart';
import 'package:tmail_ui_user/features/email/presentation/bindings/calendar_event_interactor_bindings.dart';
import 'package:tmail_ui_user/features/email/presentation/controller/email_supervisor_controller.dart';
import 'package:tmail_ui_user/features/email/presentation/model/blob_calendar_event.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/attachment_extension.dart';
import 'package:tmail_ui_user/features/email/presentation/model/blob_calendar_event.dart';
import 'package:tmail_ui_user/features/email/presentation/model/composer_arguments.dart';
import 'package:tmail_ui_user/features/email/presentation/model/email_loaded.dart';
import 'package:tmail_ui_user/features/email/presentation/model/email_unsubscribe.dart';
Expand Down Expand Up @@ -1800,7 +1800,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {

void handleViewAttachmentAction(BuildContext context, Attachment attachment) {
if (PlatformInfo.isWeb) {
if (PlatformInfo.isCanvasKit && attachment.isDisplayedPDFIcon) {
if (PlatformInfo.isCanvasKit && attachment.validatePDFIcon()) {
previewPDFFileAction(context, attachment);
} else {
downloadAttachmentForWeb(attachment);
Expand Down Expand Up @@ -1839,4 +1839,24 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
},
);
}

void handleMailToAttendees(CalendarOrganizer? organizer, List<CalendarAttendee>? attendees) {
final listEmailAddressAttendees = attendees
?.map((attendee) => EmailAddress(attendee.name?.name, attendee.mailto?.mailAddress.value))
.toList() ?? [];

if (organizer != null) {
listEmailAddressAttendees.add(EmailAddress(organizer.name, organizer.mailto?.value));
}

final listEmailAddressMailTo = listEmailAddressAttendees
.where((emailAddress) => emailAddress.emailAddress.isNotEmpty && emailAddress.emailAddress != mailboxDashBoardController.sessionCurrent?.username.value)
.toSet()
.toList();

log('SingleEmailController::handleMailToAttendees: listEmailAddressMailTo = $listEmailAddressMailTo');
mailboxDashBoardController.goToComposer(
ComposerArguments.fromMailtoUri(listEmailAddress: listEmailAddressMailTo)
);
}
}
67 changes: 31 additions & 36 deletions lib/features/email/presentation/email_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:model/extensions/presentation_mailbox_extension.dart';
import 'package:model/mailbox/presentation_mailbox.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart';
import 'package:tmail_ui_user/features/base/widget/scrollbar_list_view.dart';
import 'package:tmail_ui_user/features/composer/presentation/extensions/email_action_type_extension.dart';
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
Expand Down Expand Up @@ -148,33 +147,30 @@ class EmailView extends GetWidget<SingleEmailController> {
child: Obx(() => _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: controller.calendarEvent.value,
calendarEvent: controller.calendarEvent,
maxBodyHeight: constraints.maxHeight
))
)
);
} else {
return Obx(() {
final calendarEvent = controller.calendarEvent.value;
final calendarEvent = controller.calendarEvent;
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
return Padding(
padding: const EdgeInsetsDirectional.symmetric(horizontal: 4),
child: ScrollbarListView(
scrollController: controller.emailContentScrollController,
child: SingleChildScrollView(
physics : const ClampingScrollPhysics(),
child: Container(
width: double.infinity,
alignment: Alignment.center,
color: Colors.white,
child: _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: calendarEvent,
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
)
child: SingleChildScrollView(
physics : const ClampingScrollPhysics(),
child: Container(
width: double.infinity,
alignment: Alignment.center,
color: Colors.white,
child: _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: calendarEvent,
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
)
),
)
),
);
} else {
Expand All @@ -199,34 +195,31 @@ class EmailView extends GetWidget<SingleEmailController> {
child: Obx(() => _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: controller.calendarEvent.value,
calendarEvent: controller.calendarEvent,
maxBodyHeight: constraints.maxHeight
))
)
);
} else {
return Obx(() {
final calendarEvent = controller.calendarEvent.value;
final calendarEvent = controller.calendarEvent;
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
return Padding(
padding: const EdgeInsetsDirectional.symmetric(horizontal: 4),
child: ScrollbarListView(
scrollController: controller.emailContentScrollController,
child: SingleChildScrollView(
physics : const ClampingScrollPhysics(),
child: Container(
width: double.infinity,
alignment: Alignment.center,
color: Colors.white,
child: _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: calendarEvent,
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
maxBodyHeight: constraints.maxHeight
)
child: SingleChildScrollView(
physics : const ClampingScrollPhysics(),
child: Container(
width: double.infinity,
alignment: Alignment.center,
color: Colors.white,
child: _buildEmailMessage(
context: context,
presentationEmail: currentEmail,
calendarEvent: calendarEvent,
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
maxBodyHeight: constraints.maxHeight
)
),
)
),
);
} else {
Expand Down Expand Up @@ -367,6 +360,7 @@ class EmailView extends GetWidget<SingleEmailController> {
controller.onCalendarEventReplyAction(eventActionType, presentationEmail.id!),
calendarEventReplying: controller.calendarEventProcessing,
presentationEmail: controller.currentEmail,
onMailtoAttendeesAction: controller.handleMailToAttendees,
)),
if (calendarEvent.getTitleEventAction(context, emailAddressSender ?? []).isNotEmpty)
CalendarEventActionBannerWidget(
Expand All @@ -384,6 +378,7 @@ class EmailView extends GetWidget<SingleEmailController> {
controller.onCalendarEventReplyAction(eventActionType, presentationEmail.id!),
calendarEventReplying: controller.calendarEventProcessing,
presentationEmail: controller.currentEmail,
onMailtoAttendeesAction: controller.handleMailToAttendees,
)),
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import 'package:tmail_ui_user/features/upload/domain/extensions/media_type_exten

extension AttachmentExtension on Attachment {
String getIcon(ImagePaths imagePaths) => type?.getIcon(imagePaths, fileName: name) ?? imagePaths.icFileEPup;

bool validatePDFIcon() => type?.validatePDFIcon(fileName: name) ?? false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
return CalendarEventActionButtonWidgetStyles.loadingBackgroundColor;
}

return CalendarEventActionButtonWidgetStyles.backgroundColor;
case EventActionType.mailToAttendees:
return CalendarEventActionButtonWidgetStyles.backgroundColor;
}
}
Expand All @@ -120,6 +122,8 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
return CalendarEventActionButtonWidgetStyles.selectedTextColor;
}

return CalendarEventActionButtonWidgetStyles.textColor;
case EventActionType.mailToAttendees:
return CalendarEventActionButtonWidgetStyles.textColor;
}
}
Expand All @@ -143,6 +147,8 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
return CalendarEventActionButtonWidgetStyles.selectedBackgroundColor;
}

return CalendarEventActionButtonWidgetStyles.textColor;
case EventActionType.mailToAttendees:
return CalendarEventActionButtonWidgetStyles.textColor;
}
}
Expand All @@ -164,6 +170,8 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
return null;
}
return () => onCalendarEventReplyActionClick(eventActionType);
case EventActionType.mailToAttendees:
return onMailToAttendeesAction;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:core/presentation/views/html_viewer/html_content_viewer_widget.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart';
import 'package:model/email/presentation_email.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
import 'package:tmail_ui_user/features/email/presentation/styles/calendar_event_detail_widget_styles.dart';
Expand All @@ -13,6 +15,8 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_title_widget.dart';
import 'package:tmail_ui_user/main/utils/app_utils.dart';

typedef OnMailtoAttendeesAction = Function(CalendarOrganizer? organizer, List<CalendarAttendee>? participants);

class CalendarEventDetailWidget extends StatelessWidget {

final CalendarEvent calendarEvent;
Expand All @@ -24,6 +28,7 @@ class CalendarEventDetailWidget extends StatelessWidget {
final OnCalendarEventReplyActionClick onCalendarEventReplyActionClick;
final bool calendarEventReplying;
final PresentationEmail? presentationEmail;
final OnMailtoAttendeesAction? onMailtoAttendeesAction;

const CalendarEventDetailWidget({
super.key,
Expand All @@ -36,6 +41,7 @@ class CalendarEventDetailWidget extends StatelessWidget {
this.onOpenComposerAction,
this.onMailtoDelegateAction,
this.presentationEmail,
this.onMailtoAttendeesAction,
});

@override
Expand Down Expand Up @@ -99,6 +105,10 @@ class CalendarEventDetailWidget extends StatelessWidget {
onCalendarEventReplyActionClick: onCalendarEventReplyActionClick,
calendarEventReplying: calendarEventReplying,
presentationEmail: presentationEmail,
onMailToAttendeesAction: () => onMailtoAttendeesAction?.call(
calendarEvent.organizer,
calendarEvent.participants,
),
),
],
),
Expand Down
Loading

0 comments on commit 2a862e5

Please sign in to comment.