[Problem/Question]
I have a Feed channel and a Group channel, i have couple of unread messages for both channels. I have registered to user updates via UserEventHandler, for some reason when sending messages for Group and onTotalUnreadMessageCountChanged is triggered - totalCountForFeedChannels is 0, totalCountForGroupChannels is fine.
If i send a message to Feed - the values are correct.
// What version of the SDK are you using?
sendbird_chat_sdk: 4.2.9
[Reproduction Steps]
Join a Group and Feed channel, send some messages but do not read them.
Send a message to Group
totalCountForGroupChannels - has the correct unread count
totalCountForFeedChannels is 0
[Frequency]
Always when sending messages for Group and having a feed
[Current impact]
Can’t show the correct number of unread messages for Feed
Hey Tyler, sure thing. It is pretty simple:
abstract class ChatListener {
void updateUnreadMessageBadge(int totalCountForFeedChannels, int totalCountForGroupChannels);
}
........
SendbirdChat.addUserEventHandler('ZZZ_RANDOM_ID', ChatsScreenUserlHandler(this));
.......
@override
void updateUnreadMessageBadge(int totalCountForFeedChannels, int totalCountForGroupChannels) {
print(totalCountForFeedChannels);
print(totalCountForGroupChannels);
}
......
class ChatsScreenUserlHandler extends UserEventHandler {
ChatsScreenUserlHandler(this._state);
final ChatListener _state;
@override
void onTotalUnreadMessageCountChanged(UnreadMessageCount unreadMessageCount) {
// i've printed values here as well and data are different
_state.updateUnreadMessageBadge(unreadMessageCount.totalCountForFeedChannels, unreadMessageCount.totalCountForGroupChannels);
}
@override
void onFriendsDiscovered(List<sbuser.User> friends) {}
}