TF-153 Combine moveToMailbox and moveToTrash to moveToMailbox using EmailActionType object

This commit is contained in:
dab246
2022-04-15 15:51:37 +07:00
committed by Dat H. Pham
parent 60aabfb6d1
commit 16c5aed64e
45 changed files with 268 additions and 722 deletions
+2 -4
View File
@@ -8,11 +8,9 @@ import 'package:model/model.dart';
extension EmailExtension on Email {
bool isUnReadEmail() => !(keywords?.containsKey(KeyWordIdentifier.emailSeen) == true);
bool get hasRead => keywords?.containsKey(KeyWordIdentifier.emailSeen) == true;
bool isReadEmail() => keywords?.containsKey(KeyWordIdentifier.emailSeen) == true;
bool isFlaggedEmail() => keywords?.containsKey(KeyWordIdentifier.emailFlagged) == true;
bool get hasStarred => keywords?.containsKey(KeyWordIdentifier.emailFlagged) == true;
bool get withAttachments => hasAttachment == true;
@@ -32,4 +32,12 @@ extension ListEmailIdExtension on List<EmailId> {
});
return maps;
}
Map<Id, PatchObject> generateMapUpdateObjectMarkAsSpam(MailboxId spamMailboxId) {
final Map<Id, PatchObject> maps = {};
forEach((emailId) {
maps[emailId.id] = spamMailboxId.generateActionPath();
});
return maps;
}
}
@@ -3,11 +3,11 @@ import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:model/model.dart';
extension ListPresentationEmailExtension on List<PresentationEmail> {
bool get isAllEmailRead => every((email) => email.isReadEmail());
bool get isAllEmailRead => every((email) => email.hasRead);
bool get isAllEmailStarred => every((email) => email.isFlaggedEmail());
bool get isAllEmailStarred => every((email) => email.hasStarred);
List<PresentationEmail> get allEmailUnread => where((email) => email.isUnReadEmail()).toList();
List<PresentationEmail> get allEmailUnread => where((email) => !email.hasRead).toList();
PresentationEmail? findEmail(EmailId emailId) {
try {
@@ -12,4 +12,10 @@ extension MailboxIdExtension on MailboxId {
destinationMailboxId.generatePath(): true
});
}
PatchObject generateActionPath() {
return PatchObject({
generatePath(): true,
});
}
}