Carousel Push

Carousel Push is a notification type which has a different UI than Rich Notification. SDK will handle notification payload and displays UI if it's a carousel push.

Requirements

  • iOS 10 or higher
  • Notification Service Extension
  • Notification Content Extension

Setup

1. Install with CocoaPods

target 'DengageNotificationContentExtension' do
  use_frameworks!
  pod 'Dengage', :git => 'https://github.com/dengage-tech/dengage-ios-sdk.git', :branch => 'version/5.7.1'

end

1.1 Create Notification Content Extension

In Xcode create a Notification Content Extension for your applicaiton by selecting menu File > New > Target > Notification Content Extension

Don't select Activate on the dialogue that is shown after tapping Finish.

1.2 Configure Info.plist

  • Add UNNotificationExtensionDefaultContentHidden as Boolean type with value YES
  • Add NSExtensionPrincipalClass value as String type with value DengageContentExtension.DengageNotificationViewController
  • Change UNNotificationExtensionCategory value as DENGAGE_CAROUSEL_CATEGORY
  • Change UNNotificationExtensionInitialContentSizeRatio value as 1
  • Change UNNotificationExtensionUserInteractionEnabled value as Boolean type with value YES

You can also review the sample plist file. You can paste it into your project.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSExtension</key>
	<dict>
		<key>NSExtensionAttributes</key>
		<dict>
			<key>UNNotificationExtensionCategory</key>
			<string>DENGAGE_CAROUSEL_CATEGORY</string>
			<key>UNNotificationExtensionDefaultContentHidden</key>
			<true/>
			<key>UNNotificationExtensionInitialContentSizeRatio</key>
			<real>1</real>
			<key>UNNotificationExtensionUserInteractionEnabled</key>
			<true/>
		</dict>
		<key>NSExtensionPointIdentifier</key>
		<string>com.apple.usernotifications.content-extension</string>
		<key>NSExtensionPrincipalClass</key>
		<string>DengageContentExtension.DengageNotificationViewController</string>
	</dict>
</dict>
</plist>

Open NotificationViewController.swift and replace the whole file contents with the below code.

import UIKit
import UserNotifications
import UserNotificationsUI
import Dengage

@objc(NotificationViewController)

class NotificationViewController: UIViewController, UNNotificationContentExtension {

    let carouselView = DengageNotificationCarouselView.create()
    
    func didReceive(_ notification: UNNotification) {
        carouselView.didReceive(notification)
    }
    
    func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
        carouselView.didReceive(response, completionHandler: completion)
    }
    
    override func loadView() {
        self.view = carouselView
    }
}

2. Manual Import to XCode Project.

  • Download from github. Release 1.0.10

  • Add to your project manually.

  • Follow the steps on above