comparison mac/dw.m @ 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
comparison
equal deleted inserted replaced
2071:c2f13c5eefac 2072:b7514ecd6305
12084 DWObj = [[DWObject alloc] init]; 12084 DWObj = [[DWObject alloc] init];
12085 DWDefaultFont = nil; 12085 DWDefaultFont = nil;
12086 #ifdef BUILDING_FOR_MOJAVE 12086 #ifdef BUILDING_FOR_MOJAVE
12087 if (@available(macOS 10.14, *)) 12087 if (@available(macOS 10.14, *))
12088 { 12088 {
12089 [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:UNAuthorizationOptionAlert 12089 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
12090 completionHandler:^(BOOL granted, NSError * _Nullable error) { 12090 if(center)
12091 if (!granted) { 12091 {
12092 NSLog(@"Unable to get notification permission."); 12092 [center requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionSound
12093 } 12093 completionHandler:^(BOOL granted, NSError * _Nullable error) {
12094 }]; 12094 if (!granted) {
12095 NSLog(@"WARNING: Unable to get notification permission.");
12096 }
12097 }];
12098 }
12095 } 12099 }
12096 _DWDirtyDrawables = [[NSMutableArray alloc] init]; 12100 _DWDirtyDrawables = [[NSMutableArray alloc] init];
12097 #else 12101 #else
12098 /* Create mutexes for thread safety */ 12102 /* Create mutexes for thread safety */
12099 DWRunMutex = dw_mutex_new(); 12103 DWRunMutex = dw_mutex_new();