readAll method
override
Marks all the chats as read for the authenticated MyUser until their Chat.lastItems available.
If ids
are provided, then only specified Chats will be read.
Implementation
@override
Future<void> readAll(List<ChatId>? ids) async {
Log.debug('readAll($ids)', '$runtimeType');
final List<Future> futures = [];
for (var e in chats.values) {
if (ids?.contains(e.id) == false) {
continue;
}
final ChatItem? last = e.lastItem ?? e.chat.value.lastItem;
final int unread = e.unreadCount.value;
if (unread != 0 && last != null) {
futures.add(e.read(last.id));
}
}
await Future.wait(futures);
}