Merge pull request #2191 from AlphaWallet/#2190

Fix crash #2190
pull/2186/head
James Sangalli 4 years ago committed by GitHub
commit 58917503ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      AlphaWallet/PushNotificationsCoordinator.swift

@ -45,7 +45,9 @@ class PushNotificationsCoordinator: NSObject, Coordinator {
private func authorizationNotDetermined(handler: @escaping () -> Void) {
notificationCenter.getNotificationSettings { settings in
if case .notDetermined = settings.authorizationStatus {
handler()
DispatchQueue.main.async {
handler()
}
}
}
}
@ -54,9 +56,9 @@ class PushNotificationsCoordinator: NSObject, Coordinator {
private func requestForAuthorization() {
notificationCenter.requestAuthorization(options: [.badge, .alert, .sound]) { granted, error in
if granted {
DispatchQueue.main.async(execute: {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
})
}
} else {
//Do stuff if unsuccessful
}

Loading…
Cancel
Save