NotificationController
@objc
public final class NotificationController : NSObject
An object that allows to configure push notifications.
-
Register the push token of your visitor device so it will receive push notifications for new messages received during the conversation.
Push notifications are enabled by default for the user as long as you have registered a push token. If you want to disable all push notifications from the iAdvize SDK you have to call
IAdvizeSDK.notificationController.disablePushNotifications()
.You can use preprocessor flags to manage both application mode while integrating the SDK:
#if DEBUG IAdvizeSDK.shared.notificationController.registerPushToken(pushToken, applicationMode: .dev) #else IAdvizeSDK.shared.notificationController.registerPushToken(pushToken, applicationMode: .prod) #endif
Declaration
Swift
public func registerPushToken(_ pushToken: String, applicationMode: ApplicationMode)
Parameters
pushToken
The push token of the device which will be associated to the current visitor identifier.
applicationMode
The current running mode of the application. Used to properly send push notifications on the right APNS server (sandbox/production).
-
Enable push notifications for the current visitor on this device.
You only need to call this method if you previously disabled push notification using
IAdvizeSDK.shared.notificationController.disablePushNotifications()
.The user will again be able to receive push notifications for new incoming messages.
Declaration
Swift
@objc public func enablePushNotifications(completion: ((Bool) -> Void)? = nil)
-
Disable push notifications for the current visitor on this device.
The user will not be able to receive push notifications from new incoming messages anymore.
Declaration
Swift
@objc public func disablePushNotifications(completion: ((Bool) -> Void)? = nil)
-
Indicates if a received push notification is related to the iAdvize SDK.
Declaration
Swift
@objc public func isIAdvizePushNotification(with userInfo: [AnyHashable : Any]) -> Bool
Parameters
userInfo
dictionary which are provided when the app receives a push notification.
Return Value
true
if it’s a notification coming from the iAdvize Conversation SDK,false
otherwise. -
Clears the iAdvize SDK push notifications from the Notification Center.
Declaration
Swift
@objc public func clearIAdvizePushNotifications()