Get spam mailbox cache by AccountId
(cherry picked from commit c35685bf34f5f4fbf28c4cbca9842c20dee61ffc)
This commit is contained in:
+3
-2
@@ -2,6 +2,7 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/repository/spam_report_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/state/get_number_of_unread_spam_emails_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/state/get_spam_mailbox_cached_state.dart';
|
||||
@@ -12,7 +13,7 @@ class GetSpamMailboxCachedInteractor {
|
||||
|
||||
GetSpamMailboxCachedInteractor(this._spamReportRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute() async* {
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetSpamMailboxCachedLoading());
|
||||
|
||||
@@ -21,7 +22,7 @@ class GetSpamMailboxCachedInteractor {
|
||||
final checkTimeCondition = timeLast.inHours > MailboxDashboardConstant.spamReportBannerDisplayTimeOut;
|
||||
|
||||
if (checkTimeCondition) {
|
||||
final spamMailbox = await _spamReportRepository.getSpamMailboxCached();
|
||||
final spamMailbox = await _spamReportRepository.getSpamMailboxCached(accountId);
|
||||
final countUnreadSpamMailbox = spamMailbox.unreadEmails?.value.value.toInt() ?? 0;
|
||||
if (countUnreadSpamMailbox > 0) {
|
||||
yield Right<Failure, Success>(GetSpamMailboxCachedSuccess(spamMailbox));
|
||||
|
||||
Reference in New Issue
Block a user