TF-1869: Create func GetEmailFromCache and GetDetailedEmail

(cherry picked from commit 3a83a951e997db749363c19853bc7ac3ac0c650c)
This commit is contained in:
HuyNguyen
2023-05-23 18:03:51 +07:00
committed by Dat Vu
parent 1a54152a13
commit 7267ee2c64
4 changed files with 31 additions and 6 deletions
@@ -205,7 +205,18 @@ class EmailRepositoryImpl extends EmailRepository {
}
@override
Future<DetailedEmail?> getOpenedEmail(Session session, AccountId accountId, EmailId emailId) {
return emailDataSource[DataSourceType.hiveCache]!.getOpenedEmail(session, accountId, emailId);
Future<DetailedEmail?> getOpenedEmail(Session session, AccountId accountId, EmailId emailId) async {
final detailedEmail = await emailDataSource[DataSourceType.hiveCache]!.getDetailedEmail(session, accountId, emailId);
final openedEmail = await emailDataSource[DataSourceType.hiveCache]!.getOpenedEmail(session, accountId, emailId);
if (detailedEmail != null) {
return detailedEmail;
} else {
return openedEmail;
}
}
@override
Future<Email?> getEmailFromCache(Session session, AccountId accountId, EmailId emailId) {
return emailDataSource[DataSourceType.hiveCache]!.getEmailFromCache(session, accountId, emailId);
}
}