TF-105 [BUG] Fix loading is blinking when reading email

This commit is contained in:
dab246
2021-10-11 23:59:40 +07:00
committed by Dat H. Pham
parent ca28b55d24
commit e654fe2866
20 changed files with 359 additions and 213 deletions
@@ -7,7 +7,8 @@ import 'package:model/model.dart';
class ComposerArguments with EquatableMixin {
final EmailActionType emailActionType;
final PresentationEmail? presentationEmail;
final EmailContent? emailContent;
final List<EmailContent>? emailContents;
final List<Attachment>? attachments;
final Session session;
final UserProfile userProfile;
final Map<Role, MailboxId> mapMailboxId;
@@ -16,7 +17,8 @@ class ComposerArguments with EquatableMixin {
ComposerArguments({
this.emailActionType = EmailActionType.compose,
this.presentationEmail,
this.emailContent,
this.emailContents,
this.attachments,
this.mailboxRole,
required this.session,
required this.userProfile,
@@ -27,7 +29,8 @@ class ComposerArguments with EquatableMixin {
List<Object?> get props => [
emailActionType,
presentationEmail,
emailContent,
emailContents,
attachments,
mailboxRole,
session,
userProfile,
@@ -1,29 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:tmail_ui_user/features/email/presentation/model/text_format.dart';
import 'package:model/model.dart';
class MessageContent with EquatableMixin {
final TextFormat textFormat;
final String content;
MessageContent(this.textFormat, this.content);
bool hasImageInlineWithCid() => content.contains('cid:');
String getContentHasInlineAttachment(String baseDownloadUrl, AccountId accountId, List<Attachment> attachments) {
var contentValid = content;
attachments.forEach((attachment) {
if(attachment.cid != null) {
final urlDownloadImage = attachment.getDownloadUrl(baseDownloadUrl, accountId);
contentValid = content.replaceAll('cid:${attachment.cid}', '$urlDownloadImage');
}
});
return contentValid;
}
@override
List<Object?> get props => [textFormat, content];
}
@@ -1,5 +0,0 @@
enum TextFormat {
HTML,
PLAIN
}
@@ -4,6 +4,13 @@ import 'package:core/core.dart';
class WebViewLoadingState extends UIState {
WebViewLoadingState();
@override
List<Object?> get props => [];
}
class WebViewLoadCompletedState extends UIState {
WebViewLoadCompletedState();
@override
List<Object?> get props => [];
}