Prerequisites
Integration of iOS SDK.Initialize Feed Client
Feed Client
Get Feed Data Store
Returns the current notification store — the list of notifications plus metadata like page info and badge counts. You can call this anytime to get updated store data.Initialize Socket for Realtime Updates
Fetch Notification Data
Gets the first page of notifications from the SuprSend server and sets it in the notification store (it also fetches badge counts on the first call).Fetch More Notifications
Gets the next page and appends it to the notification store. Call this only whenpageInfo.hasMore == true.
Listening for Updates
Subscribe tofeed.emitter to keep your UI in sync. It fires two events:
.storeUpdate— the notification store changed (new notification, state update, pagination, mutations, socket events). Listen to this and update your local state so that the UI is refreshed..newNotification— use this listener to show a toast notification when a new notification is received.
Removing Feed
Removes the feed client and aborts its socket connection.Reconnecting: In background mode iOS suspends app activity. When the app comes from background to foreground, remove existing feed instances and reconnect the socket and emitters, then refetch data.
Action Methods
markAsRead, changeActiveStore, etc.):
Notification Structure
Notification States
- Seen:
seen_onflag is used to check if the notification has been seen in SuprSend analytics. If it’s null, the notification has not been seen yet — callmarkBulkAsSeenwhen the notification enters the viewport andseen_onis null. - Read:
read_onflag is used to check if the notification has been read. This doesn’t update SuprSend analytics and is only for visual purposes. Ifread_onis null, show a dot on the notification indicating it’s unread. CallmarkAsReadwhenread_onis null, ormarkAsUnreadwhenread_onhas a timestamp. Marking as read will also setseen_onif not already set. - Interacted:
interacted_onflag is used to set the notification as clicked in SuprSend analytics. Ifinteracted_onis null and the user clicks on the notification, callmarkAsInteracted. This will also setread_onandseen_onif not already set.