RichPushService

open class RichPushService : UNNotificationServiceExtension

Undocumented

  • Completion block that should always be called regardless if the modification succeeded or failed

    Declaration

    Swift

    public var contentHandler: ((UNNotificationContent) -> Void)?
  • The raw version of the received UNMutableNotificationContent, this will be used if any modification fails

    Declaration

    Swift

    public var bestAttemptContent: UNMutableNotificationContent?
  • Undocumented

    Declaration

    Swift

    override open func didReceive(_ request: UNNotificationRequest,
                                  withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void)
  • Undocumented

    Declaration

    Swift

    override open func serviceExtensionTimeWillExpire()

Image

  • Adds an image as an attachment to the passed UNMutableNotificationContent if the notification’s payload includes an "image_url" and has valid value

    Declaration

    Swift

    open func addImageIfNecessary(content: UNMutableNotificationContent, userInfo: [String : Any])

    Parameters

    content

    UNMutableNotificationContent

    userInfo

    The whole push notification payload

Categories

  • Creates a UNNotificationCategory with its supported UNNotificationAction(s) depending on the notification’s payload.

    Declaration

    Swift

    open func createSupportedCategory(_ userInfo: [String : Any]) -> UNNotificationCategory?

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.postLike category and sets its supported actions

    Declaration

    Swift

    open func setupPostLikeCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.postLikeComment category and sets its supported actions

    Declaration

    Swift

    open func setupPostLikeCommentCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.challenge category and sets its supported actions

    Declaration

    Swift

    open func setupChallengeCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.offerLink category and sets its supported actions

    Declaration

    Swift

    open func setupOfferLinkCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.offerCoupon category and sets its supported actions

    Declaration

    Swift

    open func setupOfferCouponCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.offerCertificate category and sets its supported actions

    Declaration

    Swift

    open func setupOfferCertificateCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.offerClip category and sets its supported actions

    Declaration

    Swift

    open func setupOfferClipCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.eventFavorite category and sets its supported actions

    Declaration

    Swift

    open func setupEventFavoriteCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

  • Creates a RichPushCategory.contentPage category and sets its supported actions

    Declaration

    Swift

    open func setupContentPageCategory(_ userInfo: [String : Any]) -> UNNotificationCategory

    Parameters

    userInfo

    The whole push notification payload

Builders

  • Builder method that creates an instance of UNNotificationAction

    Declaration

    Swift

    open func createAction(_ action: RichPushAction,
                           title: String,
                           isText: Bool = false,
                           options: UNNotificationActionOptions = []) -> UNNotificationAction

    Parameters

    action
    title

    Text to be displayed on the action button

    isText

    Boolean flag if action is expecting a text input from the user

    options

    UNNotificationActionOptions

  • Builder method that creates an instance of UNNotificationCategory

    Declaration

    Swift

    open func createCategory(_ category: RichPushCategory,
                             actions: [UNNotificationAction],
                             options: UNNotificationCategoryOptions = []) -> UNNotificationCategory

    Parameters

    category
    actions

    List of supported UNNotificationAction of the category