From 44bf37a24617d1281ffa29ccf3b72193ca8a55c9 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 24 Nov 2022 14:37:07 +0700 Subject: [PATCH] TF-438 Delete all state to refresh when logout --- lib/features/caching/caching_manager.dart | 5 +++++ lib/main/bindings/local/local_bindings.dart | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/features/caching/caching_manager.dart b/lib/features/caching/caching_manager.dart index 3e1731adc..6ab1e29bd 100644 --- a/lib/features/caching/caching_manager.dart +++ b/lib/features/caching/caching_manager.dart @@ -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 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() ]); } } diff --git a/lib/main/bindings/local/local_bindings.dart b/lib/main/bindings/local/local_bindings.dart index 8d0c07e85..6e92a905a 100644 --- a/lib/main/bindings/local/local_bindings.dart +++ b/lib/main/bindings/local/local_bindings.dart @@ -58,7 +58,7 @@ class LocalBindings extends Bindings { Get.put(RecentLoginUsernameCacheClient()); Get.put(RecentLoginUsernameCacheManager(Get.find())); Get.put(FcmTokenCacheClient()); - Get.put(FCMCacheManager((Get.find()))); + Get.put(FCMCacheManager(Get.find(), Get.find())); Get.put(CachingManager( Get.find(), Get.find(), @@ -66,6 +66,7 @@ class LocalBindings extends Bindings { Get.find(), Get.find(), Get.find(), + Get.find() )); }