TF-2713 Small evolution for printing

This commit is contained in:
dab246
2024-03-15 11:32:51 +07:00
committed by Dat H. Pham
parent f342e14e7e
commit 840a191831
18 changed files with 42 additions and 127 deletions
+12
View File
@@ -2,6 +2,7 @@
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:core/domain/extensions/datetime_extension.dart';
import 'package:core/utils/app_logger.dart';
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
@@ -44,6 +45,17 @@ extension EmailExtension on Email {
mailboxCurrent?.isSent == false;
}
String getReceivedAt({required String newLocale, String? pattern}) {
log('EmailExtension::getReceivedAt: newLocale = $newLocale | pattern = $pattern');
if (receivedAt != null) {
return receivedAt!.formatDateToLocal(
pattern: pattern ?? receivedAt!.value.toLocal().toPattern(),
locale: newLocale
);
}
return '';
}
Set<String> getRecipientEmailAddressList() {
final listEmailAddress = <String>{};
final listToAddress = to.getListAddress() ?? [];
@@ -29,6 +29,7 @@ extension PresentationEmailExtension on PresentationEmail {
int numberOfAllEmailAddress() => to.numberEmailAddress() + cc.numberEmailAddress() + bcc.numberEmailAddress();
String getReceivedAt(String newLocale, {String? pattern}) {
log('PresentationEmailExtension::getReceivedAt: newLocale = $newLocale | pattern = $pattern');
final emailTime = receivedAt;
if (emailTime != null) {
return emailTime.formatDateToLocal(