TF-657 Add headers and keywords property when get email content

This commit is contained in:
dab246
2022-10-19 16:21:15 +07:00
committed by Dat H. Pham
parent 18b3f61f70
commit 02789d527f
7 changed files with 63 additions and 16 deletions
+5
View File
@@ -14,4 +14,9 @@ class EmailProperty {
static const String bcc = 'bcc';
static const String replyTo = 'replyTo';
static const String mailboxIds = 'mailboxIds';
static const String bodyValues = 'bodyValues';
static const String htmlBody = 'htmlBody';
static const String attachments = 'attachments';
static const String headers = 'headers';
static final String headerMdnKey = 'Disposition-Notification-To';
}
@@ -13,8 +13,14 @@ extension EmailExtension on Email {
bool get hasStarred => keywords?.containsKey(KeyWordIdentifier.emailFlagged) == true;
bool get hasMdnSent => keywords?.containsKey(KeyWordIdentifier.mdnSent) == true;
bool get withAttachments => hasAttachment == true;
bool get needShowNotificationMessageReadReceipt {
return !hasMdnSent && headers.readReceiptHasBeenRequested;
}
Set<String> getRecipientEmailAddressList() {
final listEmailAddress = Set<String>();
final listToAddress = to.getListAddress() ?? [];
@@ -0,0 +1,14 @@
import 'package:jmap_dart_client/jmap/mail/email/email_header.dart';
import 'package:model/email/email_property.dart';
extension ListEmailHeaderExtension on Set<EmailHeader>? {
bool get readReceiptHasBeenRequested {
try {
final headerMdn = this?.firstWhere((header) => header.name == EmailProperty.headerMdnKey);
return headerMdn != null;
} catch (e) {
return false;
}
}
}
+1
View File
@@ -52,6 +52,7 @@ export 'extensions/session_extension.dart';
export 'extensions/user_profile_extension.dart';
export 'extensions/utc_date_extension.dart';
export 'extensions/email_filter_condition_extension.dart';
export 'extensions/list_email_header_extension.dart';
// Identity
export 'identity/identity_request_dto.dart';
export 'mailbox/expand_mode.dart';