Store state cache by AccountId

(cherry picked from commit cb8d44d31360986b1c87694681166e83fc78a666)
This commit is contained in:
dab246
2023-04-25 15:54:22 +07:00
committed by Dat Vu
parent a6966e434e
commit 06277d3532
4 changed files with 16 additions and 11 deletions
@@ -98,7 +98,7 @@ class ThreadRepositoryImpl extends ThreadRepository {
if (networkEmailResponse != null) {
log('ThreadRepositoryImpl::getAllEmail(): filter = ${emailFilter?.mailboxId} no local state -> update from network: ${networkEmailResponse.state}');
if (networkEmailResponse.state != null) {
await _updateState(networkEmailResponse.state!);
await _updateState(accountId, networkEmailResponse.state!);
}
}
}
@@ -191,9 +191,9 @@ class ThreadRepositoryImpl extends ThreadRepository {
destroyed: newDestroyed);
}
Future<void> _updateState(State newState) async {
Future<void> _updateState(AccountId accountId, State newState) async {
log('ThreadRepositoryImpl::_updateState(): [MAIL] $newState');
await stateDataSource.saveState(newState.toStateCache(StateType.email));
await stateDataSource.saveState(accountId, newState.toStateCache(StateType.email));
}
@override
@@ -356,7 +356,7 @@ class ThreadRepositoryImpl extends ThreadRepository {
newDestroyed: emailChangeResponse.destroyed);
if (emailChangeResponse.newStateEmail != null) {
await _updateState(emailChangeResponse.newStateEmail!);
await _updateState(accountId, emailChangeResponse.newStateEmail!);
}
}
}