TF-2680 Create method to update email header mdn in EmailRequest

This commit is contained in:
DatDang
2024-03-07 08:52:37 +07:00
committed by Dat H. Pham
parent 53a2ef0064
commit d33003bc64
2 changed files with 53 additions and 0 deletions
@@ -1,4 +1,6 @@
import 'package:jmap_dart_client/jmap/mail/email/individual_header_identifier.dart';
import 'package:model/model.dart';
import 'package:tmail_ui_user/features/composer/domain/model/email_request.dart';
import 'package:tmail_ui_user/features/mailbox/domain/model/create_new_mailbox_request.dart';
import 'package:tmail_ui_user/features/offline_mode/model/sending_state.dart';
@@ -27,4 +29,19 @@ extension EmailRequestExtension on EmailRequest {
previousEmailId: previousEmailId
);
}
EmailRequest withUpdatedEmailHeaderMdn(
Map<IndividualHeaderIdentifier, String?> value,
) {
return EmailRequest(
email: email.updateEmailHeaderMdn(value),
sentMailboxId: sentMailboxId,
emailIdDestroyed: emailIdDestroyed,
emailIdAnsweredOrForwarded: emailIdAnsweredOrForwarded,
identityId: identityId,
emailActionType: emailActionType,
storedSendingId: storedSendingId,
previousEmailId: previousEmailId,
);
}
}
+36
View File
@@ -180,4 +180,40 @@ extension EmailExtension on Email {
headerCalendarEvent: headerCalendarEvent
);
}
Email updateEmailHeaderMdn(
Map<IndividualHeaderIdentifier, String?> value,
) {
return Email(
id: id,
blobId: blobId,
threadId: threadId,
mailboxIds: mailboxIds,
keywords: keywords,
size: size,
receivedAt: receivedAt,
headers: headers,
messageId: messageId,
inReplyTo: inReplyTo,
references: references,
subject: subject,
sentAt: sentAt,
hasAttachment: hasAttachment,
preview: preview,
sender: sender,
from: from,
to: to,
cc: cc,
bcc: bcc,
replyTo: replyTo,
textBody: textBody,
htmlBody: htmlBody,
attachments: attachments,
bodyStructure: bodyStructure,
bodyValues: bodyValues,
headerUserAgent: headerUserAgent,
headerMdn: value,
headerCalendarEvent: headerCalendarEvent,
);
}
}