changeset 2150:be4547734f0b

Mac: Remove the old notification center when building for Big Sur 11.0. This means apps built for Big Sur will not generate notifications when run on macOS prior to Mojave (10.14). If you need this support build for Mojave or Catalina (10.15).
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 10 Sep 2020 23:58:33 +0000
parents c08e03168a9e
children 467401a1ca69
files mac/dw.m
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Thu Sep 10 20:18:43 2020 +0000
+++ b/mac/dw.m	Thu Sep 10 23:58:33 2020 +0000
@@ -1362,7 +1362,7 @@
 {
 }
 -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
-#ifdef BUILDING_FOR_MOUNTAIN_LION
+#if defined(BUILDING_FOR_MOUNTAIN_LION) && !defined(BUILDING_FOR_BIG_SUR)
 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification;
 -(BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification;
 -(void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification;
@@ -1453,7 +1453,7 @@
         return NSTerminateCancel;
     return NSTerminateNow;
 }
-#ifdef BUILDING_FOR_MOUNTAIN_LION
+#if defined(BUILDING_FOR_MOUNTAIN_LION) && !defined(BUILDING_FOR_BIG_SUR)
 -(void)applicationDidFinishLaunching:(NSNotification *)aNotification
 {
 #ifdef BUILDING_FOR_MOJAVE
@@ -10879,6 +10879,7 @@
     else
 #endif
     {
+#ifndef BUILDING_FOR_BIG_SUR
         // Fallback on earlier versions
         NSUserNotification *notification = [[NSUserNotification alloc] init];
 
@@ -10890,6 +10891,7 @@
                 notification.contentImage = [[NSImage alloc] initWithContentsOfFile:[NSString stringWithUTF8String:imagepath]];
             retval = notification;
         }
+#endif
     }
     return retval;
 #else
@@ -10927,10 +10929,12 @@
         else
 #endif
         {
+#ifndef BUILDING_FOR_BIG_SUR
             // Fallback on earlier versions
             NSUserNotification *request = (NSUserNotification *)notification;
             request.identifier = notid;
             [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:request];
+#endif
         }
         return DW_ERROR_NONE;
     }