Skip to content

Commit

Permalink
TF-2269 Add a new action "Confirm all email here are Spam" for spam m…
Browse files Browse the repository at this point in the history
…ailbox

Signed-off-by: dab246 <[email protected]>
  • Loading branch information
dab246 committed Nov 7, 2023
1 parent 74bed6e commit 1d4ef57
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/features/mailbox/presentation/mailbox_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
);
break;
case MailboxActions.markAsRead:
case MailboxActions.confirmMailSpam:
markAsReadMailboxAction(
context,
mailbox,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
}

Expand Down
8 changes: 7 additions & 1 deletion lib/features/mailbox/presentation/model/mailbox_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ enum MailboxActions {
enableMailbox,
emptyTrash,
emptySpam,
newSubfolder;
newSubfolder,
confirmMailSpam;
}

extension MailboxActionsExtension on MailboxActions {
Expand Down Expand Up @@ -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 '';
}
Expand Down Expand Up @@ -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 '';
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion lib/l10n/intl_messages.arb
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -3409,5 +3409,11 @@
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"confirmAllEmailHereAreSpam": "Confirm all email here are Spam",
"@confirmAllEmailHereAreSpam": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
}
}
7 changes: 7 additions & 0 deletions lib/main/localizations/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3526,4 +3526,11 @@ class AppLocalizations {
name: 'notSelectedMailboxToMoveMessage',
);
}

String get confirmAllEmailHereAreSpam {
return Intl.message(
'Confirm all email here are Spam',
name: 'confirmAllEmailHereAreSpam'
);
}
}

0 comments on commit 1d4ef57

Please sign in to comment.