TF-657 Implement send receipt to sender

This commit is contained in:
dab246
2022-10-19 21:16:04 +07:00
committed by Dat H. Pham
parent 4d7ba01f00
commit 69e7715734
11 changed files with 337 additions and 9 deletions
+18 -2
View File
@@ -17,8 +17,11 @@ extension EmailExtension on Email {
bool get withAttachments => hasAttachment == true;
bool get needShowNotificationMessageReadReceipt {
return !hasMdnSent && headers.readReceiptHasBeenRequested;
bool hasReadReceipt(Map<MailboxId, PresentationMailbox> mapMailbox) {
final mailboxCurrent = findMailboxContain(mapMailbox);
return !hasMdnSent &&
headers.readReceiptHasBeenRequested &&
mailboxCurrent?.isSent == false;
}
Set<String> getRecipientEmailAddressList() {
@@ -119,4 +122,17 @@ extension EmailExtension on Email {
}
return [];
}
PresentationMailbox? findMailboxContain(Map<MailboxId, PresentationMailbox> mapMailbox) {
final newMailboxIds = mailboxIds;
newMailboxIds?.removeWhere((key, value) => !value);
if (newMailboxIds?.isNotEmpty == true) {
final firstMailboxId = newMailboxIds!.keys.first;
if (mapMailbox.containsKey(firstMailboxId)) {
return mapMailbox[firstMailboxId];
}
}
return null;
}
}