TF-4195 Add Label to Thread

This commit is contained in:
dab246
2026-01-06 12:35:13 +07:00
committed by Dat H. Pham
parent ef1efc9310
commit 94fd6f8071
34 changed files with 829 additions and 40 deletions
@@ -9,6 +9,13 @@ extension MapKeywordsExtension on Map<KeyWordIdentifier, bool>? {
List<KeyWordIdentifier> get enabledKeywords =>
this?.entries.where((e) => e.value).map((e) => e.key).toList() ?? [];
Set<KeyWordIdentifier> get enabledKeywordSet => this == null
? const {}
: {
for (final entry in this!.entries)
if (entry.value) entry.key
};
Map<KeyWordIdentifier, bool> withKeyword(KeyWordIdentifier keyword) {
return Map<KeyWordIdentifier, bool>.from(this ?? {})..[keyword] = true;
}
@@ -16,4 +16,21 @@ extension PresentationEmailMapExtension on Map<EmailId, PresentationEmail?> {
}
return newMap;
}
Map<EmailId, PresentationEmail?> toggleListEmailsKeywordByIds({
required List<EmailId> emailIds,
required KeyWordIdentifier keyword,
required bool remove,
}) {
final updatedMap = Map<EmailId, PresentationEmail?>.from(this);
for (final emailId in emailIds) {
final email = updatedMap[emailId];
if (email == null) continue;
updatedMap[emailId] = email.toggleKeyword(keyword, remove);
}
return updatedMap;
}
}