Last active
June 7, 2019 01:37
-
-
Save brunomunizaf/3d18e7c38b1933e24ae88affbb965d0d to your computer and use it in GitHub Desktop.
Rich push categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
UNUserNotificationCenter | |
.current() | |
.requestAuthorization(options: [.alert, .sound, .badge]) { _, _ in } | |
let openAction = UNNotificationAction(identifier: "open.action", | |
title: "Open door", | |
options: []) | |
let incomingCallCategory = UNNotificationCategory(identifier: "doorCategory", | |
actions: [openAction], | |
intentIdentifiers: [], | |
options: []) | |
UNUserNotificationCenter.current().setNotificationCategories([incomingCallCategory]) | |
UNUserNotificationCenter.current().delegate = self | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment