Merge pull request #729 from GetStream/mark-read-fix

fix(llc): fix for markAllRead()
This commit is contained in:
Salvatore Giordano
2021-10-11 10:10:02 +02:00
committed by GitHub
2 changed files with 19 additions and 0 deletions
+6
View File
@@ -1,3 +1,9 @@
## Upcoming
🐞 Fixed
- markAllRead() now updates local channel states.
## 3.1.1
✅ Added
@@ -1376,6 +1376,8 @@ class ClientState {
_listenChannelHidden();
_listenUserUpdated();
_listenAllChannelsRead();
}
final _subscriptions = <StreamSubscription>[];
@@ -1405,6 +1407,17 @@ class ClientState {
}));
}
void _listenAllChannelsRead() {
_subscriptions
.add(_client.on(EventType.notificationMarkRead).listen((event) {
if (event.cid == null) {
channels.forEach((key, value) {
value.state?.unreadCount = 0;
});
}
}));
}
void _listenChannelDeleted() {
_subscriptions.add(_client
.on(