Defaultchannelunread count always 0

@amitysupport I’m using ts-sdk for the chat. I want to know how many unread messages are there in the channel. In the channel response, I’m always getting 0 as the unread message but I have 20+ messages in that channel.

Hi @sarathdixit

May I confirm which TS-SDK version you’re currently using?

Thank you,
Amity Support

@amitysupport I’m using 0.0.1-beta.38

@amitysupport I updated the pack into latest version 0.0.1-beta.39 but still facing the same issue. I’ve attached the channel response below

Hey @sarathdixit,

This feature is currently being worked on and is at least few weeks from completion. Currently the SDK sets it to 0 by default.
Although in the interim if you wish to calculate it on your end, you can do so using the following logic

channel's unreadCount = Max(0, channel.messageCount - Max(localReadToSegment, channelUser.ReadToSegment) )

channel's hasUnreadMention = Max(localReadToSegment, channelUser.ReadToSegment) 
                          < Max(localLastMentionedSegment, channelUser.lastMentionedSegment)

C.C @amitysupport

1 Like

@cijin In which query I’ll get the data of channelUser.ReadToSegment and channelUser.lastMentionedSegment?

@sarathdixit

Might have been a mistake on my end. Please check, this post for details.

Hi @sarathdixit

We’ve confirmed this issue in our current release, which should be fixed by the end of this month.
We’ll inform you once it’s released.

Any other issues please don’t hesitate to let us know.

Thank you,
Amity Support

1 Like

@amitysupport any update on this?

Hi @sarathdixit

As mentioned, this will be released by the end of this month.
Our team is currently working as fast as we can and we’ll inform you immediately once it’s fixed.

Thank you,
Amity Support

Hi @sarathdixit

The issue should be fixed now.

Thank you,
Amity Support