Use TupleKey(ObjectKey-AccountId-UserName) to store data to hive
(cherry picked from commit e0ace535d5f3af71eb13598d92524caf2c6d9bbf)
This commit is contained in:
+3
-2
@@ -3,6 +3,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:jmap_dart_client/jmap/core/user_name.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';
|
||||
@@ -13,7 +14,7 @@ class GetSpamMailboxCachedInteractor {
|
||||
|
||||
GetSpamMailboxCachedInteractor(this._spamReportRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetSpamMailboxCachedLoading());
|
||||
|
||||
@@ -22,7 +23,7 @@ class GetSpamMailboxCachedInteractor {
|
||||
final checkTimeCondition = timeLast.inHours > MailboxDashboardConstant.spamReportBannerDisplayTimeOut;
|
||||
|
||||
if (checkTimeCondition) {
|
||||
final spamMailbox = await _spamReportRepository.getSpamMailboxCached(accountId);
|
||||
final spamMailbox = await _spamReportRepository.getSpamMailboxCached(accountId, userName);
|
||||
final countUnreadSpamMailbox = spamMailbox.unreadEmails?.value.value.toInt() ?? 0;
|
||||
if (countUnreadSpamMailbox > 0) {
|
||||
yield Right<Failure, Success>(GetSpamMailboxCachedSuccess(spamMailbox));
|
||||
|
||||
@@ -16,8 +16,8 @@ class RemoveEmailDraftsInteractor {
|
||||
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, EmailId emailId) async* {
|
||||
try {
|
||||
final listState = await Future.wait([
|
||||
_mailboxRepository.getMailboxState(accountId),
|
||||
_emailRepository.getEmailState(accountId),
|
||||
_mailboxRepository.getMailboxState(session, accountId),
|
||||
_emailRepository.getEmailState(session, accountId),
|
||||
], eagerError: true);
|
||||
|
||||
final currentMailboxState = listState.first;
|
||||
|
||||
Reference in New Issue
Block a user