TF-1270 Sync route path and mailbox contain for list email after fetched

This commit is contained in:
dab246
2022-12-07 01:15:40 +07:00
committed by Dat H. Pham
parent 54f1fd3a04
commit 7648507907
9 changed files with 189 additions and 96 deletions
+2 -7
View File
@@ -1,5 +1,4 @@
import 'package:http_parser/http_parser.dart';
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_body_part.dart';
@@ -25,7 +24,7 @@ extension EmailExtension on Email {
}
Set<String> getRecipientEmailAddressList() {
final listEmailAddress = Set<String>();
final listEmailAddress = <String>{};
final listToAddress = to.getListAddress() ?? [];
final listCcAddress = cc.getListAddress() ?? [];
final listBccAddress = bcc.getListAddress() ?? [];
@@ -100,11 +99,7 @@ extension EmailExtension on Email {
?.where((emailBody) => emailBody.partId != null && emailBody.type != null)
.toList() ?? <EmailBodyPart>[];
final mapHtmlBody = Map<PartId, MediaType>.fromIterable(
newHtmlBody,
key: (emailBody) => emailBody.partId!,
value: (emailBody) => emailBody.type!,
);
final mapHtmlBody = { for (var emailBody in newHtmlBody) emailBody.partId! : emailBody.type! };
final emailContents = bodyValues?.entries
.map((entries) => EmailContent(mapHtmlBody[entries.key].toEmailContentType(), entries.value.value))
@@ -35,23 +35,24 @@ extension PresentationEmailExtension on PresentationEmail {
PresentationEmail toggleSelect() {
return PresentationEmail(
this.id,
keywords: keywords,
size: size,
receivedAt: receivedAt,
hasAttachment: hasAttachment,
preview: preview,
subject: subject,
sentAt: sentAt,
from: from,
to: to,
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode == SelectMode.INACTIVE ? SelectMode.ACTIVE : SelectMode.INACTIVE,
routeWeb: routeWeb
this.id,
keywords: keywords,
size: size,
receivedAt: receivedAt,
hasAttachment: hasAttachment,
preview: preview,
subject: subject,
sentAt: sentAt,
from: from,
to: to,
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode == SelectMode.INACTIVE ? SelectMode.ACTIVE : SelectMode.INACTIVE,
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
@@ -73,7 +74,8 @@ extension PresentationEmailExtension on PresentationEmail {
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
@@ -155,7 +157,8 @@ extension PresentationEmailExtension on PresentationEmail {
mailboxIds: mailboxIds,
mailboxNames: listMailboxName,
selectMode: selectMode,
routeWeb: routeWeb
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
@@ -190,7 +193,8 @@ extension PresentationEmailExtension on PresentationEmail {
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
@@ -212,7 +216,31 @@ extension PresentationEmailExtension on PresentationEmail {
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
PresentationEmail syncPresentationEmail({PresentationMailbox? mailboxContain, Uri? routeWeb}) {
return PresentationEmail(
this.id,
keywords: keywords,
size: size,
receivedAt: receivedAt,
hasAttachment: hasAttachment,
preview: preview,
subject: subject,
sentAt: sentAt,
from: from,
to: to,
cc: cc,
bcc: bcc,
replyTo: replyTo,
mailboxIds: mailboxIds,
mailboxNames: mailboxNames,
selectMode: selectMode,
routeWeb: routeWeb,
mailboxContain: mailboxContain
);
}
}