TF-438 Delete all state to refresh when logout

This commit is contained in:
dab246
2022-11-24 14:37:07 +07:00
committed by Dat H. Pham
parent a0628326dd
commit 44bf37a246
2 changed files with 7 additions and 1 deletions
@@ -6,6 +6,7 @@ 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/mailbox/data/model/state_type.dart';
import 'package:tmail_ui_user/features/push_notification/data/local/fcm_cache_manager.dart';
class CachingManager {
final MailboxCacheClient _mailboxCacheClient;
@@ -14,6 +15,7 @@ class CachingManager {
final RecentSearchCacheClient _recentSearchCacheClient;
final AccountCacheClient _accountCacheClient;
final FcmTokenCacheClient _fcmTokenCacheClient;
final FCMCacheManager _fcmCacheManager;
CachingManager(
this._mailboxCacheClient,
@@ -22,6 +24,7 @@ class CachingManager {
this._recentSearchCacheClient,
this._accountCacheClient,
this._fcmTokenCacheClient,
this._fcmCacheManager,
);
Future<void> clearAll() async {
@@ -33,6 +36,7 @@ class CachingManager {
_recentSearchCacheClient.clearAllData(),
_accountCacheClient.clearAllData(),
_fcmTokenCacheClient.clearAllData(),
_fcmCacheManager.clearAllStateToRefresh()
]);
} else {
await Future.wait([
@@ -42,6 +46,7 @@ class CachingManager {
_recentSearchCacheClient.deleteBox(),
_accountCacheClient.deleteBox(),
_fcmTokenCacheClient.deleteBox(),
_fcmCacheManager.clearAllStateToRefresh()
]);
}
}
+2 -1
View File
@@ -58,7 +58,7 @@ class LocalBindings extends Bindings {
Get.put(RecentLoginUsernameCacheClient());
Get.put(RecentLoginUsernameCacheManager(Get.find<RecentLoginUsernameCacheClient>()));
Get.put(FcmTokenCacheClient());
Get.put(FCMCacheManager((Get.find<FcmTokenCacheClient>())));
Get.put(FCMCacheManager(Get.find<FcmTokenCacheClient>(), Get.find<SharedPreferences>()));
Get.put(CachingManager(
Get.find<MailboxCacheClient>(),
Get.find<StateCacheClient>(),
@@ -66,6 +66,7 @@ class LocalBindings extends Bindings {
Get.find<RecentSearchCacheClient>(),
Get.find<AccountCacheClient>(),
Get.find<FcmTokenCacheClient>(),
Get.find<FCMCacheManager>()
));
}