SDK Delegates

The SDK uses two delegates:

  1. MessagingDelegate – for lifecycle and connectivity events.
  2. MessagingNotificationDelegate – for handling push and in app notifications.

You should implement and set the delegate for the above in order to receive notification from the SDK.

ParameterDescriptionNotes
targetSizeThe ideal size of the image to be displayed. If the image returned is larger than the target size it will be scaled down to the target size.Default value is nil
notificationThe Messaging Notification carrying the appropriate notification payload.

MessagingDelegate

  • func MessagingObseleteVersion(_ error: NSError)

    The SDK version is no longer supported and needs to be updated or the iOS version of the device is not supported.

  • func MessagingError(_ error: NSError)

    An unexpected error has occurred and the SDK must be shut down.

  • func noConversationsImage(targetSize: CGSize) -> UIImage?

    Attempting to display the conversation list and no conversations are available to display. If no image is returned, a default image is used.

MessagingNotificationDelegate

All methods are optional.

Messaging.handleNotification is called and it is determined that the notification is a Messaging notification.

returns: 

  • func shouldShowMessagingNotification(notification: MessagingNotification) -> Bool

    Bool value indicating an in-app notification should be shown. Default value is true.

  • func messagingNotificationTapped(_ notification: MessagingNotification)

    The Messaging notification has been tapped.

  • func didReceiveMessagingNotification(_ Notification: MessagingNotification)

    The app called the Messaging.handleNotification method and appropriate information is found for Messaging in the notification. This method is optional.

  • @objc optional func messagingNotificationTapped(_ notification: MessagingNotification)

    The Messaging notification has been tapped. This is not functional when a custom UIView is used.

  • @objc optional func didReceiveMessagingPushNotification(_ Notification: MessagingNotification)

    The app called the Messaging.handlePushNotification method and appropriate information is found for Messaging in the notification.