Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageswift
import UIKit
import UserNotifications
import UserNotificationsUI
import Euromsg

@available(iOS 10.0, *)
@objc(EMNotificationViewController)
class EMNotificationViewController: UIViewController, UNNotificationContentExtension {

    let appUrl = URL(string: "euromsgExample://")
//Change 'euromsgExample://' with your deeplink url     let carouselView = EMNotificationCarousel.initView()
    var completion: ((_ url: URL?, _ userInfo: [AnyHashable: Any]?) -> Void)?    
    func didReceive(_ notification: UNNotification) {
        carouselView.didReceive(notification)
    }
    func didReceive(_ response: UNNotificationResponse,
                    completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
        carouselView.didReceive(response, completionHandler: completion)
    }
    override func loadView() {
        completion = { [weak self] url, userInfo in
            if let url = url {
                self?.extensionContext?.open(url)
                if url.scheme != self?.appUrl?.scheme, let userInfo = userInfo {
                    Euromsg.handlePush(pushDictionary: userInfo)
                }
            }
            else if let url = self?.appUrl {
                self?.extensionContext?.open(url)
            }
        }
        carouselView.completion = completion
        self.view = carouselView
    }
}

The podfile file should be as follows. Then go to the project path through the terminal, type pod install and press enter.

...