Listening for watchers
This commit is contained in:
@@ -1613,6 +1613,10 @@ class ChannelClientState {
|
|||||||
|
|
||||||
_listenMemberUnbanned();
|
_listenMemberUnbanned();
|
||||||
|
|
||||||
|
_listenUserStartWatching();
|
||||||
|
|
||||||
|
_listenUserStopWatching();
|
||||||
|
|
||||||
_startCleaningStaleTypingEvents();
|
_startCleaningStaleTypingEvents();
|
||||||
|
|
||||||
_startCleaningStalePinnedMessages();
|
_startCleaningStalePinnedMessages();
|
||||||
@@ -1793,7 +1797,7 @@ class ChannelClientState {
|
|||||||
void _incrementWatcher(User user) {
|
void _incrementWatcher(User user) {
|
||||||
List<User> newWatchers;
|
List<User> newWatchers;
|
||||||
|
|
||||||
if (channelState.watchers == null) {
|
if (channelState.watchers != null) {
|
||||||
channelState.watchers!.add(user);
|
channelState.watchers!.add(user);
|
||||||
newWatchers = channelState.watchers!;
|
newWatchers = channelState.watchers!;
|
||||||
} else {
|
} else {
|
||||||
@@ -2113,9 +2117,13 @@ class ChannelClientState {
|
|||||||
/// Channel watchers list as a stream.
|
/// Channel watchers list as a stream.
|
||||||
Stream<List<User>> get watchersStream => CombineLatestStream.combine2<
|
Stream<List<User>> get watchersStream => CombineLatestStream.combine2<
|
||||||
List<User>?, Map<String?, User?>, List<User>>(
|
List<User>?, Map<String?, User?>, List<User>>(
|
||||||
channelStateStream.map((cs) => cs.watchers),
|
channelStateStream
|
||||||
|
.map((cs) => cs.watchers)
|
||||||
|
.where((watchers) => watchers != null),
|
||||||
_channel.client.state.usersStream,
|
_channel.client.state.usersStream,
|
||||||
(watchers, users) => watchers!.map((e) => users[e.id] ?? e).toList(),
|
(watchers, users) {
|
||||||
|
return watchers!.map((e) => users[e.id] ?? e).toList();
|
||||||
|
} ,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Channel member for the current user.
|
/// Channel member for the current user.
|
||||||
|
|||||||
Reference in New Issue
Block a user