In the preceding section, we discussed the configuration for utilizing the default notification center for displaying App Inbox messages.

For developers interested in implementing a custom View Controller for the App Inbox, the Castled SDK offers methods that facilitate the retrieval of messages for display. Additionally, the SDK provides essential methods for managing key lifecycle events.

// Fetching the unread message count directly
CastledInbox.sharedInstance.getInboxUnreadCount()

// Listening to unread message count changes using a callback
CastledInbox.sharedInstance.observeUnreadCountChanges(listener: { unreadCount in
    print("Inbox unread count is \(unreadCount)")
})

// Retrieving all inbox items
CastledInbox.sharedInstance.getInboxItems(completion: { result in
    print("Inbox items are \(result)")
})

// Logging read inbox items
CastledInbox.sharedInstance.logInboxItemsRead(inboxItems)

// Deleting a specific inbox item
CastledInbox.sharedInstance.deleteInboxItem(inboxItem)

// Logging a click on an inbox item
CastledInbox.sharedInstance.logInboxItemClicked(inboxItem, buttonTitle: "title")