TF-4195 Add Label to Thread
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user