TF-1923 Add createdTime for DetailedEmail
(cherry picked from commit 817c35849338c483feaa2a68586b162a8a67b9a2)
This commit is contained in:
@@ -11,7 +11,7 @@ extension DetailedEmailExtension on DetailedEmail {
|
||||
DetailedEmailHiveCache toHiveCache() {
|
||||
return DetailedEmailHiveCache(
|
||||
emailId: emailId.asString,
|
||||
timeSaved: DateTime.now(),
|
||||
timeSaved: createdTime,
|
||||
attachments: attachments?.toHiveCache(),
|
||||
headers: headers?.toList().toHiveCache(),
|
||||
keywords: keywords?.toMapString(),
|
||||
@@ -26,6 +26,7 @@ extension DetailedEmailExtension on DetailedEmail {
|
||||
DetailedEmail fromEmailContentPath(String path) {
|
||||
return DetailedEmail(
|
||||
emailId: emailId,
|
||||
createdTime: createdTime,
|
||||
attachments: attachments,
|
||||
headers: headers,
|
||||
keywords: keywords,
|
||||
|
||||
@@ -10,6 +10,7 @@ extension DetailedEmailHiveCacheExtension on DetailedEmailHiveCache {
|
||||
DetailedEmail toDetailedEmailWithContent(String emailContent) {
|
||||
return DetailedEmail(
|
||||
emailId: EmailId(Id(emailId)),
|
||||
createdTime: timeSaved,
|
||||
attachments: attachments?.toAttachment(),
|
||||
headers: headers?.toSetEmailHeader(),
|
||||
keywords: keywords != null
|
||||
|
||||
@@ -7,6 +7,7 @@ extension EmailExtension on Email {
|
||||
DetailedEmail toDetailedEmail({String? htmlEmailContent}) {
|
||||
return DetailedEmail(
|
||||
emailId: id!,
|
||||
createdTime: DateTime.now(),
|
||||
attachments: allAttachments,
|
||||
headers: headers,
|
||||
keywords: keywords,
|
||||
|
||||
@@ -11,9 +11,11 @@ class DetailedEmail with EquatableMixin {
|
||||
final Map<KeyWordIdentifier, bool>? keywords;
|
||||
final String? htmlEmailContent;
|
||||
final String? emailContentPath;
|
||||
final DateTime createdTime;
|
||||
|
||||
DetailedEmail({
|
||||
required this.emailId,
|
||||
required this.createdTime,
|
||||
this.attachments,
|
||||
this.headers,
|
||||
this.keywords,
|
||||
@@ -24,6 +26,7 @@ class DetailedEmail with EquatableMixin {
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
emailId,
|
||||
createdTime,
|
||||
attachments,
|
||||
headers,
|
||||
keywords,
|
||||
|
||||
@@ -97,6 +97,7 @@ class GetEmailContentInteractor {
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
log('GetEmailContentInteractor::_getStoredOpenedEmail(): CALLED');
|
||||
final detailedEmail = await emailRepository.getStoredOpenedEmail(session, accountId, emailId);
|
||||
yield Right<Failure, Success>(GetEmailContentFromCacheSuccess(
|
||||
emailContent: detailedEmail.htmlEmailContent ?? "",
|
||||
@@ -130,6 +131,7 @@ class GetEmailContentInteractor {
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
log('GetEmailContentInteractor::_getStoredNewEmail():CALLED');
|
||||
final detailedEmail = await emailRepository.getStoredNewEmail(session, accountId, emailId);
|
||||
yield Right<Failure, Success>(GetEmailContentFromCacheSuccess(
|
||||
emailContent: detailedEmail.htmlEmailContent ?? "",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
@@ -25,6 +26,7 @@ class StoreNewEmailInteractor {
|
||||
_emailRepository.storeEmail(session, accountId, email),
|
||||
_emailRepository.storeDetailedNewEmail(session, accountId, detailedEmail),
|
||||
]);
|
||||
log('StoreNewEmailInteractor::execute():Store Success | EMAIL: ${detailedEmail.htmlEmailContent} | TIME: ${detailedEmail.createdTime}');
|
||||
yield Right<Failure, Success>(StoreNewEmailSuccess());
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(StoreNewEmailFailure(e));
|
||||
|
||||
Reference in New Issue
Block a user