TF-3416 Handle open EML attachment in EML previewer on mobile

This commit is contained in:
dab246
2025-01-14 02:02:58 +07:00
committed by Dat H. Pham
parent 94e347f703
commit 27f64d97a8
5 changed files with 83 additions and 38 deletions
@@ -452,11 +452,8 @@ class EmailDataSourceImpl extends EmailDataSource {
final iconBase64Data = await _fileUtils.convertImageAssetToBase64(
attachment.getIcon(_imagePaths));
final link = attachment.isEMLFile && PlatformInfo.isWeb
? RouteUtils.createUrlWebLocationBar(
AppRoutes.emailEMLPreviewer,
previewId: attachment.blobId?.value,
).toString()
final link = attachment.isEMLFile
? _generateEMLAttachmentLink(attachment.blobId?.value)
: null;
final previewAttachment = PreviewAttachment(
@@ -501,6 +498,21 @@ class EmailDataSourceImpl extends EmailDataSource {
}).catchError(_exceptionThrower.throwException);
}
String _generateEMLAttachmentLink(String? blobId) {
if (blobId == null) return '';
if (PlatformInfo.isWeb) {
return RouteUtils.createUrlWebLocationBar(
AppRoutes.emailEMLPreviewer,
previewId: blobId,
).toString();
} else if (PlatformInfo.isMobile) {
return '${PreviewEmlFileUtils.emlPreviewerScheme}://$blobId';
} else {
return '';
}
}
Future<String> _transformEmailContent(
List<EmailContent> emailContents,
Map<String, String> mapCidImageDownloadUrl,