Class
PushNotifications
@objc(ZDKPushNotifications)
public final class PushNotifications: NSObject
The entry point to execute push notification related SDK actions.
Register device token with PushNotifications.updatePushNotificationToken(:)
.
Relationships
Conforms To
NSObject
Methods
updatePushNotificationToken(_:)
@objc public static func updatePushNotificationToken(_ token: Data)
Update a push token to receive push notifications.
Parameters
Name | Type | Description |
---|---|---|
token | Data |
The token to be sent to the server. |
shouldBeDisplayed(_:)
@objc public static func shouldBeDisplayed(_ userInfo: [AnyHashable: Any]) -> PushResponsibility
Check if a push notification payload belongs to Messaging
and can be displayed.
Parameters
Name | Type | Description |
---|---|---|
userInfo | [AnyHashable: Any] |
The push notification payload. |
Returns
PushResponsbility
enum indiciating if the push notification should be displayed.
handleTap(_:completion:)
@objc public static func handleTap(_ userInfo: [AnyHashable: Any], completion: ((UIViewController?) -> Void)?)
Handles the tap of a push notification if the payload belongs to Messaging
.
-
The completion is called on the main thread.
-
If
Messaging
is not initialized the completion will return nil. -
If
Messaging
is in the process of being initialized this method will wait, and then aUIViewController
will be returned. -
If
Messaging
has been initialized aUIViewController
will be returned.
Parameters
Name | Type | Description |
---|---|---|
userInfo | [AnyHashable: Any] |
The push notification payload. |
completion | ((UIViewController?) -> Void)? |
An optional |