TF-1363: [Presentation]: Implement enable or disable spam report for Mobile

This commit is contained in:
HuyNguyen
2023-01-17 09:53:58 +07:00
committed by Dat H. Pham
parent 272a36fdbc
commit bf353f820b
8 changed files with 74 additions and 18 deletions
@@ -1,16 +1,13 @@
enum SpamReportState {
enabled,
disabled,
}
extension SpamReportStateExtension on SpamReportState {
disabled;
String get keyValue {
switch(this) {
case SpamReportState.enabled:
return 'enabled';
case SpamReportState.disabled:
return 'disabled';
switch(this) {
case SpamReportState.enabled:
return 'enabled';
case SpamReportState.disabled:
return 'disabled';
}
}
}
@@ -12,7 +12,7 @@ class DeleteLastTimeDismissedSpamReportedInteractor {
Stream<Either<Failure, Success>> execute() async* {
try {
yield Right<Failure, Success>(DeleteLastTimeDismissedSpamReportedLoading());
await _spamReportRepository.deleteLastTimeDismissedSpamReported();
await _spamReportRepository.deleteLastTimeDismissedSpamReported();
yield Right<Failure, Success>(DeleteLastTimeDismissedSpamReportedSuccess());
} catch (e) {
yield Left<Failure, Success>(DeleteLastTimeDismissedSpamReportedFailure(e));
@@ -12,7 +12,7 @@ class DeleteSpamReportStateInteractor {
Stream<Either<Failure, Success>> execute() async* {
try {
yield Right<Failure, Success>(DeleteSpamReportStateLoading());
await _spamReportRepository.deleteSpamReportState();
await _spamReportRepository.deleteSpamReportState();
yield Right<Failure, Success>(DeleteSpamReportStateSuccess());
} catch (e) {
yield Left<Failure, Success>(DeleteSpamReportStateFailure(e));
@@ -1527,7 +1527,7 @@ class MailboxDashBoardController extends ReloadableController {
dispatchAction(OpenSpamMailboxAction(context, presentationMailbox));
}
bool get enableSpamRepot => spamReportController.enableSpamReport;
bool get enableSpamReport => spamReportController.enableSpamReport;
void _showSpamReportbanner() {
if (spamReportController.enableSpamReport) {
@@ -1536,7 +1536,7 @@ class MailboxDashBoardController extends ReloadableController {
}
void storeSpamReportStateAction() {
final _storeSpamReportState = enableSpamRepot ? SpamReportState.disabled : SpamReportState.enabled;
final _storeSpamReportState = enableSpamReport ? SpamReportState.disabled : SpamReportState.enabled;
spamReportController.storeSpamReportStateAction(_storeSpamReportState);
}