Get state cache by AccountId

(cherry picked from commit 9bb1de613ca58e5a7cb66fbc97ecd308754d088b)
This commit is contained in:
dab246
2023-04-25 16:00:25 +07:00
committed by Dat Vu
parent 06277d3532
commit eb27022a08
29 changed files with 50 additions and 49 deletions
@@ -40,7 +40,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
Stream<MailboxResponse> getAllMailbox(Session session, AccountId accountId, {Properties? properties}) async* {
final localMailboxResponse = await Future.wait([
mapDataSource[DataSourceType.local]!.getAllMailboxCache(accountId),
stateDataSource.getState(StateType.mailbox)
stateDataSource.getState(accountId, StateType.mailbox)
]).then((List response) {
return MailboxResponse(mailboxes: response.first, state: response.last);
});
@@ -84,7 +84,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
final newMailboxResponse = await Future.wait([
mapDataSource[DataSourceType.local]!.getAllMailboxCache(accountId),
stateDataSource.getState(StateType.mailbox)
stateDataSource.getState(accountId, StateType.mailbox)
]).then((List response) {
return MailboxResponse(mailboxes: response.first, state: response.last);
});
@@ -147,7 +147,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
final newMailboxResponse = await Future.wait([
mapDataSource[DataSourceType.local]!.getAllMailboxCache(accountId),
stateDataSource.getState(StateType.mailbox)
stateDataSource.getState(accountId, StateType.mailbox)
]).then((List response) {
return MailboxResponse(mailboxes: response.first, state: response.last);
});
@@ -191,8 +191,8 @@ class MailboxRepositoryImpl extends MailboxRepository {
}
@override
Future<State?> getMailboxState() {
return stateDataSource.getState(StateType.mailbox);
Future<State?> getMailboxState(AccountId accountId) {
return stateDataSource.getState(accountId, StateType.mailbox);
}
@override