From f5aab194873543c69dbbae1fc186d77ebe18ae36 Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 16 Jan 2024 15:45:37 +0700 Subject: [PATCH] TF-2431 Show confirm dialog when logout Signed-off-by: dab246 --- .../dialog/confirmation_dialog_builder.dart | 20 ++--- lib/features/base/base_controller.dart | 56 +++++++++++++- .../mixin/message_dialog_action_mixin.dart | 75 +++++++++---------- .../presentation/composer_controller.dart | 69 +++++++++-------- .../controller/single_email_controller.dart | 12 +-- .../mailbox_dashboard_view_web.dart | 1 + .../forward/forward_controller.dart | 16 ++-- .../manage_account_dashboard_view.dart | 1 + .../menu/manage_account_menu_view.dart | 1 + .../settings/settings_first_level_view.dart | 1 + .../delete_identity_dialog_builder.dart | 2 +- .../sending_queue_controller.dart | 6 +- lib/l10n/intl_messages.arb | 20 ++++- lib/main/localizations/app_localizations.dart | 18 +++++ 14 files changed, 198 insertions(+), 100 deletions(-) diff --git a/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart b/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart index 9f32053589..84e38e4c2c 100644 --- a/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart +++ b/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart @@ -23,12 +23,12 @@ class ConfirmDialogBuilder { TextStyle? _styleContent; double? _radiusButton; double? heightButton; - EdgeInsets? _paddingTitle; - EdgeInsets? _paddingContent; - EdgeInsets? _paddingButton; + EdgeInsetsGeometry? _paddingTitle; + EdgeInsetsGeometry? _paddingContent; + EdgeInsetsGeometry? _paddingButton; EdgeInsets? _outsideDialogPadding; - EdgeInsets? _marginIcon; - EdgeInsets? _margin; + EdgeInsetsGeometry? _marginIcon; + EdgeInsetsGeometry? _margin; double? _widthDialog; double? _heightDialog; double maxWith; @@ -95,23 +95,23 @@ class ConfirmDialogBuilder { _radiusButton = radius; } - void paddingTitle(EdgeInsets? value) { + void paddingTitle(EdgeInsetsGeometry? value) { _paddingTitle = value; } - void paddingContent(EdgeInsets? value) { + void paddingContent(EdgeInsetsGeometry? value) { _paddingContent = value; } - void paddingButton(EdgeInsets? value) { + void paddingButton(EdgeInsetsGeometry? value) { _paddingButton = value; } - void marginIcon(EdgeInsets? value) { + void marginIcon(EdgeInsetsGeometry? value) { _marginIcon = value; } - void margin(EdgeInsets? value) { + void margin(EdgeInsetsGeometry? value) { _margin = value; } diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 1584db51c3..2c28f8ec9d 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -18,6 +18,7 @@ import 'package:get/get.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart'; import 'package:jmap_dart_client/jmap/core/session/session.dart'; +import 'package:jmap_dart_client/jmap/core/user_name.dart'; import 'package:model/account/authentication_type.dart'; import 'package:model/account/personal_account.dart'; import 'package:rule_filter/rule_filter/capability_rule_filter.dart'; @@ -296,11 +297,64 @@ abstract class BaseController extends GetxController } void logout({ + required BuildContext context, required Session session, required AccountId accountId }) async { _isFcmEnabled = _isFcmActivated(session, accountId); - consumeState(_logoutCurrentAccountInteractor.execute()); + + if (PlatformInfo.isMobile) { + _showConfirmDialogLogout( + context: context, + userName: session.username + ); + } else { + consumeState(_logoutCurrentAccountInteractor.execute()); + } + } + + void _showConfirmDialogLogout({ + required BuildContext context, + required UserName userName + }) { + showConfirmDialogAction( + context: context, + actionName: AppLocalizations.of(currentContext!).yesLogout, + title: AppLocalizations.of(currentContext!).logoutConfirmation, + alignCenter: true, + titlePadding: const EdgeInsetsDirectional.only(top: 24), + messageStyle: Theme.of(context).textTheme.bodySmall?.copyWith( + color: AppColor.colorTextBody, + fontSize: 15 + ), + titleStyle: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Colors.black, + fontSize: 20 + ), + actionButtonColor: AppColor.primaryColor, + actionStyle: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Colors.white, + fontSize: 16 + ), + cancelStyle: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: AppColor.primaryColor, + fontSize: 16 + ), + listTextSpan: [ + TextSpan(text: AppLocalizations.of(context).messageConfirmationLogout), + TextSpan( + text: ' ${userName.value}', + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: AppColor.colorTextBody, + fontSize: 15 + ), + ), + const TextSpan(text: '?'), + ], + onConfirmAction: () { + consumeState(_logoutCurrentAccountInteractor.execute()); + }, + ); } void _removeFirebaseRegistration(PersonalAccount deletedAccount) async { diff --git a/lib/features/base/mixin/message_dialog_action_mixin.dart b/lib/features/base/mixin/message_dialog_action_mixin.dart index 1b93d13be9..e5d0230b82 100644 --- a/lib/features/base/mixin/message_dialog_action_mixin.dart +++ b/lib/features/base/mixin/message_dialog_action_mixin.dart @@ -8,28 +8,27 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart'; mixin MessageDialogActionMixin { - Future showConfirmDialogAction( - BuildContext context, - String message, - String actionName, - { - Function? onConfirmAction, - Function? onCancelAction, - String? title, - String? cancelTitle, - bool hasCancelButton = true, - bool showAsBottomSheet = false, - bool alignCenter = false, - List? listTextSpan, - Widget? icon, - TextStyle? titleStyle, - TextStyle? messageStyle, - TextStyle? actionStyle, - TextStyle? cancelStyle, - Color? actionButtonColor, - Color? cancelButtonColor, - } - ) async { + Future showConfirmDialogAction({ + required BuildContext context, + String? message, + String? actionName, + Function? onConfirmAction, + Function? onCancelAction, + String? title, + String? cancelTitle, + bool hasCancelButton = true, + bool showAsBottomSheet = false, + bool alignCenter = false, + List? listTextSpan, + Widget? icon, + TextStyle? titleStyle, + TextStyle? messageStyle, + TextStyle? actionStyle, + TextStyle? cancelStyle, + Color? actionButtonColor, + Color? cancelButtonColor, + EdgeInsetsGeometry? titlePadding, + }) async { final responsiveUtils = Get.find(); final imagePaths = Get.find(); @@ -39,20 +38,20 @@ mixin MessageDialogActionMixin { child: (ConfirmDialogBuilder(imagePaths, listTextSpan: listTextSpan, heightButton: 44) ..key(const Key('confirm_dialog_action')) ..title(title ?? '') - ..content(message) + ..content(message ?? '') ..addIcon(icon) ..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton) ..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton) ..marginIcon(icon != null ? const EdgeInsets.only(top: 24) : null) - ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero) + ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : titlePadding ?? EdgeInsets.zero) ..radiusButton(12) - ..paddingContent(const EdgeInsets.only(left: 24, right: 24, bottom: 24, top: 12)) - ..paddingButton(hasCancelButton ? null : const EdgeInsets.only(bottom: 24, left: 24, right: 24)) + ..paddingContent(const EdgeInsetsDirectional.only(start: 24, end: 24, bottom: 24, top: 12)) + ..paddingButton(hasCancelButton ? null : const EdgeInsetsDirectional.only(bottom: 24, start: 24, end: 24)) ..styleTitle(titleStyle ?? const TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black)) ..styleContent(messageStyle ?? const TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: AppColor.colorContentEmail)) ..styleTextCancelButton(cancelStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton)) ..styleTextConfirmButton(actionStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.white)) - ..onConfirmButtonAction(actionName, () { + ..onConfirmButtonAction(actionName ?? AppLocalizations.of(context).yes, () { popBack(); onConfirmAction?.call(); }) @@ -80,21 +79,21 @@ mixin MessageDialogActionMixin { ) ..key(const Key('confirm_dialog_action')) ..title(title ?? '') - ..content(message) + ..content(message ?? '') ..addIcon(icon) ..margin(const EdgeInsets.only(bottom: 42)) ..widthDialog(responsiveUtils.getSizeScreenWidth(context)) ..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton) ..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton) - ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero) + ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : titlePadding ?? EdgeInsets.zero) ..marginIcon(EdgeInsets.zero) - ..paddingContent(const EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 12)) - ..paddingButton(hasCancelButton ? null : const EdgeInsets.only(bottom: 16, left: 44, right: 44)) + ..paddingContent(const EdgeInsetsDirectional.only(start: 44, end: 44, bottom: 24, top: 12)) + ..paddingButton(hasCancelButton ? null : const EdgeInsetsDirectional.only(bottom: 16, start: 44, end: 44)) ..styleTitle(titleStyle ?? const TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black)) ..styleContent(messageStyle ?? const TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: AppColor.colorContentEmail)) ..styleTextCancelButton(cancelStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton)) ..styleTextConfirmButton(actionStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.white)) - ..onConfirmButtonAction(actionName, () { + ..onConfirmButtonAction(actionName ?? AppLocalizations.of(context).yes, () { popBack(); onConfirmAction?.call(); }) @@ -117,7 +116,7 @@ mixin MessageDialogActionMixin { ); } else { return (ConfirmationDialogActionSheetBuilder(context, listTextSpan: listTextSpan) - ..messageText(message) + ..messageText(message ?? '') ..styleConfirmButton(const TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black)) ..styleMessage(messageStyle) ..styleCancelButton(cancelStyle) @@ -128,7 +127,7 @@ mixin MessageDialogActionMixin { onCancelAction?.call(); } ) - ..onConfirmAction(actionName, () { + ..onConfirmAction(actionName ?? AppLocalizations.of(context).yes, () { popBack(); onConfirmAction?.call(); })).show(); @@ -139,20 +138,20 @@ mixin MessageDialogActionMixin { child: (ConfirmDialogBuilder(imagePaths, listTextSpan: listTextSpan) ..key(const Key('confirm_dialog_action')) ..title(title ?? '') - ..content(message) + ..content(message ?? '') ..addIcon(icon) ..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton) ..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton) ..marginIcon(icon != null ? const EdgeInsets.only(top: 24) : null) - ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero) + ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : titlePadding ?? EdgeInsets.zero) ..marginIcon(EdgeInsets.zero) - ..paddingContent(const EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 12)) + ..paddingContent(const EdgeInsetsDirectional.only(start: 44, end: 44, bottom: 24, top: 12)) ..paddingButton(hasCancelButton ? null : const EdgeInsets.only(bottom: 16, left: 44, right: 44)) ..styleTitle(titleStyle ?? const TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black)) ..styleContent(messageStyle ?? const TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: AppColor.colorContentEmail)) ..styleTextCancelButton(cancelStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton)) ..styleTextConfirmButton(actionStyle ?? const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.white)) - ..onConfirmButtonAction(actionName, () { + ..onConfirmButtonAction(actionName ?? AppLocalizations.of(context).yes, () { popBack(); onConfirmAction?.call(); }) diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index 3037a84479..161a7b4266 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -832,9 +832,10 @@ class ComposerController extends BaseController { } if (!isEnableEmailSendButton.value) { - showConfirmDialogAction(context, - AppLocalizations.of(context).message_dialog_send_email_without_recipient, - AppLocalizations.of(context).add_recipients, + showConfirmDialogAction( + context: context, + message: AppLocalizations.of(context).message_dialog_send_email_without_recipient, + actionName: AppLocalizations.of(context).add_recipients, onConfirmAction: () => isSendEmailLoading.value = false, title: AppLocalizations.of(context).sending_failed, icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill), @@ -849,9 +850,10 @@ class ComposerController extends BaseController { .where((emailAddress) => !GetUtils.isEmail(emailAddress.emailAddress)) .toList(); if (listEmailAddressInvalid.isNotEmpty) { - showConfirmDialogAction(context, - AppLocalizations.of(context).message_dialog_send_email_with_email_address_invalid, - AppLocalizations.of(context).fix_email_addresses, + showConfirmDialogAction( + context: context, + message: AppLocalizations.of(context).message_dialog_send_email_with_email_address_invalid, + actionName: AppLocalizations.of(context).fix_email_addresses, onConfirmAction: () { toAddressExpandMode.value = ExpandMode.EXPAND; ccAddressExpandMode.value = ExpandMode.EXPAND; @@ -867,9 +869,10 @@ class ComposerController extends BaseController { } if (subjectEmail.value == null || subjectEmail.isEmpty == true) { - showConfirmDialogAction(context, - AppLocalizations.of(context).message_dialog_send_email_without_a_subject, - AppLocalizations.of(context).send_anyway, + showConfirmDialogAction( + context: context, + message: AppLocalizations.of(context).message_dialog_send_email_without_a_subject, + actionName: AppLocalizations.of(context).send_anyway, onConfirmAction: () => _handleSendMessages(context), onCancelAction: () => isSendEmailLoading.value = false, title: AppLocalizations.of(context).empty_subject, @@ -881,9 +884,9 @@ class ComposerController extends BaseController { if (!uploadController.allUploadAttachmentsCompleted) { showConfirmDialogAction( - context, - AppLocalizations.of(context).messageDialogSendEmailUploadingAttachment, - AppLocalizations.of(context).got_it, + context: context, + message: AppLocalizations.of(context).messageDialogSendEmailUploadingAttachment, + actionName: AppLocalizations.of(context).got_it, onConfirmAction: () => isSendEmailLoading.value = false, title: AppLocalizations.of(context).sending_failed, showAsBottomSheet: true, @@ -895,10 +898,10 @@ class ComposerController extends BaseController { if (!uploadController.hasEnoughMaxAttachmentSize()) { showConfirmDialogAction( - context, - AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size( + context: context, + message: AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(context).got_it, + actionName: AppLocalizations.of(context).got_it, onConfirmAction: () => isSendEmailLoading.value = false, title: AppLocalizations.of(context).sending_failed, icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill), @@ -990,11 +993,11 @@ class ComposerController extends BaseController { void _showConfirmDialogStoreSendingEmail(BuildContext context) { showConfirmDialogAction( - context, - PlatformInfo.isIOS + context: context, + message: PlatformInfo.isIOS ? AppLocalizations.of(context).messageDialogOfflineModeOnIOS : '', - AppLocalizations.of(context).proceed, + actionName: AppLocalizations.of(context).proceed, onConfirmAction: () async { final sendingArgs = await _createSendingEmailArguments(context); _closeComposerAction( @@ -1155,10 +1158,10 @@ class ComposerController extends BaseController { } else { if (currentContext != null) { showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( + context: currentContext!, + message: AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(currentContext!).got_it, + actionName: AppLocalizations.of(currentContext!).got_it, onConfirmAction: () => {isSendEmailLoading.value = false}, title: AppLocalizations.of(currentContext!).maximum_files_size, hasCancelButton: false); @@ -1401,10 +1404,10 @@ class ComposerController extends BaseController { } else { if (currentContext != null) { showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( + context: currentContext!, + message: AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(currentContext!).got_it, + actionName: AppLocalizations.of(currentContext!).got_it, title: AppLocalizations.of(currentContext!).maximum_files_size, hasCancelButton: false, ); @@ -1888,10 +1891,10 @@ class ComposerController extends BaseController { } else { if (currentContext != null) { showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( + context: currentContext!, + message: AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(currentContext!).got_it, + actionName: AppLocalizations.of(currentContext!).got_it, onConfirmAction: () => {isSendEmailLoading.value = false}, title: AppLocalizations.of(currentContext!).maximum_files_size, hasCancelButton: false); @@ -2080,10 +2083,10 @@ class ComposerController extends BaseController { } else { if (currentContext != null) { showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( + context: currentContext!, + message: AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(currentContext!).got_it, + actionName: AppLocalizations.of(currentContext!).got_it, title: AppLocalizations.of(currentContext!).maximum_files_size, hasCancelButton: false, ); @@ -2189,10 +2192,10 @@ class ComposerController extends BaseController { } else { if (currentContext != null) { showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( + context: currentContext!, + message: AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size( filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)), - AppLocalizations.of(currentContext!).got_it, + actionName: AppLocalizations.of(currentContext!).got_it, title: AppLocalizations.of(currentContext!).maximum_files_size, hasCancelButton: false, ); diff --git a/lib/features/email/presentation/controller/single_email_controller.dart b/lib/features/email/presentation/controller/single_email_controller.dart index 85570a7831..96e71a470e 100644 --- a/lib/features/email/presentation/controller/single_email_controller.dart +++ b/lib/features/email/presentation/controller/single_email_controller.dart @@ -531,9 +531,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin { void _handleReadReceipt() { if (currentContext != null) { - showConfirmDialogAction(currentContext!, - AppLocalizations.of(currentContext!).subTitleReadReceiptRequestNotificationMessage, - AppLocalizations.of(currentContext!).yes, + showConfirmDialogAction( + context: currentContext!, + message: AppLocalizations.of(currentContext!).subTitleReadReceiptRequestNotificationMessage, + actionName: AppLocalizations.of(currentContext!).yes, onConfirmAction: () => _handleSendReceiptToSenderAction(currentContext!), showAsBottomSheet: true, title: AppLocalizations.of(currentContext!).titleReadReceiptRequestNotificationMessage, @@ -1416,9 +1417,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin { void _unsubscribeEmail(BuildContext context, PresentationEmail presentationEmail) { showConfirmDialogAction( - context, - '', - AppLocalizations.of(context).unsubscribe, + context: context, + actionName: AppLocalizations.of(context).unsubscribe, onConfirmAction: () { if (emailUnsubscribe.value?.httpLinks.isNotEmpty == true) { _handleUnsubscribeMailByHttpsLink( diff --git a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart index 0040177e6d..9f1af184a2 100644 --- a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart +++ b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart @@ -365,6 +365,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { if (controller.sessionCurrent != null && controller.accountId.value != null) { controller.logout( + context: context, session: controller.sessionCurrent!, accountId: controller.accountId.value! ); diff --git a/lib/features/manage_account/presentation/forward/forward_controller.dart b/lib/features/manage_account/presentation/forward/forward_controller.dart index c24b5d9f29..c52d1e0377 100644 --- a/lib/features/manage_account/presentation/forward/forward_controller.dart +++ b/lib/features/manage_account/presentation/forward/forward_controller.dart @@ -8,6 +8,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:forward/forward/tmail_forward.dart'; import 'package:get/get.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; +import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:model/extensions/email_address_extension.dart'; import 'package:model/mailbox/select_mode.dart'; import 'package:tmail_ui_user/features/base/base_controller.dart'; @@ -16,7 +17,6 @@ import 'package:tmail_ui_user/features/manage_account/domain/model/delete_recipi import 'package:tmail_ui_user/features/manage_account/domain/model/edit_local_copy_in_forwarding_request.dart'; import 'package:tmail_ui_user/features/manage_account/domain/state/add_recipient_in_forwarding_state.dart'; import 'package:tmail_ui_user/features/manage_account/domain/state/delete_recipient_in_forwarding_state.dart'; -import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:tmail_ui_user/features/manage_account/domain/state/edit_local_copy_in_forwarding_state.dart'; import 'package:tmail_ui_user/features/manage_account/domain/state/get_forward_state.dart'; import 'package:tmail_ui_user/features/manage_account/domain/usecases/add_recipients_in_forwarding_interactor.dart'; @@ -110,10 +110,11 @@ class ForwardController extends BaseController { } void deleteRecipients(BuildContext context, String emailAddress) { - showConfirmDialogAction(context, + showConfirmDialogAction( + context: context, title: AppLocalizations.of(context).deleteRecipient, - AppLocalizations.of(context).messageConfirmationDialogDeleteRecipientForward(emailAddress), - AppLocalizations.of(context).remove, + message: AppLocalizations.of(context).messageConfirmationDialogDeleteRecipientForward(emailAddress), + actionName: AppLocalizations.of(context).remove, onConfirmAction: () => _handleDeleteRecipientAction({emailAddress}), showAsBottomSheet: true, icon: SvgPicture.asset(imagePaths.icDeleteDialogRecipients, fit: BoxFit.fill), @@ -195,10 +196,11 @@ class ForwardController extends BaseController { } void deleteMultipleRecipients(BuildContext context, Set listEmailAddress) { - showConfirmDialogAction(currentContext!, + showConfirmDialogAction( + context: currentContext!, title: AppLocalizations.of(context).deleteRecipient, - AppLocalizations.of(context).messageConfirmationDialogDeleteAllRecipientForward, - AppLocalizations.of(currentContext!).remove, + message: AppLocalizations.of(context).messageConfirmationDialogDeleteAllRecipientForward, + actionName: AppLocalizations.of(currentContext!).remove, onConfirmAction: () => _handleDeleteRecipientAction(listEmailAddress), showAsBottomSheet: true, icon: SvgPicture.asset(imagePaths.icDeleteDialogRecipients, fit: BoxFit.fill), diff --git a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart index 97460b0bb2..d6ffb8f235 100644 --- a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart +++ b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart @@ -154,6 +154,7 @@ class ManageAccountDashBoardView extends GetWidget { if (controller.dashBoardController.sessionCurrent != null && controller.dashBoardController.accountId.value != null) { controller.dashBoardController.logout( + context: context, session: controller.dashBoardController.sessionCurrent!, accountId: controller.dashBoardController.accountId.value! ); diff --git a/lib/features/manage_account/presentation/menu/settings/settings_first_level_view.dart b/lib/features/manage_account/presentation/menu/settings/settings_first_level_view.dart index 252f17ff47..f5cc03d35e 100644 --- a/lib/features/manage_account/presentation/menu/settings/settings_first_level_view.dart +++ b/lib/features/manage_account/presentation/menu/settings/settings_first_level_view.dart @@ -134,6 +134,7 @@ class SettingsFirstLevelView extends GetWidget { if (controller.manageAccountDashboardController.sessionCurrent != null && controller.manageAccountDashboardController.accountId.value != null) { controller.manageAccountDashboardController.logout( + context: context, session: controller.manageAccountDashboardController.sessionCurrent!, accountId: controller.manageAccountDashboardController.accountId.value! ); diff --git a/lib/features/manage_account/presentation/profiles/identities/widgets/delete_identity_dialog_builder.dart b/lib/features/manage_account/presentation/profiles/identities/widgets/delete_identity_dialog_builder.dart index a6e6e9fe34..9c14c48be6 100644 --- a/lib/features/manage_account/presentation/profiles/identities/widgets/delete_identity_dialog_builder.dart +++ b/lib/features/manage_account/presentation/profiles/identities/widgets/delete_identity_dialog_builder.dart @@ -26,7 +26,7 @@ class DeleteIdentityDialogBuilder extends StatelessWidget { responsiveUtils: responsiveUtils, mobile: (_buildDeleteDialog(context) ..alignment(Alignment.bottomCenter) - ..outsideDialogPadding(const EdgeInsets.only(left: 0, right: 0, bottom: PlatformInfo.isWeb ? 42 : 16)) + ..outsideDialogPadding(const EdgeInsets.only(bottom: PlatformInfo.isWeb ? 42 : 16)) ..widthDialog(MediaQuery.of(context).size.width - 16) ..heightDialog(280)) .build(), diff --git a/lib/features/sending_queue/presentation/sending_queue_controller.dart b/lib/features/sending_queue/presentation/sending_queue_controller.dart index 6eed34be2b..6be065d9d5 100644 --- a/lib/features/sending_queue/presentation/sending_queue_controller.dart +++ b/lib/features/sending_queue/presentation/sending_queue_controller.dart @@ -202,9 +202,9 @@ class SendingQueueController extends BaseController with MessageDialogActionMixi void _deleteListSendingEmailAction(BuildContext context, List listSendingEmails) { showConfirmDialogAction( - context, - AppLocalizations.of(context).messageDialogDeleteSendingEmail, - AppLocalizations.of(currentContext!).delete, + context: context, + message: AppLocalizations.of(context).messageDialogDeleteSendingEmail, + actionName: AppLocalizations.of(currentContext!).delete, title: AppLocalizations.of(currentContext!).deleteOfflineEmail, icon: SvgPicture.asset(imagePaths.icDeleteDialogRecipients), alignCenter: true, diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index c69626d619..d77e50ea4a 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2024-01-16T12:04:11.990592", + "@@last_modified": "2024-01-16T15:38:46.103746", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -3709,5 +3709,23 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "logoutConfirmation": "Logout Confirmation", + "@logoutConfirmation": { + "type": "text", + "placeholders_order": [], + "placeholders": {} + }, + "yesLogout": "Yes, Log out", + "@yesLogout": { + "type": "text", + "placeholders_order": [], + "placeholders": {} + }, + "messageConfirmationLogout": "Do you want to log out of", + "@messageConfirmationLogout": { + "type": "text", + "placeholders_order": [], + "placeholders": {} } } \ No newline at end of file diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index 9951e6a4b2..9bb13c704d 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -3864,4 +3864,22 @@ class AppLocalizations { 'Account settings', name: 'accountSettings'); } + + String get logoutConfirmation { + return Intl.message( + 'Logout Confirmation', + name: 'logoutConfirmation'); + } + + String get yesLogout { + return Intl.message( + 'Yes, Log out', + name: 'yesLogout'); + } + + String get messageConfirmationLogout { + return Intl.message( + 'Do you want to log out of', + name: 'messageConfirmationLogout'); + } } \ No newline at end of file