This repository was archived by the owner on Feb 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class ViewController: UIViewController {
2020
2121 singlePscope. addPermission ( NotificationsPermission ( notificationCategories: nil ) ,
2222 message: " We use this to send you \r \n spam and love notes " )
23-
23+
2424 multiPscope. addPermission ( ContactsPermission ( ) ,
2525 message: " We use this to steal \r \n your friends " )
2626 multiPscope. addPermission ( NotificationsPermission ( notificationCategories: nil ) ,
Original file line number Diff line number Diff line change @@ -599,15 +599,17 @@ typealias resultsForConfigClosure = ([PermissionResult]) -> Void
599599
600600 defaults. setBool ( true , forKey: Constants . NSUserDefaultsKeys. requestedNotifications)
601601 defaults. synchronize ( )
602-
603- getResultsForConfig { results in
604- guard let notificationResult = results
605- . first ( { $0. type == . Notifications } ) else { return }
606-
607- if notificationResult. status == . Unknown {
608- self . showDeniedAlert ( notificationResult. type)
609- } else {
610- self . detectAndCallback ( )
602+
603+ dispatch_async ( dispatch_get_main_queue ( ) ) {
604+ self . getResultsForConfig { results in
605+ guard let notificationResult = results
606+ . first ( { $0. type == . Notifications } ) else { return }
607+
608+ if notificationResult. status == . Unknown {
609+ self . showDeniedAlert ( notificationResult. type)
610+ } else {
611+ self . detectAndCallback ( )
612+ }
611613 }
612614 }
613615 }
@@ -994,13 +996,13 @@ typealias resultsForConfigClosure = ([PermissionResult]) -> Void
994996 // call other methods that need to wait before show
995997 // no missing required perms? callback and do nothing
996998 self . requiredAuthorized ( { areAuthorized in
997-
998999 if areAuthorized {
9991000 self . getResultsForConfig ( { results in
1001+
10001002 self . onAuthChange ? ( finished: true , results: results)
10011003 } )
10021004 } else {
1003- self . showAlert ( )
1005+ self . showAlert ( )
10041006 }
10051007 } )
10061008 }
You can’t perform that action at this time.
0 commit comments