changeset 2072:b7514ecd6305

Mac: Minor changes to get notification permission.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 15 May 2020 04:54:57 +0000
parents c2f13c5eefac
children cf70a52f702e
files mac/dw.m
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Fri May 15 02:13:57 2020 +0000
+++ b/mac/dw.m	Fri May 15 04:54:57 2020 +0000
@@ -12086,12 +12086,16 @@
 #ifdef BUILDING_FOR_MOJAVE
     if (@available(macOS 10.14, *))
     {
-        [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:UNAuthorizationOptionAlert
-                completionHandler:^(BOOL granted, NSError * _Nullable error) {
-            if (!granted) {
-                NSLog(@"Unable to get notification permission.");
-            }
-        }];
+        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
+        if(center)
+        {
+            [center requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionSound
+                    completionHandler:^(BOOL granted, NSError * _Nullable error) {
+                        if (!granted) {
+                            NSLog(@"WARNING: Unable to get notification permission.");
+                        }
+            }];
+        }
     }
     _DWDirtyDrawables = [[NSMutableArray alloc] init];
 #else