TF-1708 Sync use mailbox display name to show all mailbox name by in toast, dialog, label, path..

(cherry picked from commit 62137b655383199005c31d21fce46906fab451dc)
This commit is contained in:
dab246
2023-07-06 23:32:30 +07:00
committed by Dat Vu
parent 58f90e6819
commit 24d7eee69a
28 changed files with 122 additions and 105 deletions
-11
View File
@@ -32,7 +32,6 @@ class PresentationEmail with EquatableMixin {
final Set<EmailAddress>? bcc;
final Set<EmailAddress>? replyTo;
final Map<MailboxId, bool>? mailboxIds;
final List<MailboxName?>? mailboxNames;
final SelectMode selectMode;
final Uri? routeWeb;
final PresentationMailbox? mailboxContain;
@@ -55,7 +54,6 @@ class PresentationEmail with EquatableMixin {
this.bcc,
this.replyTo,
this.mailboxIds,
this.mailboxNames,
this.selectMode = SelectMode.INACTIVE,
this.routeWeb,
this.mailboxContain,
@@ -97,14 +95,6 @@ class PresentationEmail with EquatableMixin {
bool get withAttachments => hasAttachment == true;
String get mailboxName {
if (mailboxNames?.isNotEmpty == true) {
return mailboxNames?.first?.name ?? '';
} else {
return '';
}
}
String get routeWebAsString => routeWeb.toString();
bool get pushNotificationActivated => !isDraft && !hasRead;
@@ -139,7 +129,6 @@ class PresentationEmail with EquatableMixin {
preview,
hasAttachment,
mailboxIds,
mailboxNames,
selectMode,
routeWeb,
mailboxContain,
@@ -50,7 +50,6 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode == SelectMode.INACTIVE ? SelectMode.ACTIVE : SelectMode.INACTIVE,
routeWeb: routeWeb,
mailboxContain: mailboxContain
@@ -73,7 +72,6 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain
@@ -133,15 +131,7 @@ extension PresentationEmailExtension on PresentationEmail {
PresentationEmail toSearchPresentationEmail(Map<MailboxId, PresentationMailbox> mapMailboxes) {
mailboxIds?.removeWhere((key, value) => !value);
final listMailboxId = mailboxIds?.entries
.where((entry) => entry.value)
.map((entry) => entry.key)
.toList();
final listMailboxName = listMailboxId
?.map((mailboxId) => mapMailboxes.containsKey(mailboxId) ? mapMailboxes[mailboxId]?.name : null)
.where((mailboxName) => mailboxName != null)
.toList();
final matchedMailbox = findMailboxContain(mapMailboxes);
return PresentationEmail(
id: this.id,
@@ -158,10 +148,9 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: listMailboxName,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain
mailboxContain: matchedMailbox
);
}
@@ -194,7 +183,6 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain
@@ -217,7 +205,6 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain
@@ -240,7 +227,6 @@ extension PresentationEmailExtension on PresentationEmail {
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain