Skip to content

Commit 7f7e6c5

Browse files
author
Twilio CMS User
committed
CMS update of ip-messaging/pushiOS/usernotificationsettings by jlinwood@twilio.com
1 parent e5f6fcf commit 7f7e6c5

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
2-
if notificationSettings.types == .None {
3-
NSLog("Failed to get token, error: Notifications are not allowed")
4-
if let chatClient = chatClient where chatClient.userInfo != nil {
5-
chatClient.registerWithToken(nil)
6-
} else {
7-
updatedPushToken = nil
8-
}
1+
let center = UNUserNotificationCenter.current()
2+
center.getNotificationSettings { (settings) in
3+
if settings.authorizationStatus == .authorized {
4+
DispatchQueue.main.async {
5+
UIApplication.shared.registerForRemoteNotifications()
96
}
10-
else {
11-
UIApplication.sharedApplication().registerForRemoteNotifications()
12-
}
13-
}
7+
}
8+
}

0 commit comments

Comments
 (0)