TF-3385 Optimize misc
This commit is contained in:
@@ -22,16 +22,17 @@ extension ListPresentationEmailExtension on List<PresentationEmail> {
|
||||
|
||||
List<EmailId> get listEmailIds => map((email) => email.id).whereNotNull().toList();
|
||||
|
||||
Map<MailboxId, List<EmailId>> get emailIdsByMailboxId => Map.from(
|
||||
where((email) => email.mailboxContain?.mailboxId != null && email.id != null)
|
||||
.fold(<MailboxId, List<EmailId>>{}, (combine, email) {
|
||||
final mailboxId = email.mailboxContain!.mailboxId!;
|
||||
combine[mailboxId] ??= [];
|
||||
combine[mailboxId]!.add(email.id!);
|
||||
return combine;
|
||||
Map<MailboxId, List<EmailId>> get emailIdsByMailboxId {
|
||||
final Map<MailboxId, List<EmailId>> result = {};
|
||||
for (final email in this) {
|
||||
final mailboxId = email.mailboxContain?.mailboxId;
|
||||
final emailId = email.id;
|
||||
if (mailboxId != null && emailId != null) {
|
||||
(result[mailboxId] ??= []).add(emailId);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isAllCanDeletePermanently(Map<MailboxId, PresentationMailbox> mapMailbox) {
|
||||
final listMailboxContain = map((email) => email.findMailboxContain(mapMailbox))
|
||||
|
||||
Reference in New Issue
Block a user