Get state cache by AccountId
(cherry picked from commit 9bb1de613ca58e5a7cb66fbc97ecd308754d088b)
This commit is contained in:
@@ -171,7 +171,7 @@ class EmailRepositoryImpl extends EmailRepository {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<jmap.State?> getEmailState() {
|
||||
return _stateDataSource.getState(StateType.email);
|
||||
Future<jmap.State?> getEmailState(AccountId accountId) {
|
||||
return _stateDataSource.getState(accountId, StateType.email);
|
||||
}
|
||||
}
|
||||
@@ -85,5 +85,5 @@ abstract class EmailRepository {
|
||||
|
||||
Future<bool> deleteEmailPermanently(Session session, AccountId accountId, EmailId emailId);
|
||||
|
||||
Future<jmap.State?> getEmailState();
|
||||
Future<jmap.State?> getEmailState(AccountId accountId);
|
||||
}
|
||||
@@ -18,8 +18,8 @@ class DeleteEmailPermanentlyInteractor {
|
||||
yield Right<Failure, Success>(StartDeleteEmailPermanently());
|
||||
|
||||
final listState = await Future.wait([
|
||||
_mailboxRepository.getMailboxState(),
|
||||
_emailRepository.getEmailState(),
|
||||
_mailboxRepository.getMailboxState(accountId),
|
||||
_emailRepository.getEmailState(accountId),
|
||||
], eagerError: true);
|
||||
|
||||
final currentMailboxState = listState.first;
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ class DeleteMultipleEmailsPermanentlyInteractor {
|
||||
yield Right<Failure, Success>(LoadingDeleteMultipleEmailsPermanentlyAll());
|
||||
|
||||
final listState = await Future.wait([
|
||||
_mailboxRepository.getMailboxState(),
|
||||
_emailRepository.getEmailState(),
|
||||
_mailboxRepository.getMailboxState(accountId),
|
||||
_emailRepository.getEmailState(accountId),
|
||||
], eagerError: true);
|
||||
|
||||
final currentMailboxState = listState.first;
|
||||
|
||||
@@ -12,7 +12,7 @@ class GetStoredEmailStateInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
||||
try {
|
||||
final state = await _emailRepository.getEmailState();
|
||||
final state = await _emailRepository.getEmailState(accountId);
|
||||
if (state != null) {
|
||||
yield Right<Failure, Success>(GetStoredEmailStateSuccess(state));
|
||||
} else {
|
||||
|
||||
@@ -17,8 +17,8 @@ class MarkAsEmailReadInteractor {
|
||||
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, Email email, ReadActions readAction) async* {
|
||||
try {
|
||||
final listState = await Future.wait([
|
||||
_mailboxRepository.getMailboxState(),
|
||||
_emailRepository.getEmailState(),
|
||||
_mailboxRepository.getMailboxState(accountId),
|
||||
_emailRepository.getEmailState(accountId),
|
||||
], eagerError: true);
|
||||
|
||||
final currentMailboxState = listState.first;
|
||||
|
||||
@@ -14,7 +14,7 @@ class MarkAsStarEmailInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, Email email, MarkStarAction markStarAction) async* {
|
||||
try {
|
||||
final currentEmailState = await emailRepository.getEmailState();
|
||||
final currentEmailState = await emailRepository.getEmailState(accountId);
|
||||
final result = await emailRepository.markAsStar(session, accountId, [email], markStarAction);
|
||||
if (result.isNotEmpty) {
|
||||
final updatedEmail = email.updatedEmail(newKeywords: result.first.keywords);
|
||||
|
||||
@@ -18,8 +18,8 @@ class MoveToMailboxInteractor {
|
||||
yield Right(LoadingMoveToMailbox());
|
||||
|
||||
final listState = await Future.wait([
|
||||
_mailboxRepository.getMailboxState(),
|
||||
_emailRepository.getEmailState(),
|
||||
_mailboxRepository.getMailboxState(accountId),
|
||||
_emailRepository.getEmailState(accountId),
|
||||
], eagerError: true);
|
||||
|
||||
final currentMailboxState = listState.first;
|
||||
|
||||
Reference in New Issue
Block a user