TF-32 Add presentation layer of download attachment for android platform
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:http_parser/http_parser.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_body_part.dart';
|
||||
|
||||
class AttachmentFile with EquatableMixin {
|
||||
|
||||
final PartId? partId;
|
||||
final Id? blobId;
|
||||
final UnsignedInt? size;
|
||||
final String? name;
|
||||
final MediaType? type;
|
||||
final String? cid;
|
||||
|
||||
AttachmentFile(
|
||||
this.partId,
|
||||
this.blobId,
|
||||
this.size,
|
||||
this.name,
|
||||
this.type,
|
||||
this.cid
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [partId, blobId, size, name, type, cid];
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/model/attachment_file.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/model/text_format.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
@@ -15,16 +13,11 @@ class MessageContent with EquatableMixin {
|
||||
|
||||
bool hasImageInlineWithCid() => content.contains('cid:');
|
||||
|
||||
String getContentHasInlineAttachment(Session session, AccountId accountId, List<AttachmentFile> attachmentFiles) {
|
||||
String getContentHasInlineAttachment(String baseDownloadUrl, AccountId accountId, List<Attachment> attachments) {
|
||||
var contentValid = content;
|
||||
attachmentFiles.forEach((attachment) {
|
||||
attachments.forEach((attachment) {
|
||||
if(attachment.cid != null) {
|
||||
final urlDownloadImage = session.getDownloadUrl(
|
||||
'${accountId.id.value}',
|
||||
'${attachment.blobId?.value}',
|
||||
'${attachment.name}',
|
||||
'${attachment.type?.mimeType}');
|
||||
|
||||
final urlDownloadImage = attachment.getDownloadUrl(baseDownloadUrl, accountId);
|
||||
contentValid = content.replaceAll('cid:${attachment.cid}', '$urlDownloadImage');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user