TF-2269 Clear local spam report data when logout and upgrade app
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 55cd12b2f4cab207dfd525b374b58b60843ce735)
This commit is contained in:
+2
-2
@@ -11,11 +11,11 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/spam_repor
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/unread_spam_emails_response.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class SpamReportCacheDataSourceImpl extends SpamReportDataSource {
|
||||
class HiveSpamReportDataSourceImpl extends SpamReportDataSource {
|
||||
final MailboxCacheManager _mailboxCacheManager;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
SpamReportCacheDataSourceImpl(this._mailboxCacheManager, this._exceptionThrower);
|
||||
HiveSpamReportDataSourceImpl(this._mailboxCacheManager, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<bool> deleteLastTimeDismissedSpamReported() {
|
||||
+10
-10
@@ -5,35 +5,35 @@ import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox_filter_condition.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource/spam_report_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/local/share_preference_spam_report_data_source.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/local/local_spam_report_manager.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/spam_report_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/unread_spam_emails_response.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
|
||||
final SharePreferenceSpamReportDataSource _sharePreferenceSpamReportDataSource;
|
||||
class LocalSpamReportDataSourceImpl extends SpamReportDataSource {
|
||||
final LocalSpamReportManager _localSpamReportManager;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
SharePreferenceSpamReportDataSourceImpl(this._sharePreferenceSpamReportDataSource, this._exceptionThrower);
|
||||
LocalSpamReportDataSourceImpl(this._localSpamReportManager, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<DateTime> getLastTimeDismissedSpamReported() async {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported();
|
||||
return await _localSpamReportManager.getLastTimeDismissedSpamReported();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported);
|
||||
return await _localSpamReportManager.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> deleteLastTimeDismissedSpamReported() {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
|
||||
return await _localSpamReportManager.deleteLastTimeDismissedSpamReported();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@@ -52,21 +52,21 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
|
||||
@override
|
||||
Future<void> deleteSpamReportState() {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
|
||||
return await _localSpamReportManager.deleteLastTimeDismissedSpamReported();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SpamReportState> getSpamReportState() {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.getSpamReportState();
|
||||
return await _localSpamReportManager.getSpamReportState();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> storeSpamReportState(SpamReportState spamReportState) {
|
||||
return Future.sync(() async {
|
||||
return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState);
|
||||
return await _localSpamReportManager.storeSpamReportState(spamReportState);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user