TF-2157 Remove collapsed/expanded signature in EmailView

(cherry picked from commit c8b233e1d9e8f0b50236e36cf40fd890100851e4)
This commit is contained in:
dab246
2023-09-20 16:27:06 +07:00
committed by Dat H. Pham
parent c77ef8238e
commit a2b3f49e24
5 changed files with 2 additions and 161 deletions
@@ -5,7 +5,6 @@ import 'dart:math' as math;
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/utils/html_transformer/html_template.dart';
import 'package:core/presentation/utils/html_transformer/html_utils.dart';
import 'package:core/presentation/utils/icon_utils.dart';
import 'package:core/presentation/views/html_viewer/html_viewer_controller_for_web.dart';
import 'package:core/utils/app_logger.dart';
import 'package:flutter/cupertino.dart';
@@ -103,10 +102,6 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
if (e && e.data && e.data.includes("toIframe:")) {
var data = JSON.parse(e.data);
if (data["view"].includes("$createdViewId")) {
if (data["type"].includes("showSignature")) {
${HtmlUtils.runScriptsCollapsedExpandedSignature}
}
if (data["type"].includes("getHeight")) {
var height = document.body.scrollHeight;
window.parent.postMessage(JSON.stringify({"view": "$createdViewId", "type": "toDart: htmlHeight", "height": height}), "*");
@@ -149,20 +144,6 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
return url.protocol === "mailto:";
}
function handleOnClickSignature() {
const contentElement = document.querySelector('.tmail-content > .tmail-signature > .tmail-signature-content');
const buttonElement = document.querySelector('.tmail-content > .tmail-signature > .tmail-signature-button');
if (contentElement && buttonElement) {
if (contentElement.style.display === 'block') {
contentElement.style.display = 'none';
buttonElement.style.backgroundImage = `${IconUtils.chevronDownSVGIconUrlEncoded}`;
} else {
contentElement.style.display = 'block';
buttonElement.style.backgroundImage = `${IconUtils.chevronUpSVGIconUrlEncoded}`;
}
}
}
</script>
''';
@@ -210,7 +191,6 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
..onLoad.listen((event) async {
_sendMessageToWebViewForGetHeight();
_sendMessageToWebViewForGetWidth();
_sendMessageToWebViewForShowSignature();
html.window.onMessage.listen((event) {
var data = json.decode(event.data);
@@ -328,14 +308,4 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
html.window.postMessage(jsonGetWidth, '*');
}
void _sendMessageToWebViewForShowSignature() {
final dataShowSignature = <String, Object>{
'type': 'toIframe: showSignature',
'view' : createdViewId
};
final jsonShowSignature = jsonEncoder.convert(dataShowSignature);
html.window.postMessage(jsonShowSignature, '*');
}
}
@@ -68,7 +68,7 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
_htmlData = generateHtml(
widget.contentHtml,
direction: widget.direction,
javaScripts: HtmlUtils.scriptLazyLoadImage + HtmlUtils.scriptCollapsedExpandedSignatureOnMobile,
javaScripts: HtmlUtils.scriptLazyLoadImage
);
}
@@ -81,7 +81,7 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
_htmlData = generateHtml(
widget.contentHtml,
direction: widget.direction,
javaScripts: HtmlUtils.scriptLazyLoadImage + HtmlUtils.scriptCollapsedExpandedSignatureOnMobile,
javaScripts: HtmlUtils.scriptLazyLoadImage
);
}
}
@@ -142,7 +142,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
await Future.wait([
_setActualHeightView(),
_setActualWidthView(),
_showSignature(),
]);
_hideLoadingProgress();
@@ -207,12 +206,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
}
}
Future<void> _showSignature() async {
await _webViewController.evaluateJavascript(
source: 'showSignature();'
);
}
void _hideLoadingProgress() {
if (mounted && _isLoading) {
setState(() {