Version 1
Home
/
Notifications
/
UIKit
Notifications v1
Notifications

Notification channel

Copy link

There are two different views when rendering notification channels: Feed and Chat. Feed view shows all notifications in a list form while Chat view shows notifications in the form of a user-to-user group channel.


Feed vs. Chat

Copy link

The following table lists the difference between Feed view and Chat view.

FeedChat

UI

A list view that contains a new notification badge.

A channel view that contains a channel image and timestamp for each notification.

Order of notifications

The most recent notification is displayed at the top.

The most recent notification is displayed at the bottom.

Shown in channel list view

No

Yes, it's included in the channel list view along with other group channels.


Feed view

Copy link

The following items are key elements of SBUFeedNotificationChannelViewController that are used to create a Feed view of the notification channel.

Initialize

Copy link

You can start building a new Feed view through the SBUFeedNotificationChannelViewController class by following the code below. Once the view is created, display the channel anywhere you want in your app. The channel URL of the feed notification channel can be found on Sendbird Dashboard under Notifications > Channels.

let feedChannelViewController = SBUViewControllerSet.FeedNotificationChannelViewController.init(
    channelURL: "FEED_NOTIFICATION_CHANNEL_URL"
)

If you already have an exisiting FeedNotificationChannelViewController, you need to update channel information before displaying the Feed view.

let feedChannelViewController = <YOUR_FEED_CHANNEL_VIEWCONTROLLER>
feedChannelViewController.reloadChannel(
    channelURL: "FEED_NOTIFICATION_CHANNEL_URL"
)

Module components

Copy link

In the SBUFeedNotificationChannelViewController class, SBUFeedNotificationChannelModule and its components are used to display the Feed view. The module is composed of two components: headerComponent and listComponent.

headerComponent

Copy link

The headerComponent shows the title of the notification channel.

listComponent

Copy link

The listComponent shows a list of all notifications sent to the user.

Configure new notification badge

Copy link

A green badge appears above the notification bubble when the current user receives a new notification in the Feed view. This badge is displayed based on the Feed's last read time value at the time of view creation. However, this time value remains the same while the Feed view is in the foreground, which prevents the badge from disappearing even if the user's already seen the notification. If you want to update the last read time value, see the code below. You can also call the updateLastSeenAt(_:) method in SBUFeedNotificationChannelViewModel instead.

// Feed notification channel view controller
feedChannelViewController.updateLastSeenAt()

Chat view

Copy link

The following items are key elements of SBUChatNotificationChannelViewController that are used to create a Chat view of the notification channel.

Initialize

Copy link

Before creating the Chat view, implement the code below if you're already using a channel view in your app with standard modal and navigation. The channel URL of the chat notification channel can be found on Sendbird Dashboard under Notifications > Channels.

SendbirdUI.moveToChannel(
    channelURL: "CHAT_NOTIFICATION_CHANNEL_URL",
    basedOnChannelList: true
)

If you're currently using Chat UIKit for iOS features with a specific root view controller, implement the code below.

SendbirdUI.moveToChannel(
    channelURL: "CHAT_NOTIFICATION_CHANNEL_URL",
    basedOnChannelList: true,
    rootViewController: <YOUR_ROOT_VIEWCONTROLLER>
)

If you're using the channel view differently in your app than the cases mentioned above, then you need to find the existing ChatChannelViewController object and display the view in your app. You need to also update channel information before displaying the Chat view if you already have an exisiting ChatNotificationChannelViewController,

let chatChannelViewController = <YOUR_CHAT_CHANNEL_VIEWCONTROLLER>
chatChannelViewController.reloadChannel(
    channelURL: "CHAT_NOTIFICATION_CHANNEL_URL"
)

Module components

Copy link

In the SBUChatNotificationChannelViewController class, SBUChatNotificationChannelModule and its components are used to display the Chat view. The module is composed of two components: headerComponent and listComponent.

headerComponent

Copy link

The headerComponent shows the channel title, channel image, and a back button that takes the user to the previous view.

listComponent

Copy link

The listComponent shows a list of all notifications.