TF-1961 Refactor html transformer

(cherry picked from commit 0272e45226ddb12827b7ef4820b00632758c353a)
This commit is contained in:
dab246
2023-08-16 12:02:34 +07:00
committed by Dat Vu
parent 289d5bbbe2
commit 1af33dd20d
14 changed files with 134 additions and 130 deletions
@@ -20,10 +20,15 @@ import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
class IdentityDataSourceImpl extends IdentityDataSource {
final HtmlTransform _htmlTransform;
final IdentityAPI _identityAPI;
final ExceptionThrower _exceptionThrower;
IdentityDataSourceImpl(this._identityAPI, this._exceptionThrower);
IdentityDataSourceImpl(
this._htmlTransform,
this._identityAPI,
this._exceptionThrower
);
@override
Future<IdentitiesResponse> getAllIdentities(Session session, AccountId accountId, {Properties? properties}) {
@@ -56,7 +61,8 @@ class IdentityDataSourceImpl extends IdentityDataSource {
@override
Future<String> transformHtmlSignature(String signature) {
return Future.sync(() async {
final signatureUnescape = await HtmlTransform(signature).transformToHtml(
final signatureUnescape = await _htmlTransform.transformToHtml(
contentHtml: signature,
transformConfiguration: TransformConfiguration.create(customDomTransformers: [
const RemoveScriptTransformer(),
const BlockQuotedTransformer(),