TF-1952 Display signature in composer on mobile

(cherry picked from commit 6a0c868eccee1cc709ce4e0f13b1abc89e653e65)
This commit is contained in:
dab246
2023-07-04 17:05:43 +07:00
committed by Dat Vu
parent 6c06d0742c
commit a271b6bacf
@@ -178,28 +178,14 @@ class ComposerController extends BaseController {
} else { } else {
contentHtml = await richTextWebController.editorController.getText(); contentHtml = await richTextWebController.editorController.getText();
} }
log('ComposerController::_getEmailBodyText():WEB: contentHtml: $contentHtml');
final newContentHtml = contentHtml.removeEditorStartTag(); final newContentHtml = contentHtml.removeEditorStartTag();
log('ComposerController::_getEmailBodyText():WEB: newContentHtml: $newContentHtml'); log('ComposerController::_getEmailBodyText()::WEB:contentHtml: $contentHtml | newContentHtml: $newContentHtml');
return newContentHtml; return newContentHtml;
} else { } else {
String contentHtml = await htmlEditorApi?.getText() ?? ''; String contentHtml = await htmlEditorApi?.getText() ?? '';
log('ComposerController::_getEmailBodyText():MOBILE: $contentHtml');
final newContentHtml = contentHtml.removeEditorStartTag(); final newContentHtml = contentHtml.removeEditorStartTag();
if (changedEmail) { log('ComposerController::_getEmailBodyText()::Mobile:contentHtml: $contentHtml | newContentHtml: $newContentHtml');
return newContentHtml; return newContentHtml;
} else if (_isMobileApp && identitySelected.value?.signatureAsString.isNotEmpty == true) {
await htmlEditorApi?.removeSignature();
await htmlEditorApi?.insertSignature(identitySelected.value!.signatureAsString.asSignatureHtml());
contentHtml = await htmlEditorApi?.getText() ?? '';
final contentHtmlWithSignature = contentHtml.removeEditorStartTag();
log('ComposerController::_getEmailBodyText():MOBILE:SIGNATURE: $contentHtmlWithSignature');
return contentHtmlWithSignature;
} else {
return newContentHtml;
}
} }
} }
@@ -1406,12 +1392,6 @@ class ComposerController extends BaseController {
} }
} }
bool get _isMobileApp {
return PlatformInfo.isMobile
&& currentContext != null
&& (_responsiveUtils.isLandscapeMobile(currentContext!) || _responsiveUtils.isPortraitMobile(currentContext!));
}
Future<void> _applyIdentityForAllFieldComposer( Future<void> _applyIdentityForAllFieldComposer(
Identity? formerIdentity, Identity? formerIdentity,
Identity newIdentity Identity newIdentity
@@ -1422,21 +1402,19 @@ class ComposerController extends BaseController {
_removeBccEmailAddressFromFormerIdentity(formerIdentity.bcc!); _removeBccEmailAddressFromFormerIdentity(formerIdentity.bcc!);
} }
if (!_isMobileApp) { await _removeSignature();
await _removeSignature();
}
} }
// Add new identity // Add new identity
if (newIdentity.bcc?.isNotEmpty == true) { if (newIdentity.bcc?.isNotEmpty == true) {
await _applyBccEmailAddressFromIdentity(newIdentity.bcc!); _applyBccEmailAddressFromIdentity(newIdentity.bcc!);
} }
if (!_isMobileApp && newIdentity.signatureAsString.isNotEmpty == true) { if (newIdentity.signatureAsString.isNotEmpty == true) {
await _applySignature(newIdentity.signatureAsString.asSignatureHtml()); await _applySignature(newIdentity.signatureAsString.asSignatureHtml());
} }
} }
Future<void> _applyBccEmailAddressFromIdentity(Set<EmailAddress> listEmailAddress) { void _applyBccEmailAddressFromIdentity(Set<EmailAddress> listEmailAddress) {
if (!listEmailAddressType.contains(PrefixEmailAddress.bcc)) { if (!listEmailAddressType.contains(PrefixEmailAddress.bcc)) {
listEmailAddressType.add(PrefixEmailAddress.bcc); listEmailAddressType.add(PrefixEmailAddress.bcc);
} }
@@ -1445,8 +1423,6 @@ class ComposerController extends BaseController {
ccAddressExpandMode.value = ExpandMode.COLLAPSE; ccAddressExpandMode.value = ExpandMode.COLLAPSE;
bccAddressExpandMode.value = ExpandMode.COLLAPSE; bccAddressExpandMode.value = ExpandMode.COLLAPSE;
_updateStatusEmailSendButton(); _updateStatusEmailSendButton();
return Future.value(null);
} }
void _removeBccEmailAddressFromFormerIdentity(Set<EmailAddress> listEmailAddress) { void _removeBccEmailAddressFromFormerIdentity(Set<EmailAddress> listEmailAddress) {