Chat UIKit iOS UIKit v3
Chat UIKit iOS UIKit
Chat UIKit
iOS UIKit
Version 3

Unread messages

Copy link

Sendbird UIKit for iOS provides features for unread messages that help users keep track of their conversation in group channels. These features are designed to enhance the user experience by allowing users to easily identify and revisit messages they haven't read yet, especially in busy group channels where messages can accumulate quickly. For unread messages, the UIKit provides the following features:

  • Unread message count: the number of unread messages appears in the channel list view, helping users quickly identify which channels have new messages they haven't read yet.

  • Mark messages as unread: a user can mark messages that have arrived after a certain time point as unread, allowing them to revisit important messages or catch up on the conversation later on. Once this feature is enabled, visual indicators such as a divider and a floating view will appear in the channel view.

  • Unread message divider and floating view: visual indicators that help users keep track of unread messages in the channel view. The divider appears at the top of the first unread message, while the floating view shows the unread message count when there are unread messages in the channel.

Note: Unread message counts are enabled by default, but marking messages as unread is an optional feature that can be enabled during the UIKit initialization or through Sendbird Dashboard. Both features are available only for group channels.


Unread message count

Copy link

Unread message count informs users the number of messages they haven’t read in each group channel and appears in the list component of the SBUGroupChannelListViewController class. If the message count exceeds 100, it will show as 99+.

Note : In order to use the unread message counts feature, you must first build a channel list-based service and get a channel list view. To learn how to display channel list view, refer to the List channels page.

Customize the UI

Copy link

The UI for unread message counts can be customized through SBUChannelCellTheme in SBUTheme.

SBUChannelCellTheme

Copy link

The following table shows customizable theme properties for the unread message count feature.

CategoryPropertyDescription

Unread count

unreadCountBackgroundColor

The background color of the unread message count element.

Unread count

unreadCountFont

The font of the unread message count element.

Unread count

unreadCountTextColor

The text color of the unread message count element.


Mark as unread

Copy link

Users can also mark messages as unread in a group channel. This feature is useful for users who want to revisit important messages or catch up on conversations they may have missed while they were away from the channel. When a user marks a message as unread, it will automatically update the read status of the messages that came after the marked message.

The mark as unread feature is implemented in the SBUGroupChannelModule.List class, as a part of the UIKit's message menu item. When a user selects the Mark as unread option from the message menu item, the app will change the read status of the message and those that came after the marked message to unread.

Note: Mark as unread can be used only on user messages, file messages, and multiple files messages.

Note: Depending on the Reactions settings, the message menu may show up as a bottom sheet or a context menu. If Reactions are enabled, the Mark as unread menu will appear as a bottom sheet. If not, it will appear as a context menu. For more information, refer to our guide on Reactions.

How to enable

Copy link

To enable this feature, you can do one of the following:

  • Sendbird Dashboard: Log in to Sendbird Dashboard. Then navigate to Chat > UIKit config > Group channel and enable the Mark as unread option.

  • UIKitConfig: You can also enable the feature during the initialization of the UIKit: set the isMarkAsUnreadEnabled property in the UIKitConfig to true. The default value is false.

Note: The UIKitConfig values can override the settings configured in Sendbird Dashboard. When you set isMarkAsUnreadEnabled to true and turn the option off in the dashboard, the UIKit will still follow the value set during the initialization.


Unread message divider and floating view

Copy link

When a user marks a message as unread, the UIKit provides visual indicators to help them keep track of unread messages in the channel view.

  • Divider: Once a message is marked as unread, a divider will appear at the top of the first unread message in the channel view and visually indicate that there are unread messages in the channel. This can help users quickly identify where they left off in the conversation.

  • Floating view: If the divider isn't shown in the current screen but there are one or more unread messages in the channel, a floating view will be displayed at the top of the channel view to indicate the unread message count. Tapping on the X button of this view will mark all unread messages as read and make the floating view disappear.

Customize the UI

Copy link

To customize the style of the unread message divider and floating view, you can modify the SBUUnreadMessageNewLine and SBUUnreadMessageInfoView classes in the UIKit.

SBUUnreadMessageNewLine as divider

Copy link

The divider's text, font, and color can be customized through SBUUnreadMessageNewLine. The following table shows customizable properties for SBUUnreadMessageNewLine.

CategoryPropertyDescription

New line

label text

The text of the unread message new line.

New line

label font

The font of the unread message new line.

New line

label text color

The text color of the unread message new line.

New line

label's left horizontal line color

The color of the left horizontal line of unread message new line.

New line

label's right horizontal line color

The color of the right horizontal line of unread message new line.

SBUUnreadMessageInfoView as floating view

Copy link

If the divider isn't shown in the current screen but there are one or more unread messages in the channel, a floating view is displayed at the top of the channel view to indicate the unread message count. Tapping on the X button of this view will mark all unread messages as read and make the floating view disappear.

The following table shows customizable properties for SBUUnreadMessageInfoView.

CategoryPropertyDescription

UnreadMessageInfoView

background color

The background color of SBUUnreadMessageInfoView.

UnreadMessageInfoView

unreadMessageCountLabel text

The text that is displayed on the label in SBUUnreadMessageInfoView.

UnreadMessageInfoView

unreadMessageCountLabel font

The text font of the label in SBUUnreadMessageInfoView.

UnreadMessageInfoView

unreadMessageCountLabel tint color

The text color of the label in SBUUnreadMessageInfoView.

UnreadMessageInfoView

markAsReadButton image

The image of the button in SBUUnreadMessageInfoView.

UnreadMessageInfoView

markAsReadButton tint color

The color of the button in SBUUnreadMessageInfoView.