Add domain layer for GetEmailContent
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:model/email/email_content.dart';
|
||||
|
||||
extension EmailExtension on Email {
|
||||
|
||||
EmailContent toEmailContent() {
|
||||
return EmailContent(
|
||||
id,
|
||||
htmlBody: htmlBody,
|
||||
attachments: attachments,
|
||||
bodyValues: bodyValues
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:core/core.dart';
|
||||
|
||||
extension PresentationEmailExtension on PresentationEmail {
|
||||
|
||||
String getTimeSentEmail(String locale) {
|
||||
if (sentAt != null) {
|
||||
if (sentAt!.value.isToday()) {
|
||||
return DateFormat('h:mm a', locale).format(sentAt!.value);
|
||||
} else if (sentAt!.value.isYesterday()) {
|
||||
return DateFormat('EEE', locale).format(sentAt!.value);
|
||||
} else if (sentAt!.value.isThisYear()) {
|
||||
return DateFormat('MMMd', locale).format(sentAt!.value);
|
||||
} else {
|
||||
return DateFormat('yMMMd', locale).format(sentAt!.value);
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user