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/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/model/cleanup_rule.dart';
|
||||||
import 'package:tmail_ui_user/features/cleanup/domain/repository/cleanup_repository.dart';
|
import 'package:tmail_ui_user/features/cleanup/domain/repository/cleanup_repository.dart';
|
||||||
@@ -12,12 +11,9 @@ class CleanupRepositoryImpl extends CleanupRepository {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> cleanEmailCache(CleanupRule cleanupRule) async {
|
Future<void> cleanEmailCache(CleanupRule cleanupRule) async {
|
||||||
final lastTimeCleanup = await cleanupDataSource.getTimeCleanEmail();
|
final isSuccess = await cleanupDataSource.cleanEmailCache(cleanupRule);
|
||||||
if (lastTimeCleanup == null || !lastTimeCleanup.isToday()) {
|
if (isSuccess) {
|
||||||
final isSuccess = await cleanupDataSource.cleanEmailCache(cleanupRule);
|
await cleanupDataSource.saveTimeCleanEmail(DateTime.now());
|
||||||
if (isSuccess) {
|
|
||||||
await cleanupDataSource.saveTimeCleanEmail(DateTime.now());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user