PushNotificationsProvider

@objc(ZDKPushNotificationsProvider)
public final class PushNotificationsProvider : NSObject, HasStorage, Loggable, Publisher

The ZDKPushNoticiationProvider provides APIs to subscribe to, and handle Zendesk Chat’s Push Notifications.

There are two types of chat notifications:

  • chat.msg - received when a new chat message was sent from an agent
  • chat.end - received when the current chat session ends.
  • The NSNotification.Name associated with the message received push notificiation

    Declaration

    Swift

    @objc
    public static let ChatMessageReceivedNotification: NSNotification.Name

Handling remote push notification

  • Received push notification is processed by Chat SDK.

    There are two types of chat notifications:

    • chat.msg - received when a new chat message was sent from an agent
    • chat.end - received when the current chat session ends.

    Declaration

    Swift

    @objc
    public func didReceiveRemoteNotification(_ userInfo: [AnyHashable : Any], in application: UIApplication)

    Parameters

    userInfo

    A dictionary that contains information related to the remote notification

    application

    The centralized point of control and coordination for apps running in iOS.

  • Returns true if received push notification belongs to Chat SDK

    Declaration

    Swift

    @objc
    public func isChatPushNotification(_ userInfo: [AnyHashable : Any]) -> Bool

    Parameters

    userInfo

    A dictionary that contains information related to the remote notification

Register push notifications

  • Registers device token with Zendesk Chat

    Declaration

    Swift

    @objc
    public func registerPushToken(_ pushTokenData: Data)

    Parameters

    pushTokenData

    device token received in didRegisterForRemoteNotificationsWithDeviceToken after registration.

  • Registers device token with Zendesk Chat

    Declaration

    Swift

    @objc
    public func registerPushTokenString(_ pushTokenString: String)

    Parameters

    pushTokenString

    device token received in didRegisterForRemoteNotificationsWithDeviceToken after registration.

Unregister push notifications

  • Unregisters for Push notifications

    Declaration

    Swift

    @objc
    public func unregisterPushToken()