TF-1961 Transform html email content in composer
(cherry picked from commit f5470c130744242195b265a0ea4aad044ad8e740)
This commit is contained in:
@@ -9,8 +9,12 @@ enum EmailActionType {
|
||||
markAsStarred,
|
||||
unMarkAsStarred,
|
||||
moveToMailbox,
|
||||
edit,
|
||||
editDraft,
|
||||
editSendingEmail,
|
||||
composeFromContentShared,
|
||||
composeFromFileShared,
|
||||
composeFromEmailAddress,
|
||||
reopenComposerBrowser,
|
||||
moveToTrash,
|
||||
deletePermanently,
|
||||
preview,
|
||||
|
||||
@@ -19,6 +19,8 @@ extension EmailExtension on Email {
|
||||
|
||||
bool get hasMdnSent => keywords?.containsKey(KeyWordIdentifier.mdnSent) == true;
|
||||
|
||||
bool get isDraft => keywords?.containsKey(KeyWordIdentifier.emailDraft) == true;
|
||||
|
||||
bool get withAttachments => hasAttachment == true;
|
||||
|
||||
bool hasReadReceipt(Map<MailboxId, PresentationMailbox> mapMailbox) {
|
||||
@@ -127,6 +129,13 @@ extension EmailExtension on Email {
|
||||
return [];
|
||||
}
|
||||
|
||||
List<Attachment> get attachmentsWithCid {
|
||||
return attachments
|
||||
?.where((element) => element.disposition != null && element.cid?.isNotEmpty == true)
|
||||
.map((item) => item.toAttachment())
|
||||
.toList() ?? [];
|
||||
}
|
||||
|
||||
PresentationMailbox? findMailboxContain(Map<MailboxId, PresentationMailbox> mapMailbox) {
|
||||
final newMailboxIds = mailboxIds;
|
||||
newMailboxIds?.removeWhere((key, value) => !value);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:model/model.dart';
|
||||
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:model/email/attachment.dart';
|
||||
|
||||
extension ListAttachmentExtension on List<Attachment> {
|
||||
|
||||
@@ -20,4 +22,15 @@ extension ListAttachmentExtension on List<Attachment> {
|
||||
return where((attachment) => attachment.hasCid())
|
||||
.toList();
|
||||
}
|
||||
|
||||
Map<String, String> toMapCidImageDownloadUrl({
|
||||
required AccountId accountId,
|
||||
required String downloadUrl
|
||||
}) {
|
||||
final mapUrlDownloadCID = {
|
||||
for (var attachment in listAttachmentsDisplayedInContent)
|
||||
attachment.cid! : attachment.getDownloadUrl(downloadUrl, accountId)
|
||||
};
|
||||
return mapUrlDownloadCID;
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ extension ListEmailAddressExtension on Set<EmailAddress>? {
|
||||
|
||||
int numberEmailAddress() => this != null ? this!.length : 0;
|
||||
|
||||
List<EmailAddress> filterEmailAddress(EmailAddress emailAddressNotExist) {
|
||||
List<EmailAddress> filterEmailAddress(String emailAddressNotExist) {
|
||||
return this != null
|
||||
? this!.where((emailAddress) => emailAddress.email != emailAddressNotExist.email).toList()
|
||||
? this!.where((emailAddress) => emailAddress.email != emailAddressNotExist).toList()
|
||||
: List.empty();
|
||||
}
|
||||
}
|
||||
@@ -110,10 +110,10 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
return allEmailAddress.isNotEmpty ? allEmailAddress.join(', ') : '';
|
||||
}
|
||||
|
||||
Tuple3<List<EmailAddress>, List<EmailAddress>, List<EmailAddress>> generateRecipientsEmailAddressForComposer(
|
||||
EmailActionType? emailActionType,
|
||||
Role? mailboxRole
|
||||
) {
|
||||
Tuple3<List<EmailAddress>, List<EmailAddress>, List<EmailAddress>> generateRecipientsEmailAddressForComposer({
|
||||
required EmailActionType emailActionType,
|
||||
Role? mailboxRole
|
||||
}) {
|
||||
switch(emailActionType) {
|
||||
case EmailActionType.reply:
|
||||
if (mailboxRole == PresentationMailbox.roleSent) {
|
||||
@@ -128,10 +128,8 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
} else {
|
||||
return Tuple3(to.asList() + from.asList(), cc.asList(), bcc.asList());
|
||||
}
|
||||
case EmailActionType.edit:
|
||||
return Tuple3(to.asList(), cc.asList(), bcc.asList());
|
||||
default:
|
||||
return const Tuple3([], [], []);
|
||||
return Tuple3(to.asList(), cc.asList(), bcc.asList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user