Clean up the cache whenever start the app
This commit is contained in:
committed by
Dat H. Pham
parent
bb4538d090
commit
ff9bc6d7e5
@@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:tmail_ui_user/features/cleanup/data/datasource/cleanup_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/cleanup/domain/model/cleanup_rule.dart';
|
||||
import 'package:tmail_ui_user/features/cleanup/domain/repository/cleanup_repository.dart';
|
||||
@@ -12,12 +11,9 @@ class CleanupRepositoryImpl extends CleanupRepository {
|
||||
|
||||
@override
|
||||
Future<void> cleanEmailCache(CleanupRule cleanupRule) async {
|
||||
final lastTimeCleanup = await cleanupDataSource.getTimeCleanEmail();
|
||||
if (lastTimeCleanup == null || !lastTimeCleanup.isToday()) {
|
||||
final isSuccess = await cleanupDataSource.cleanEmailCache(cleanupRule);
|
||||
if (isSuccess) {
|
||||
await cleanupDataSource.saveTimeCleanEmail(DateTime.now());
|
||||
}
|
||||
final isSuccess = await cleanupDataSource.cleanEmailCache(cleanupRule);
|
||||
if (isSuccess) {
|
||||
await cleanupDataSource.saveTimeCleanEmail(DateTime.now());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user