fix(cnb): skip local email cache and add safe email/state cache clearing
(cherry picked from commit 0e7f589df58240badc1d2340e9856882aa075b63)
This commit is contained in:
@@ -448,7 +448,7 @@ abstract class BaseController extends GetxController
|
||||
return;
|
||||
}
|
||||
|
||||
await clearAllMailDataCached();
|
||||
await cachingManager.clearMailDataCached();
|
||||
|
||||
_isFcmEnabled = _isFcmActivated(session, accountId);
|
||||
if (isAuthenticatedWithOidc) {
|
||||
@@ -503,11 +503,10 @@ abstract class BaseController extends GetxController
|
||||
}
|
||||
|
||||
Future<void> _handleDeleteFCMAndClearData() async {
|
||||
await Future.wait([
|
||||
if (_isFcmEnabled)
|
||||
_handleDeleteFCMRegistration(),
|
||||
clearAllData(),
|
||||
]);
|
||||
if (_isFcmEnabled) {
|
||||
await _handleDeleteFCMRegistration();
|
||||
}
|
||||
clearAllData();
|
||||
}
|
||||
|
||||
Future<void> _handleDeleteFCMRegistration() async {
|
||||
@@ -560,57 +559,24 @@ abstract class BaseController extends GetxController
|
||||
removeAllPageAndGoToLogin();
|
||||
}
|
||||
|
||||
Future<void> clearAllMailDataCached() async {
|
||||
try {
|
||||
await cachingManager.clearMailDataCached();
|
||||
if (PlatformInfo.isMobile) {
|
||||
await cachingManager.clearAllFileInStorage();
|
||||
}
|
||||
} catch (e) {
|
||||
logError('BaseController::clearAllMailDataCached:Exception = $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> clearAllData() async {
|
||||
try {
|
||||
if (isAuthenticatedWithOidc) {
|
||||
await _clearOidcAuthData();
|
||||
} else {
|
||||
await _clearBasicAuthData();
|
||||
}
|
||||
await Future.wait([
|
||||
if (isAuthenticatedWithOidc)
|
||||
deleteCredentialInteractor.execute()
|
||||
else
|
||||
deleteAuthorityOidcInteractor.execute(),
|
||||
cachingManager.clearAll(),
|
||||
languageCacheManager.removeLanguage(),
|
||||
]);
|
||||
authorizationInterceptors.clear();
|
||||
authorizationIsolateInterceptors.clear();
|
||||
await cachingManager.closeHive();
|
||||
} catch (e) {
|
||||
logWarning('BaseController::clearAllData:Exception = $e');
|
||||
logWarning('BaseController::clearAllData: Cannot clear all data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _clearBasicAuthData() async {
|
||||
await Future.wait([
|
||||
deleteCredentialInteractor.execute(),
|
||||
cachingManager.clearAll(),
|
||||
languageCacheManager.removeLanguage(),
|
||||
]);
|
||||
if (PlatformInfo.isMobile) {
|
||||
await cachingManager.clearAllFileInStorage();
|
||||
}
|
||||
authorizationInterceptors.clear();
|
||||
authorizationIsolateInterceptors.clear();
|
||||
await cachingManager.closeHive();
|
||||
}
|
||||
|
||||
Future<void> _clearOidcAuthData() async {
|
||||
await Future.wait([
|
||||
deleteAuthorityOidcInteractor.execute(),
|
||||
cachingManager.clearAll(),
|
||||
languageCacheManager.removeLanguage(),
|
||||
]);
|
||||
if (PlatformInfo.isMobile) {
|
||||
await cachingManager.clearAllFileInStorage();
|
||||
}
|
||||
authorizationIsolateInterceptors.clear();
|
||||
authorizationInterceptors.clear();
|
||||
await cachingManager.closeHive();
|
||||
}
|
||||
|
||||
int getMinInputLengthAutocomplete({
|
||||
required Session session,
|
||||
required AccountId accountId,
|
||||
|
||||
Reference in New Issue
Block a user