TF-886 Sync delete token oidc and clear cache

This commit is contained in:
dab246
2022-09-07 11:54:53 +07:00
committed by Dat H. Pham
parent e255ea0b61
commit 34f99f38e5
18 changed files with 41 additions and 46 deletions
-10
View File
@@ -1,13 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:tmail_ui_user/features/caching/account_cache_client.dart';
import 'package:tmail_ui_user/features/caching/authentication_info_cache_client.dart';
import 'package:tmail_ui_user/features/caching/email_cache_client.dart';
import 'package:tmail_ui_user/features/caching/encryption_key_cache_client.dart';
import 'package:tmail_ui_user/features/caching/mailbox_cache_client.dart';
import 'package:tmail_ui_user/features/caching/recent_search_cache_client.dart';
import 'package:tmail_ui_user/features/caching/state_cache_client.dart';
import 'package:tmail_ui_user/features/caching/token_oidc_cache_client.dart';
class CachingManager {
@@ -15,20 +13,16 @@ class CachingManager {
final StateCacheClient _stateCacheClient;
final EmailCacheClient _emailCacheClient;
final RecentSearchCacheClient _recentSearchCacheClient;
final TokenOidcCacheClient _tokenOidcCacheClient;
final AccountCacheClient _accountCacheClient;
final EncryptionKeyCacheClient _encryptionKeyCacheClient;
final AuthenticationInfoCacheClient _authenticationInfoCacheClient;
CachingManager(
this._mailboxCacheClient,
this._stateCacheClient,
this._emailCacheClient,
this._recentSearchCacheClient,
this._tokenOidcCacheClient,
this._accountCacheClient,
this._encryptionKeyCacheClient,
this._authenticationInfoCacheClient,
);
Future<void> clearAll() async {
@@ -38,10 +32,8 @@ class CachingManager {
_mailboxCacheClient.clearAllData(),
_emailCacheClient.clearAllData(),
_recentSearchCacheClient.clearAllData(),
_tokenOidcCacheClient.clearAllData(),
_accountCacheClient.clearAllData(),
_encryptionKeyCacheClient.clearAllData(),
_authenticationInfoCacheClient.clearAllData(),
]);
} else {
await Future.wait([
@@ -49,10 +41,8 @@ class CachingManager {
_mailboxCacheClient.deleteBox(),
_emailCacheClient.deleteBox(),
_recentSearchCacheClient.deleteBox(),
_tokenOidcCacheClient.deleteBox(),
_accountCacheClient.deleteBox(),
_encryptionKeyCacheClient.deleteBox(),
_authenticationInfoCacheClient.deleteBox(),
]);
}
}