Using the GetUnreadMemberCount() method, you can get the number of members who haven't read a specific message in a group channel. To get the most up-to-date value, the channel should first be updated through MarkAsRead() before calling GetUnreadMemberCount().
// Call the markAsRead() method when the current user views unread messages in a group channel.
groupChannel.MarkAsRead((inError) =>
{
if (inError != null)
return; // Handle error.
});
// To listen to an update from all the other channel members' client apps,
// implement OnReadStatusUpdated() with actions to do when notified.
SbGroupChannelHandler groupChannelHandler = new SbGroupChannelHandler
{
OnReadStatusUpdated = (inGroupChannel) =>
{
if (currentChannel.Url == inGroupChannel.Url)
{
int unreadMemberCount = inGroupChannel.GetUnreadMemberCount(message);
if (unreadMemberCount <= 0)
{
// All members have read the message.
}
else
{
// Some of members haven't read the message yet.
}
}
}
};
SendbirdChat.GroupChannel.AddGroupChannelHandler(UNIQUE_HANDLER_ID, groupChannelHandler);