TF-457 Display signature, bcc email address in composer
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
import 'package:core/data/network/dio_client.dart';
|
||||||
|
import 'package:core/presentation/utils/html_transformer/base/dom_transformer.dart';
|
||||||
|
import 'package:html/dom.dart';
|
||||||
|
|
||||||
|
class SignatureTransformer extends DomTransformer {
|
||||||
|
|
||||||
|
const SignatureTransformer();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> process(
|
||||||
|
Document document,
|
||||||
|
String message,
|
||||||
|
{
|
||||||
|
Map<String, String>? mapUrlDownloadCID,
|
||||||
|
DioClient? dioClient
|
||||||
|
}
|
||||||
|
) async {
|
||||||
|
final signatureElements = document.querySelectorAll('div.tmail-signature');
|
||||||
|
await Future.wait(signatureElements.map((element) async {
|
||||||
|
element.attributes['class'] = 'tmail-signature-blocked';
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
import 'package:core/presentation/utils/html_transformer/message_content_transformer.dart';
|
import 'package:core/presentation/utils/html_transformer/message_content_transformer.dart';
|
||||||
import 'package:core/presentation/utils/html_transformer/transform_configuration.dart';
|
|
||||||
import 'package:html/dom.dart';
|
import 'package:html/dom.dart';
|
||||||
|
|
||||||
class HtmlTransform {
|
class HtmlTransform {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
import 'package:core/presentation/utils/html_transformer/transform_configuration.dart';
|
|
||||||
import 'package:html/dom.dart';
|
import 'package:html/dom.dart';
|
||||||
import 'package:html/parser.dart' show parse;
|
import 'package:html/parser.dart' show parse;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:core/presentation/utils/html_transformer/base/text_transformer.d
|
|||||||
import 'package:core/presentation/utils/html_transformer/dom/blockquoted_transformers.dart';
|
import 'package:core/presentation/utils/html_transformer/dom/blockquoted_transformers.dart';
|
||||||
import 'package:core/presentation/utils/html_transformer/dom/image_transformers.dart';
|
import 'package:core/presentation/utils/html_transformer/dom/image_transformers.dart';
|
||||||
import 'package:core/presentation/utils/html_transformer/dom/script_transformers.dart';
|
import 'package:core/presentation/utils/html_transformer/dom/script_transformers.dart';
|
||||||
|
import 'package:core/presentation/utils/html_transformer/dom/sigature_transformers.dart';
|
||||||
|
|
||||||
/// Contains the configuration for all transformations.
|
/// Contains the configuration for all transformations.
|
||||||
class TransformConfiguration {
|
class TransformConfiguration {
|
||||||
@@ -49,6 +50,7 @@ class TransformConfiguration {
|
|||||||
|
|
||||||
static const List<DomTransformer> standardDomTransformers = [
|
static const List<DomTransformer> standardDomTransformers = [
|
||||||
RemoveScriptTransformer(),
|
RemoveScriptTransformer(),
|
||||||
|
SignatureTransformer(),
|
||||||
BlockQuotedTransformer(),
|
BlockQuotedTransformer(),
|
||||||
ImageTransformer(),
|
ImageTransformer(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class ComposerController extends BaseController {
|
|||||||
final mailboxDashBoardController = Get.find<MailboxDashBoardController>();
|
final mailboxDashBoardController = Get.find<MailboxDashBoardController>();
|
||||||
final _appToast = Get.find<AppToast>();
|
final _appToast = Get.find<AppToast>();
|
||||||
final _imagePaths = Get.find<ImagePaths>();
|
final _imagePaths = Get.find<ImagePaths>();
|
||||||
|
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
|
||||||
final expandModeAttachments = ExpandMode.COLLAPSE.obs;
|
final expandModeAttachments = ExpandMode.COLLAPSE.obs;
|
||||||
final composerArguments = Rxn<ComposerArguments>();
|
final composerArguments = Rxn<ComposerArguments>();
|
||||||
@@ -92,7 +93,8 @@ class ComposerController extends BaseController {
|
|||||||
List<EmailAddress> listBccEmailAddress = <EmailAddress>[];
|
List<EmailAddress> listBccEmailAddress = <EmailAddress>[];
|
||||||
ContactSuggestionSource _contactSuggestionSource = ContactSuggestionSource.localContact;
|
ContactSuggestionSource _contactSuggestionSource = ContactSuggestionSource.localContact;
|
||||||
HtmlEditorApi? htmlEditorApi;
|
HtmlEditorApi? htmlEditorApi;
|
||||||
final html_editor_browser.HtmlEditorController htmlControllerBrowser = html_editor_browser.HtmlEditorController(processNewLineAsBr: true);
|
final html_editor_browser.HtmlEditorController htmlControllerBrowser =
|
||||||
|
html_editor_browser.HtmlEditorController(processNewLineAsBr: true);
|
||||||
|
|
||||||
final subjectEmailInputController = TextEditingController();
|
final subjectEmailInputController = TextEditingController();
|
||||||
final toEmailAddressController = TextEditingController();
|
final toEmailAddressController = TextEditingController();
|
||||||
@@ -108,14 +110,21 @@ class ComposerController extends BaseController {
|
|||||||
|
|
||||||
void setSubjectEmail(String subject) => subjectEmail.value = subject;
|
void setSubjectEmail(String subject) => subjectEmail.value = subject;
|
||||||
|
|
||||||
Future<String> _getEmailBodyText({bool onlyText = false}) async {
|
Future<String> _getEmailBodyText({bool changedEmail = false}) async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
return await htmlControllerBrowser.getText();
|
return await htmlControllerBrowser.getText();
|
||||||
} else {
|
} else {
|
||||||
if (onlyText) {
|
if (changedEmail) {
|
||||||
return (await htmlEditorApi?.getText()) ?? '';
|
return await htmlEditorApi?.getText() ?? '';
|
||||||
} else {
|
} else {
|
||||||
return (await htmlEditorApi?.getFullHtml()) ?? '';
|
final content = await htmlEditorApi?.getText() ?? '';
|
||||||
|
if (_isMobileApp && identitySelected.value?.textSignature?.value.isNotEmpty == true) {
|
||||||
|
final newContent = '$content<br><br><br>--<br><br><div>${identitySelected.value?.textSignature?.value}</div><br>';
|
||||||
|
log('ComposerController::_generateEmail()_MOBILE: $newContent');
|
||||||
|
return newContent;
|
||||||
|
} else {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,9 +337,12 @@ class ComposerController extends BaseController {
|
|||||||
if (arguments.presentationEmail != null && userProfile != null) {
|
if (arguments.presentationEmail != null && userProfile != null) {
|
||||||
final userEmailAddress = EmailAddress(null, userProfile.email);
|
final userEmailAddress = EmailAddress(null, userProfile.email);
|
||||||
|
|
||||||
final recipients = arguments.presentationEmail!.generateRecipientsEmailAddressForComposer(arguments.emailActionType, arguments.mailboxRole);
|
final recipients = arguments.presentationEmail!.generateRecipientsEmailAddressForComposer(
|
||||||
|
arguments.emailActionType,
|
||||||
|
arguments.mailboxRole);
|
||||||
|
|
||||||
if (arguments.mailboxRole == PresentationMailbox.roleSent || arguments.emailActionType == EmailActionType.edit) {
|
if (arguments.mailboxRole == PresentationMailbox.roleSent
|
||||||
|
|| arguments.emailActionType == EmailActionType.edit) {
|
||||||
listToEmailAddress = recipients.value1;
|
listToEmailAddress = recipients.value1;
|
||||||
listCcEmailAddress = recipients.value2;
|
listCcEmailAddress = recipients.value2;
|
||||||
listBccEmailAddress = recipients.value3;
|
listBccEmailAddress = recipients.value3;
|
||||||
@@ -362,7 +374,8 @@ class ComposerController extends BaseController {
|
|||||||
_updateStatusEmailSendButton();
|
_updateStatusEmailSendButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateListEmailAddress(PrefixEmailAddress prefixEmailAddress, List<EmailAddress> newListEmailAddress) {
|
void updateListEmailAddress(PrefixEmailAddress prefixEmailAddress,
|
||||||
|
List<EmailAddress> newListEmailAddress) {
|
||||||
switch(prefixEmailAddress) {
|
switch(prefixEmailAddress) {
|
||||||
case PrefixEmailAddress.to:
|
case PrefixEmailAddress.to:
|
||||||
listToEmailAddress = newListEmailAddress;
|
listToEmailAddress = newListEmailAddress;
|
||||||
@@ -395,22 +408,31 @@ class ComposerController extends BaseController {
|
|||||||
final headerEmailQuotedAsHtml = headerEmailQuoted != null ? headerEmailQuoted.addBlockTag('cite') : '';
|
final headerEmailQuotedAsHtml = headerEmailQuoted != null ? headerEmailQuoted.addBlockTag('cite') : '';
|
||||||
|
|
||||||
final trustAsHtml = arguments.emailContents?.asHtmlString ?? '';
|
final trustAsHtml = arguments.emailContents?.asHtmlString ?? '';
|
||||||
final emailQuotedHtml = '<p></br></p>$headerEmailQuotedAsHtml${trustAsHtml.addBlockQuoteTag()}';
|
final emailQuotedHtml = '<p></br></p>$headerEmailQuotedAsHtml${trustAsHtml.addBlockQuoteTag()}</br></br></br>';
|
||||||
|
|
||||||
return emailQuotedHtml;
|
return emailQuotedHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Email> _generateEmail(Map<Role, MailboxId> mapDefaultMailboxId, UserProfile userProfile, {bool asDrafts = false}) async {
|
Future<Email> _generateEmail(Map<Role, MailboxId> mapDefaultMailboxId,
|
||||||
|
UserProfile userProfile, {bool asDrafts = false}) async {
|
||||||
final generateEmailId = EmailId(Id(_uuid.v1()));
|
final generateEmailId = EmailId(Id(_uuid.v1()));
|
||||||
final outboxMailboxId = mapDefaultMailboxId[PresentationMailbox.roleOutbox];
|
final outboxMailboxId = mapDefaultMailboxId[PresentationMailbox.roleOutbox];
|
||||||
final draftMailboxId = mapDefaultMailboxId[PresentationMailbox.roleDrafts];
|
final draftMailboxId = mapDefaultMailboxId[PresentationMailbox.roleDrafts];
|
||||||
final listFromEmailAddress = {
|
Set<EmailAddress> listFromEmailAddress = {EmailAddress(null, userProfile.email)};
|
||||||
EmailAddress(null, userProfile.email)
|
if (identitySelected.value?.email?.isNotEmpty == true) {
|
||||||
};
|
listFromEmailAddress = {EmailAddress(
|
||||||
|
identitySelected.value?.name,
|
||||||
|
identitySelected.value?.email)};
|
||||||
|
}
|
||||||
|
Set<EmailAddress> listReplyToEmailAddress = {EmailAddress(null, userProfile.email)};
|
||||||
|
if (identitySelected.value?.replyTo?.isNotEmpty == true) {
|
||||||
|
listReplyToEmailAddress = identitySelected.value!.replyTo!;
|
||||||
|
}
|
||||||
final generatePartId = PartId(_uuid.v1());
|
final generatePartId = PartId(_uuid.v1());
|
||||||
final generateBlobId = Id(_uuid.v1());
|
final generateBlobId = Id(_uuid.v1());
|
||||||
|
|
||||||
final emailBodyText = await _getEmailBodyText();
|
var emailBodyText = await _getEmailBodyText();
|
||||||
|
log('ComposerController::_generateEmail(): $emailBodyText');
|
||||||
final userAgent = await userAgentPlatform;
|
final userAgent = await userAgentPlatform;
|
||||||
|
|
||||||
return Email(
|
return Email(
|
||||||
@@ -420,7 +442,7 @@ class ComposerController extends BaseController {
|
|||||||
to: listToEmailAddress.toSet(),
|
to: listToEmailAddress.toSet(),
|
||||||
cc: listCcEmailAddress.toSet(),
|
cc: listCcEmailAddress.toSet(),
|
||||||
bcc: listBccEmailAddress.toSet(),
|
bcc: listBccEmailAddress.toSet(),
|
||||||
replyTo: listFromEmailAddress,
|
replyTo: listReplyToEmailAddress,
|
||||||
keywords: asDrafts ? {KeyWordIdentifier.emailDraft : true} : null,
|
keywords: asDrafts ? {KeyWordIdentifier.emailDraft : true} : null,
|
||||||
subject: subjectEmail.value,
|
subject: subjectEmail.value,
|
||||||
htmlBody: {
|
htmlBody: {
|
||||||
@@ -504,7 +526,8 @@ class ComposerController extends BaseController {
|
|||||||
if (!_validateAttachmentsSize()) {
|
if (!_validateAttachmentsSize()) {
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
context,
|
context,
|
||||||
AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size(filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size(
|
||||||
|
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
||||||
AppLocalizations.of(context).got_it,
|
AppLocalizations.of(context).got_it,
|
||||||
() => {},
|
() => {},
|
||||||
title: AppLocalizations.of(context).sending_failed,
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
@@ -521,7 +544,8 @@ class ComposerController extends BaseController {
|
|||||||
final session = mailboxDashBoardController.sessionCurrent;
|
final session = mailboxDashBoardController.sessionCurrent;
|
||||||
final mapDefaultMailboxId = mailboxDashBoardController.mapDefaultMailboxId;
|
final mapDefaultMailboxId = mailboxDashBoardController.mapDefaultMailboxId;
|
||||||
final userProfile = mailboxDashBoardController.userProfile.value;
|
final userProfile = mailboxDashBoardController.userProfile.value;
|
||||||
if (arguments != null && session != null && mapDefaultMailboxId.isNotEmpty && userProfile != null) {
|
if (arguments != null && session != null && mapDefaultMailboxId.isNotEmpty
|
||||||
|
&& userProfile != null) {
|
||||||
_saveEmailAddress();
|
_saveEmailAddress();
|
||||||
|
|
||||||
final email = await _generateEmail(mapDefaultMailboxId, userProfile);
|
final email = await _generateEmail(mapDefaultMailboxId, userProfile);
|
||||||
@@ -530,11 +554,11 @@ class ComposerController extends BaseController {
|
|||||||
final submissionCreateId = Id(_uuid.v1());
|
final submissionCreateId = Id(_uuid.v1());
|
||||||
|
|
||||||
mailboxDashBoardController.consumeState(_sendEmailInteractor.execute(
|
mailboxDashBoardController.consumeState(_sendEmailInteractor.execute(
|
||||||
accountId,
|
accountId,
|
||||||
EmailRequest(email, submissionCreateId, mailboxIdSaved: sentMailboxId,
|
EmailRequest(email, submissionCreateId, mailboxIdSaved: sentMailboxId,
|
||||||
emailIdDestroyed: arguments.emailActionType == EmailActionType.edit
|
emailIdDestroyed: arguments.emailActionType == EmailActionType.edit
|
||||||
? arguments.presentationEmail?.id
|
? arguments.presentationEmail?.id
|
||||||
: null)));
|
: null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
@@ -564,7 +588,8 @@ class ComposerController extends BaseController {
|
|||||||
|
|
||||||
Future<List<EmailAddress>> getAutoCompleteSuggestion({String? word, bool? isAll}) async {
|
Future<List<EmailAddress>> getAutoCompleteSuggestion({String? word, bool? isAll}) async {
|
||||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||||
return await _getAutoCompleteWithDeviceContactInteractor.execute(AutoCompletePattern(word: word, isAll: isAll))
|
return await _getAutoCompleteWithDeviceContactInteractor
|
||||||
|
.execute(AutoCompletePattern(word: word, isAll: isAll))
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess ? success.listEmailAddress : <EmailAddress>[]));
|
(success) => success is GetAutoCompleteSuccess ? success.listEmailAddress : <EmailAddress>[]));
|
||||||
@@ -610,7 +635,8 @@ class ComposerController extends BaseController {
|
|||||||
if (currentContext != null) {
|
if (currentContext != null) {
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
currentContext!,
|
currentContext!,
|
||||||
AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size(filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
AppLocalizations.of(currentContext!).message_dialog_upload_attachments_exceeds_maximum_size(
|
||||||
|
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
||||||
AppLocalizations.of(currentContext!).got_it,
|
AppLocalizations.of(currentContext!).got_it,
|
||||||
() => {},
|
() => {},
|
||||||
title: AppLocalizations.of(currentContext!).maximum_files_size,
|
title: AppLocalizations.of(currentContext!).maximum_files_size,
|
||||||
@@ -686,7 +712,8 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _isEmailChanged(BuildContext context, ComposerArguments arguments) async {
|
Future<bool> _isEmailChanged(BuildContext context, ComposerArguments arguments) async {
|
||||||
final newEmailBody = await _getEmailBodyText(onlyText: true);
|
final newEmailBody = (await _getEmailBodyText(changedEmail: true))
|
||||||
|
.replaceAll('<p><br><br><br></p>', '');
|
||||||
log('ComposerController::_isEmailChanged(): newEmailBody: $newEmailBody');
|
log('ComposerController::_isEmailChanged(): newEmailBody: $newEmailBody');
|
||||||
var oldEmailBody = '';
|
var oldEmailBody = '';
|
||||||
final contentEmail = getContentEmail(context);
|
final contentEmail = getContentEmail(context);
|
||||||
@@ -747,9 +774,11 @@ class ComposerController extends BaseController {
|
|||||||
final oldEmail = arguments.presentationEmail;
|
final oldEmail = arguments.presentationEmail;
|
||||||
|
|
||||||
if (arguments.emailActionType == EmailActionType.edit && oldEmail != null) {
|
if (arguments.emailActionType == EmailActionType.edit && oldEmail != null) {
|
||||||
mailboxDashBoardController.consumeState(_updateEmailDraftsInteractor.execute(accountId, newEmail, oldEmail.id));
|
mailboxDashBoardController.consumeState(
|
||||||
|
_updateEmailDraftsInteractor.execute(accountId, newEmail, oldEmail.id));
|
||||||
} else {
|
} else {
|
||||||
mailboxDashBoardController.consumeState(_saveEmailAsDraftsInteractor.execute(accountId, newEmail));
|
mailboxDashBoardController.consumeState(
|
||||||
|
_saveEmailAsDraftsInteractor.execute(accountId, newEmail));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -821,7 +850,8 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toggleDisplayAttachments() {
|
void toggleDisplayAttachments() {
|
||||||
final newExpandMode = expandModeAttachments.value == ExpandMode.COLLAPSE ? ExpandMode.EXPAND : ExpandMode.COLLAPSE;
|
final newExpandMode = expandModeAttachments.value == ExpandMode.COLLAPSE
|
||||||
|
? ExpandMode.EXPAND : ExpandMode.COLLAPSE;
|
||||||
expandModeAttachments.value = newExpandMode;
|
expandModeAttachments.value = newExpandMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,7 +942,87 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void selectIdentity(Identity? newIdentity) {
|
void selectIdentity(Identity? newIdentity) {
|
||||||
|
final formerIdentity = identitySelected.value;
|
||||||
identitySelected.value = newIdentity;
|
identitySelected.value = newIdentity;
|
||||||
|
if (newIdentity != null) {
|
||||||
|
_applyIdentityForAllFieldComposer(formerIdentity, newIdentity);
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get _isMobileApp {
|
||||||
|
return !BuildUtils.isWeb
|
||||||
|
&& currentContext != null
|
||||||
|
&& _responsiveUtils.isMobile(currentContext!);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _applyIdentityForAllFieldComposer(Identity? formerIdentity, Identity newIdentity) {
|
||||||
|
if (formerIdentity != null) {
|
||||||
|
// Remove former identity
|
||||||
|
if (formerIdentity.bcc?.isNotEmpty == true) {
|
||||||
|
_removeBccEmailAddressFromFormerIdentity(formerIdentity.bcc!);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_isMobileApp) {
|
||||||
|
_removeSignature();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new identity
|
||||||
|
if (newIdentity.bcc?.isNotEmpty == true) {
|
||||||
|
_applyBccEmailAddressFromIdentity(newIdentity.bcc!);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_isMobileApp) {
|
||||||
|
if (newIdentity.htmlSignature?.value.isNotEmpty == true) {
|
||||||
|
_applySignature(newIdentity.htmlSignature!);
|
||||||
|
} else if (newIdentity.textSignature?.value.isNotEmpty == true) {
|
||||||
|
_applySignature(newIdentity.textSignature!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _applyBccEmailAddressFromIdentity(Set<EmailAddress> listEmailAddress) {
|
||||||
|
if (!listEmailAddressType.contains(PrefixEmailAddress.bcc)) {
|
||||||
|
listEmailAddressType.add(PrefixEmailAddress.bcc);
|
||||||
|
}
|
||||||
|
listBccEmailAddress = listEmailAddress.toList();
|
||||||
|
toAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
_updateStatusEmailSendButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _removeBccEmailAddressFromFormerIdentity(Set<EmailAddress> listEmailAddress) {
|
||||||
|
listBccEmailAddress = listBccEmailAddress
|
||||||
|
.where((address) => !listEmailAddress.contains(address))
|
||||||
|
.toList();
|
||||||
|
if (listBccEmailAddress.isEmpty) {
|
||||||
|
listEmailAddressType.remove(PrefixEmailAddress.bcc);
|
||||||
|
}
|
||||||
|
toAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||||
|
_updateStatusEmailSendButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _applySignature(Signature signature) {
|
||||||
|
final signatureAsHtml = '--<br><br>${signature.value}';
|
||||||
|
log('ComposerController::_applySignature(): $signatureAsHtml');
|
||||||
|
if (BuildUtils.isWeb) {
|
||||||
|
htmlControllerBrowser.insertSignature(signatureAsHtml);
|
||||||
|
} else {
|
||||||
|
htmlEditorApi?.insertSignature(signatureAsHtml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _removeSignature() {
|
||||||
|
log('ComposerController::_removeSignature():');
|
||||||
|
if (BuildUtils.isWeb) {
|
||||||
|
htmlControllerBrowser.removeSignature();
|
||||||
|
} else {
|
||||||
|
htmlEditorApi?.removeSignature();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeComposer() {
|
void closeComposer() {
|
||||||
|
|||||||
@@ -89,7 +89,9 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: _buildAppBar(context, controller.isEnableEmailSendButton.value)),
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
child: _buildAppBar(context, controller.isEnableEmailSendButton.value)),
|
||||||
const Padding(padding: EdgeInsets.only(top: 8), child: Divider(color: AppColor.colorDividerComposer, height: 1)),
|
const Padding(padding: EdgeInsets.only(top: 8), child: Divider(color: AppColor.colorDividerComposer, height: 1)),
|
||||||
Expanded(child: _buildBodyTablet(context)),
|
Expanded(child: _buildBodyTablet(context)),
|
||||||
const Divider(color: AppColor.colorDividerComposer, height: 1),
|
const Divider(color: AppColor.colorDividerComposer, height: 1),
|
||||||
@@ -119,12 +121,13 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
controller.closeComposer();
|
controller.closeComposer();
|
||||||
}),
|
}),
|
||||||
Expanded(child: _buildTitleComposer(context)),
|
Expanded(child: _buildTitleComposer(context)),
|
||||||
buildIconWeb(
|
if (responsiveUtils.isMobile(context))
|
||||||
icon: SvgPicture.asset(
|
buildIconWeb(
|
||||||
isEnableSendButton ? imagePaths.icSendMobile : imagePaths.icSendDisable,
|
icon: SvgPicture.asset(
|
||||||
fit: BoxFit.fill),
|
isEnableSendButton ? imagePaths.icSendMobile : imagePaths.icSendDisable,
|
||||||
tooltip: AppLocalizations.of(context).send,
|
fit: BoxFit.fill),
|
||||||
onTap: () => controller.sendEmailAction(context)),
|
tooltip: AppLocalizations.of(context).send,
|
||||||
|
onTap: () => controller.sendEmailAction(context)),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -481,6 +484,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
return HtmlEditor(
|
return HtmlEditor(
|
||||||
key: const Key('composer_editor'),
|
key: const Key('composer_editor'),
|
||||||
minHeight: 550,
|
minHeight: 550,
|
||||||
|
initialContent: '<p><br><br><br></p>',
|
||||||
onCreated: (editorApi) => controller.htmlEditorApi = editorApi);
|
onCreated: (editorApi) => controller.htmlEditorApi = editorApi);
|
||||||
} else {
|
} else {
|
||||||
final message = controller.getContentEmail(context);
|
final message = controller.getContentEmail(context);
|
||||||
|
|||||||
@@ -331,29 +331,31 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
customButton: SvgPicture.asset(imagePaths.icEditIdentity),
|
customButton: SvgPicture.asset(imagePaths.icEditIdentity),
|
||||||
items: controller.listIdentities.map((item) => DropdownMenuItem<Identity>(
|
items: controller.listIdentities.map((item) => DropdownMenuItem<Identity>(
|
||||||
value: item,
|
value: item,
|
||||||
child: Container(
|
child: PointerInterceptor(
|
||||||
alignment: Alignment.centerLeft,
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
alignment: Alignment.centerLeft,
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
borderRadius: BorderRadius.circular(12),
|
decoration: BoxDecoration(
|
||||||
color: item == controller.identitySelected.value ? AppColor.colorBgMenuItemDropDownSelected : Colors.transparent),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Column(
|
color: item == controller.identitySelected.value ? AppColor.colorBgMenuItemDropDownSelected : Colors.transparent),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
Text(
|
children: [
|
||||||
item.name ?? '',
|
Text(
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
item.name ?? '',
|
||||||
maxLines: 1,
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
),
|
overflow: TextOverflow.ellipsis,
|
||||||
Text(
|
),
|
||||||
item.email ?? '',
|
Text(
|
||||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.normal, color: AppColor.colorHintSearchBar),
|
item.email ?? '',
|
||||||
maxLines: 1,
|
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.normal, color: AppColor.colorHintSearchBar),
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
)
|
overflow: TextOverflow.ellipsis,
|
||||||
]
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)).toList(),
|
)).toList(),
|
||||||
@@ -516,7 +518,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.composerArguments.value != null) {
|
if (controller.composerArguments.value != null) {
|
||||||
if (controller.composerArguments.value?.emailActionType == EmailActionType.compose) {
|
if (controller.composerArguments.value?.emailActionType == EmailActionType.compose) {
|
||||||
final initContent = controller.textEditorWeb ?? '';
|
final initContent = controller.textEditorWeb ?? '<p><br><br><br></p>';
|
||||||
return Expanded(child: Padding(
|
return Expanded(child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: responsiveUtils.isMobile(context) ? 8 : 10),
|
padding: EdgeInsets.symmetric(horizontal: responsiveUtils.isMobile(context) ? 8 : 10),
|
||||||
child: _buildEditor(context, initContent)));
|
child: _buildEditor(context, initContent)));
|
||||||
@@ -554,8 +556,8 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
return html_editor_browser.HtmlEditor(
|
return html_editor_browser.HtmlEditor(
|
||||||
key: const Key('composer_editor_web'),
|
key: const Key('composer_editor_web'),
|
||||||
controller: controller.htmlControllerBrowser,
|
controller: controller.htmlControllerBrowser,
|
||||||
htmlEditorOptions: html_editor_browser.HtmlEditorOptions(
|
htmlEditorOptions: const html_editor_browser.HtmlEditorOptions(
|
||||||
hint: AppLocalizations.of(context).hint_compose_email,
|
hint: '',
|
||||||
darkMode: false,
|
darkMode: false,
|
||||||
),
|
),
|
||||||
blockQuotedContent: initContent,
|
blockQuotedContent: initContent,
|
||||||
|
|||||||
@@ -150,14 +150,9 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
message: AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
|
message: AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
|
||||||
icon: _imagePaths.icSendToast);
|
icon: _imagePaths.icSendToast);
|
||||||
}
|
}
|
||||||
clearState();
|
|
||||||
} else if (success is SaveEmailAsDraftsSuccess) {
|
} else if (success is SaveEmailAsDraftsSuccess) {
|
||||||
log('MailboxDashBoardController::onDone(): SaveEmailAsDraftsSuccess');
|
log('MailboxDashBoardController::onDone(): SaveEmailAsDraftsSuccess');
|
||||||
_saveEmailAsDraftsSuccess(success);
|
_saveEmailAsDraftsSuccess(success);
|
||||||
clearState();
|
|
||||||
} else if (success is RemoveEmailDraftsSuccess
|
|
||||||
|| success is UpdateEmailDraftsSuccess) {
|
|
||||||
clearState();
|
|
||||||
} else if (success is MoveToMailboxSuccess) {
|
} else if (success is MoveToMailboxSuccess) {
|
||||||
_moveToMailboxSuccess(success);
|
_moveToMailboxSuccess(success);
|
||||||
} else if (success is DeleteEmailPermanentlySuccess) {
|
} else if (success is DeleteEmailPermanentlySuccess) {
|
||||||
|
|||||||
+3
-2
@@ -122,13 +122,14 @@ dependencies:
|
|||||||
# enough_html_editor: Compose email for Mobile & Tablet
|
# enough_html_editor: Compose email for Mobile & Tablet
|
||||||
enough_html_editor:
|
enough_html_editor:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Enough-Software/enough_html_editor.git
|
url: https://github.com/dab246/enough_html_editor.git
|
||||||
|
ref: improvements_for_use_tmail
|
||||||
|
|
||||||
# html_editor_enhanced: Compose email for Web Browser
|
# html_editor_enhanced: Compose email for Web Browser
|
||||||
html_editor_enhanced:
|
html_editor_enhanced:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/dab246/html-editor-enhanced.git
|
url: https://github.com/dab246/html-editor-enhanced.git
|
||||||
ref: fix_display_content
|
ref: improvements_for_use_tmail
|
||||||
|
|
||||||
# fk_user_agent
|
# fk_user_agent
|
||||||
fk_user_agent: 2.1.0
|
fk_user_agent: 2.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user