Get all email cache by AccountId

(cherry picked from commit e9f172861d595549158feb829c74afc76dd7311e)
This commit is contained in:
dab246
2023-04-25 15:49:23 +07:00
committed by Dat Vu
parent 764a12bfec
commit a6966e434e
8 changed files with 45 additions and 34 deletions
@@ -1,5 +1,4 @@
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:tmail_ui_user/features/caching/config/hive_cache_client.dart';
import 'package:tmail_ui_user/features/thread/data/model/email_cache.dart';
@@ -7,17 +6,4 @@ class EmailCacheClient extends HiveCacheClient<EmailCache> {
@override
String get tableName => 'EmailCache';
Future<List<EmailCache>> getListEmailCacheByMailboxId(MailboxId mailboxId) {
return Future.sync(() async {
final boxEmail = await openBox();
return boxEmail.values.where((emailCache) {
return emailCache.mailboxIds != null
&& emailCache.mailboxIds!.containsKey(mailboxId.id.value)
&& emailCache.mailboxIds![mailboxId.id.value] == true;
}).toList();
}).catchError((error) {
throw error;
});
}
}