TF-389 Fix can not see the attachment in EmailView
This commit is contained in:
@@ -19,7 +19,7 @@ class GetEmailContentInteractor {
|
|||||||
if (email.emailContentList.isNotEmpty) {
|
if (email.emailContentList.isNotEmpty) {
|
||||||
final newEmailContents = await emailRepository.transformEmailContent(
|
final newEmailContents = await emailRepository.transformEmailContent(
|
||||||
email.emailContentList,
|
email.emailContentList,
|
||||||
email.allAttachments.attachmentWithDispositionInlines,
|
email.allAttachments.listAttachmentsDisplayedInContent,
|
||||||
baseDownloadUrl,
|
baseDownloadUrl,
|
||||||
accountId);
|
accountId);
|
||||||
yield Right<Failure, Success>(GetEmailContentSuccess(newEmailContents, email.allAttachments));
|
yield Right<Failure, Success>(GetEmailContentSuccess(newEmailContents, email.allAttachments));
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ class EmailView extends GetView with UserSettingPopupMenuMixin {
|
|||||||
if (success is LoadingState) {
|
if (success is LoadingState) {
|
||||||
return AttachmentsPlaceHolderLoading(responsiveUtils: responsiveUtils);
|
return AttachmentsPlaceHolderLoading(responsiveUtils: responsiveUtils);
|
||||||
} else {
|
} else {
|
||||||
final attachments = emailController.attachments.attachmentsWithDispositionAttachment;
|
final attachments = emailController.attachments.listAttachmentsDisplayedOutSide;
|
||||||
return attachments.isNotEmpty
|
return attachments.isNotEmpty
|
||||||
? _buildAttachmentsBody(context, attachments)
|
? _buildAttachmentsBody(context, attachments)
|
||||||
: SizedBox.shrink();
|
: SizedBox.shrink();
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ class Attachment with EquatableMixin {
|
|||||||
this.disposition,
|
this.disposition,
|
||||||
});
|
});
|
||||||
|
|
||||||
bool cidNotEmpty() => cid != null && cid!.isNotEmpty;
|
bool noCid() => cid == null || cid?.isEmpty == true;
|
||||||
|
|
||||||
|
bool hasCid() => cid != null && cid?.isNotEmpty == true;
|
||||||
|
|
||||||
String getDownloadUrl(String baseDownloadUrl, AccountId accountId) {
|
String getDownloadUrl(String baseDownloadUrl, AccountId accountId) {
|
||||||
final downloadUriTemplate = UriTemplate('$baseDownloadUrl');
|
final downloadUriTemplate = UriTemplate('$baseDownloadUrl');
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ extension ListAttachmentExtension on List<Attachment> {
|
|||||||
return totalSize;
|
return totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Attachment> get attachmentsWithDispositionAttachment {
|
List<Attachment> get listAttachmentsDisplayedOutSide {
|
||||||
return where((attachment) => attachment.disposition == ContentDisposition.attachment).toList();
|
return where((attachment) => attachment.disposition == ContentDisposition.attachment || attachment.noCid())
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Attachment> get attachmentWithDispositionInlines {
|
List<Attachment> get listAttachmentsDisplayedInContent {
|
||||||
return where((attachment) => attachment.disposition == ContentDisposition.inline && attachment.cidNotEmpty())
|
return where((attachment) => attachment.hasCid())
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user