SDK v7 Unread count Migration guide
SDK v7 brings a revamped unread-count API that computes aggregate and per-channel counts from local cache rather than relying on realtime device synchronization, and deprecates several methods to streamline your integration. In this guide, you’ll learn which methods to remove, what to use instead, how the new behavior may affect your app.
Deprecation Summary
SDK versions
The change takes effect on the following SDK versions.
iOS SDK 7.10
Android SDK 7.1.0
TS SDK 7.2.0
Flutter SDK 7.0.0
Methods
client.enableUnreadCount()
-
Must be removed
client.observeUserUnread() or client.getUserUnread()
channelRepository.getTotalChannelsUnread()
Has the same return type
Models
channel.subchannelsUnreadCount
channel.unreadCount
Replace with a new property
Deprecations
enableUnreadCount() is no longer required or supported to activate the unread-count feature. It will be removed in the upcoming version.
observeUserUnread() or getUserUnread() has been deprecated and will be removed. This method previously emitted realtime updates of the total unread count across all channels.
channel.subChannelsUnreadCount is deprecated and will be removed. It will not provide an accurate unread count of the channel.
Replacements
getTotalChannelsUnread()
Use this to receive updates of the total unread count across all channels.
It computes the sum of unread messages from the channels currently cached in your app.
channel.unreadCount
Replace any use of
channel.subChannelsUnreadCount
withchannel.unreadCount
to read the unread count for that specific channel.
Breaking Behavior
No realtime cross-device sync
Unlike
observeUserUnread()
, the new methods do not perform realtime sync across devices. Counts update as soon as the local cache is refreshed.
Cache warm-up required
To ensure accurate totals, perform a background channel query before calling
getTotalChannelsUnread()
. Channels loaded in later pages won’t contribute until cached.
Migration Steps
Remove
enableUnreadCount()
Delete any calls toclient.enableUnreadCount()
, as this method is no longer supported and has been fully deprecated.Switch from
channel.subChannelsUnreadCount
tochannel.unreadCount
Access the per-channel unread count directly on thechannel
object (channel.unreadCount
) instead of reading from the deprecatedchannel.subChannelsUnreadCount
.
Reset channel unread count
The markMessageAsRead() function is unchanged. When marking the latest message in the channel as read, the unread count value resets. This value will be recorded both locally and on the server. Other devices shall receive the new update upon the next refresh of the value.
Last updated
Was this helpful?