TF-1613 Implement handleSuccessViewState and handleFailureViewState for all controller

(cherry picked from commit 35e727e795bb3c44cc9c47e02542b5bdc3955fdd)
This commit is contained in:
dab246
2023-04-04 19:55:18 +07:00
committed by Dat Vu
parent bee9ac37aa
commit 133b04b11c
42 changed files with 662 additions and 810 deletions
@@ -30,7 +30,11 @@ class AddTooltipLinkTransformer extends DomTransformer {
if (children.isEmpty && text.isNotEmpty && url != null) {
final innerHtml = element.innerHtml;
final tagClass = element.attributes['class'];
element.attributes['class'] = '$tagClass $nameClassToolTip';
if (tagClass != null) {
element.attributes['class'] = '$tagClass $nameClassToolTip';
} else {
element.attributes['class'] = nameClassToolTip;
}
element.innerHtml = innerHtml + textHasToolTip(url);
}
}
@@ -23,20 +23,26 @@ class ImageTransformer extends DomTransformer {
final imageElements = document.querySelectorAll('img[src^="cid:"]');
log('ImageTransformer::process(): imageElements: ${imageElements.length}');
await Future.wait(imageElements.map((imageElement) async {
final _exStyle = imageElement.attributes['style'];
imageElement.attributes['style'] = '$_exStyle display: inline;max-width: 100%;';
final exStyle = imageElement.attributes['style'];
if (exStyle != null) {
imageElement.attributes['style'] = '$exStyle display: inline;max-width: 100%;';
} else {
imageElement.attributes['style'] = 'display: inline;max-width: 100%;';
}
final src = imageElement.attributes['src'];
log('ImageTransformer::process(): src: $src');
final cid = src?.replaceFirst('cid:', '').trim();
final urlDownloadCid = mapUrlDownloadCID?[cid];
log('ImageTransformer::process(): urlDownloadCid: $urlDownloadCid');
if (urlDownloadCid?.isNotEmpty == true && dioClient != null) {
final imgBase64Uri = await loadAsyncNetworkImageToBase64(
if (src != null) {
log('ImageTransformer::process(): src: $src');
final cid = src.replaceFirst('cid:', '').trim();
final urlDownloadCid = mapUrlDownloadCID?[cid];
log('ImageTransformer::process(): urlDownloadCid: $urlDownloadCid');
if (urlDownloadCid?.isNotEmpty == true && dioClient != null) {
final imgBase64Uri = await loadAsyncNetworkImageToBase64(
dioClient,
compressFileUtils,
urlDownloadCid!);
if (imgBase64Uri.isNotEmpty) {
imageElement.attributes['src'] = imgBase64Uri;
if (imgBase64Uri.isNotEmpty) {
imageElement.attributes['src'] = imgBase64Uri;
}
}
}
}));