mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-05 16:08:46 +00:00
37 lines
1.2 KiB
Dart
37 lines
1.2 KiB
Dart
import 'package:core/core.dart';
|
|
import 'package:model/model.dart';
|
|
import 'package:tmail_ui_user/features/email/data/datasource/html_datasource.dart';
|
|
import 'package:tmail_ui_user/features/email/data/local/html_analyzer.dart';
|
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
|
|
|
class HtmlDataSourceImpl extends HtmlDataSource {
|
|
|
|
final HtmlAnalyzer _htmlAnalyzer;
|
|
final DioClient _dioClient;
|
|
final ExceptionThrower _exceptionThrower;
|
|
|
|
HtmlDataSourceImpl(this._htmlAnalyzer, this._dioClient, this._exceptionThrower);
|
|
|
|
@override
|
|
Future<EmailContent> transformEmailContent(
|
|
EmailContent emailContent,
|
|
Map<String, String>? mapUrlDownloadCID,
|
|
{bool draftsEmail = false}
|
|
) {
|
|
return Future.sync(() async {
|
|
return await _htmlAnalyzer.transformEmailContent(
|
|
emailContent,
|
|
mapUrlDownloadCID,
|
|
_dioClient,
|
|
draftsEmail: draftsEmail
|
|
);
|
|
}).catchError(_exceptionThrower.throwException);
|
|
}
|
|
|
|
@override
|
|
Future<EmailContent> addTooltipWhenHoverOnLink(EmailContent emailContent) {
|
|
return Future.sync(() async {
|
|
return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent);
|
|
}).catchError(_exceptionThrower.throwException);
|
|
}
|
|
} |