chore(llc): remove redundant event.me listener

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
xsahil03x
2021-07-27 16:48:25 +05:30
parent c5782e0275
commit aad60bbc66
@@ -318,9 +318,7 @@ class StreamChatClient {
final ownUser = OwnUser.fromUser(user);
state.currentUser = ownUser;
if (!connectWebSocket) {
return ownUser;
}
if (!connectWebSocket) return ownUser;
try {
if (_originalChatPersistenceClient != null) {
@@ -1336,21 +1334,6 @@ class ClientState {
/// Creates a new instance listening to events and updating the state
ClientState(this._client) {
_subscriptions.addAll([
_client
.on()
.where((event) =>
event.me != null && event.type != EventType.healthCheck)
.map((e) => e.me!)
.listen((user) {
currentUser = user;
final totalUnreadCount = user.totalUnreadCount;
_totalUnreadCountController.add(totalUnreadCount);
final unreadChannels = user.unreadChannels;
if (unreadChannels != null) {
_unreadChannelsController.add(unreadChannels);
}
}),
_client
.on()
.map((event) => event.unreadChannels)
@@ -1413,7 +1396,8 @@ class ClientState {
final StreamChatClient _client;
/// Update user information
/// Sets the user currently interacting with the client
/// note: this fully overrides the [currentUser]
set currentUser(OwnUser? user) {
_currentUserController.add(user);
}