TF-1115 Implement catch exception for CleanupAccountDataSource
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:tmail_ui_user/features/cleanup/domain/model/recent_login_url_cle
|
|||||||
import 'package:tmail_ui_user/features/cleanup/domain/model/recent_login_username_cleanup_rule.dart';
|
import 'package:tmail_ui_user/features/cleanup/domain/model/recent_login_username_cleanup_rule.dart';
|
||||||
import 'package:tmail_ui_user/features/cleanup/domain/model/recent_search_cleanup_rule.dart';
|
import 'package:tmail_ui_user/features/cleanup/domain/model/recent_search_cleanup_rule.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||||
|
|
||||||
class CleanupDataSourceImpl extends CleanupDataSource {
|
class CleanupDataSourceImpl extends CleanupDataSource {
|
||||||
|
|
||||||
@@ -15,12 +16,14 @@ class CleanupDataSourceImpl extends CleanupDataSource {
|
|||||||
final RecentSearchCacheManager recentSearchCacheManager;
|
final RecentSearchCacheManager recentSearchCacheManager;
|
||||||
final RecentLoginUrlCacheManager recentLoginUrlCacheManager;
|
final RecentLoginUrlCacheManager recentLoginUrlCacheManager;
|
||||||
final RecentLoginUsernameCacheManager recentLoginUsernameCacheManager;
|
final RecentLoginUsernameCacheManager recentLoginUsernameCacheManager;
|
||||||
|
final ExceptionThrower _exceptionThrower;
|
||||||
|
|
||||||
CleanupDataSourceImpl(
|
CleanupDataSourceImpl(
|
||||||
this.emailCacheManager,
|
this.emailCacheManager,
|
||||||
this.recentSearchCacheManager,
|
this.recentSearchCacheManager,
|
||||||
this.recentLoginUrlCacheManager,
|
this.recentLoginUrlCacheManager,
|
||||||
this.recentLoginUsernameCacheManager
|
this.recentLoginUsernameCacheManager,
|
||||||
|
this._exceptionThrower
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,7 +31,7 @@ class CleanupDataSourceImpl extends CleanupDataSource {
|
|||||||
return Future.sync(() async {
|
return Future.sync(() async {
|
||||||
return await emailCacheManager.clean(cleanupRule);
|
return await emailCacheManager.clean(cleanupRule);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ class CleanupDataSourceImpl extends CleanupDataSource {
|
|||||||
return Future.sync(() async {
|
return Future.sync(() async {
|
||||||
return await recentSearchCacheManager.clean(cleanupRule);
|
return await recentSearchCacheManager.clean(cleanupRule);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ class CleanupDataSourceImpl extends CleanupDataSource {
|
|||||||
return Future.sync(() async {
|
return Future.sync(() async {
|
||||||
return await recentLoginUrlCacheManager.clean(cleanupRule);
|
return await recentLoginUrlCacheManager.clean(cleanupRule);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +58,7 @@ class CleanupDataSourceImpl extends CleanupDataSource {
|
|||||||
return Future.sync(() async {
|
return Future.sync(() async {
|
||||||
return await recentLoginUsernameCacheManager.clean(cleanupRule);
|
return await recentLoginUsernameCacheManager.clean(cleanupRule);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_inte
|
|||||||
import 'package:tmail_ui_user/features/login/domain/usecases/get_stored_token_oidc_interactor.dart';
|
import 'package:tmail_ui_user/features/login/domain/usecases/get_stored_token_oidc_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart';
|
import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/cache_exception_thrower.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
|
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
|
||||||
|
|
||||||
class HomeBindings extends BaseBindings {
|
class HomeBindings extends BaseBindings {
|
||||||
@@ -74,6 +75,7 @@ class HomeBindings extends BaseBindings {
|
|||||||
Get.find<RecentSearchCacheManager>(),
|
Get.find<RecentSearchCacheManager>(),
|
||||||
Get.find<RecentLoginUrlCacheManager>(),
|
Get.find<RecentLoginUrlCacheManager>(),
|
||||||
Get.find<RecentLoginUsernameCacheManager>(),
|
Get.find<RecentLoginUsernameCacheManager>(),
|
||||||
|
Get.find<CacheExceptionThrower>(),
|
||||||
));
|
));
|
||||||
Get.lazyPut(() => HiveAccountDatasourceImpl(
|
Get.lazyPut(() => HiveAccountDatasourceImpl(
|
||||||
Get.find<AccountCacheManager>()
|
Get.find<AccountCacheManager>()
|
||||||
|
|||||||
Reference in New Issue
Block a user