From 1d4ef573e525681028d46d7c9d92cb6127eab757 Mon Sep 17 00:00:00 2001 From: dab246 Date: Mon, 6 Nov 2023 13:07:10 +0700 Subject: [PATCH] TF-2269 Add a new action "Confirm all email here are Spam" for spam mailbox Signed-off-by: dab246 --- .../mailbox/presentation/mailbox_controller.dart | 1 + .../presentation/mixin/mailbox_widget_mixin.dart | 16 +++++++++------- .../presentation/model/mailbox_actions.dart | 8 +++++++- .../presentation/search_mailbox_controller.dart | 1 + lib/l10n/intl_messages.arb | 8 +++++++- lib/main/localizations/app_localizations.dart | 7 +++++++ 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart index d657099dc2..1b12278821 100644 --- a/lib/features/mailbox/presentation/mailbox_controller.dart +++ b/lib/features/mailbox/presentation/mailbox_controller.dart @@ -930,6 +930,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM ); break; case MailboxActions.markAsRead: + case MailboxActions.confirmMailSpam: markAsReadMailboxAction( context, mailbox, diff --git a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart index e460fd484f..a5fae6d98a 100644 --- a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart +++ b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart @@ -39,14 +39,16 @@ mixin MailboxWidgetMixin { if (PlatformInfo.isWeb) MailboxActions.openInNewTab, MailboxActions.newSubfolder, - if (mailbox.isSpam) - _mailboxActionForSpam(spamReportEnabled), - if (!mailbox.isTrash && mailbox.countUnReadEmailsAsString.isNotEmpty) - MailboxActions.markAsRead, if (mailbox.isTrash) - MailboxActions.emptyTrash, - if (PlatformInfo.isWeb && mailbox.isSpam) - MailboxActions.emptySpam, + MailboxActions.emptyTrash + else if (mailbox.isSpam) + ...[ + _mailboxActionForSpam(spamReportEnabled), + MailboxActions.confirmMailSpam, + MailboxActions.emptySpam + ] + else if (mailbox.countUnReadEmailsAsString.isNotEmpty) + MailboxActions.markAsRead ]; } diff --git a/lib/features/mailbox/presentation/model/mailbox_actions.dart b/lib/features/mailbox/presentation/model/mailbox_actions.dart index d169572f4b..4801b128b3 100644 --- a/lib/features/mailbox/presentation/model/mailbox_actions.dart +++ b/lib/features/mailbox/presentation/model/mailbox_actions.dart @@ -22,7 +22,8 @@ enum MailboxActions { enableMailbox, emptyTrash, emptySpam, - newSubfolder; + newSubfolder, + confirmMailSpam; } extension MailboxActionsExtension on MailboxActions { @@ -68,6 +69,8 @@ extension MailboxActionsExtension on MailboxActions { return AppLocalizations.of(context).emptyTrash; case MailboxActions.emptySpam: return AppLocalizations.of(context).deleteAllSpamEmails; + case MailboxActions.confirmMailSpam: + return AppLocalizations.of(context).confirmAllEmailHereAreSpam; default: return ''; } @@ -99,6 +102,8 @@ extension MailboxActionsExtension on MailboxActions { return imagePaths.icMailboxTrash; case MailboxActions.emptySpam: return imagePaths.icMailboxTrash; + case MailboxActions.confirmMailSpam: + return imagePaths.icMarkAsRead; default: return ''; } @@ -171,6 +176,7 @@ extension MailboxActionsExtension on MailboxActions { case MailboxActions.delete: case MailboxActions.emptyTrash: case MailboxActions.emptySpam: + case MailboxActions.confirmMailSpam: return ContextMenuItemState.activated; case MailboxActions.markAsRead: return mailbox.countUnReadEmailsAsString.isNotEmpty diff --git a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart index 3dfd04a3e9..f3f2723493 100644 --- a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart +++ b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart @@ -266,6 +266,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa case MailboxActions.enableSpamReport: dashboardController.storeSpamReportStateAction(); break; + case MailboxActions.confirmMailSpam: case MailboxActions.markAsRead: markAsReadMailboxAction(context, mailbox, dashboardController); break; diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 18fa46fd8e..7ff2949e2c 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2023-09-29T10:43:27.382543", + "@@last_modified": "2023-11-06T13:06:33.363526", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -3409,5 +3409,11 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "confirmAllEmailHereAreSpam": "Confirm all email here are Spam", + "@confirmAllEmailHereAreSpam": { + "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 2e22ac968b..95a8735e74 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -3526,4 +3526,11 @@ class AppLocalizations { name: 'notSelectedMailboxToMoveMessage', ); } + + String get confirmAllEmailHereAreSpam { + return Intl.message( + 'Confirm all email here are Spam', + name: 'confirmAllEmailHereAreSpam' + ); + } } \ No newline at end of file