NotificationHelper
public protocol NotificationHelper
Undocumented
-
pushHandlerthat will handle all push notification navigation except Rich Push NotificationDeclaration
Swift
var pushHandler: PushHandler { get } -
RichPushHandlerthat will handle all Rich Push Notification Quick ActionsDeclaration
Swift
var richPushHandler: RichPushHandler { get } -
Device ID that will be used when registering the device to the server along with the device token
Declaration
Swift
var deviceId: String { get } -
Register to receive remote notifications via Apple Push Notification service.
Declaration
Swift
func registerForRemoteNotifications() -
Requests authorization to interact with the user when local and remote notifications are delivered to the user’s device.
Declaration
Swift
func requestAuthorization(options: UNAuthorizationOptions, completion: @escaping (_ granted: Bool, _ error: Error?) -> Void)Parameters
optionsThe authorization options your app is requesting.
completionThe closure to execute asynchronously with the results. It has no return value and has a boolean and an error object as a parameters.
grantedA boolean indicating whether authorization was granted.
errorThe error object containing error information or nil if no error occurred.
-
Send the device token to a server API call.
This method is usually called inside the application’s
didRegisterForRemoteNotificationsWithDeviceTokenmethod to get the device token.Important
Never send the same device token to the server. It can be done by saving the device token somewhere (preferably the Keychain), then checking if the fetched device token is the same with the one that was saved.Declaration
Swift
func sendDeviceTokenToServerIfNeeded(_ deviceToken: Data)Parameters
deviceTokenThe token of the device as
Data. -
Calls
MessagesAPI.trackMessage(id: id, action: .opened)Declaration
Swift
func trackMessage(id: Int)Parameters
idMessage ID
-
Sets the Application’s badge count with the given number if allowed
Declaration
Swift
func setApplicationBadgeCount(_ count: Int)Parameters
countNumber to be displayed on Application’s Icon
-
Handles Notification Responses
Declaration
Swift
func handleNotificationResponse(_ response: UNNotificationResponse, completionHandler: @escaping () -> Void)Parameters
responseThe
UNNotificationResponsebased on the user’s interactioncompletionHandlerCompletion block that should always be called regardless if the modification succeeded or failed
View on GitHub
NotificationHelper Protocol Reference