[vlc-commits] osx_notifications: Do not check if NSUserNotification is available

Marvin Scholz git at videolan.org
Wed Feb 14 22:18:38 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Feb 14 22:14:49 2018 +0100| [359bf62fa8cc4546ed5851f44fd3245f12b10a5a] | committer: Marvin Scholz

osx_notifications: Do not check if NSUserNotification is available

Targeting 10.10, it will always be available, so this check is not
useful anymore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=359bf62fa8cc4546ed5851f44fd3245f12b10a5a
---

 modules/notify/osx_notifications.m | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/notify/osx_notifications.m b/modules/notify/osx_notifications.m
index 8413b2391c..b987d38a5c 100644
--- a/modules/notify/osx_notifications.m
+++ b/modules/notify/osx_notifications.m
@@ -87,7 +87,6 @@
     NSMutableDictionary *registrationDictionary;
     id lastNotification;
     bool isInForeground;
-    bool hasNativeNotifications;
     intf_thread_t *interfaceThread;
 }
 
@@ -256,11 +255,6 @@ static int InputCurrent( vlc_object_t *p_this, const char *psz_var,
     // Start in background
     isInForeground = NO;
 
-    // Check for native notification support
-    Class userNotificationClass = NSClassFromString(@"NSUserNotification");
-    Class userNotificationCenterClass = NSClassFromString(@"NSUserNotificationCenter");
-    hasNativeNotifications = (userNotificationClass && userNotificationCenterClass) ? YES : NO;
-
     lastNotification = nil;
     applicationName = nil;
     notificationType = nil;
@@ -274,7 +268,7 @@ static int InputCurrent( vlc_object_t *p_this, const char *psz_var,
 {
     // Clear the remaining lastNotification in Notification Center, if any
     @autoreleasepool {
-        if (lastNotification && hasNativeNotifications) {
+        if (lastNotification) {
             [NSUserNotificationCenter.defaultUserNotificationCenter
              removeDeliveredNotification:(NSUserNotification *)lastNotification];
             [lastNotification release];
@@ -304,10 +298,8 @@ static int InputCurrent( vlc_object_t *p_this, const char *psz_var,
 
         [GrowlApplicationBridge setGrowlDelegate:self];
 
-        if (hasNativeNotifications) {
-            [[NSUserNotificationCenter defaultUserNotificationCenter]
-             setDelegate:(id<NSUserNotificationCenterDelegate>)self];
-        }
+        [[NSUserNotificationCenter defaultUserNotificationCenter]
+            setDelegate:(id<NSUserNotificationCenterDelegate>)self];
     }
 }
 
@@ -370,7 +362,7 @@ static int InputCurrent( vlc_object_t *p_this, const char *psz_var,
                                            isSticky:NO
                                        clickContext:nil
                                          identifier:@"VLCNowPlayingNotification"];
-        } else if (hasNativeNotifications) {
+        } else {
             // Make the OS X notification and string
             NSUserNotification *notification = [NSUserNotification new];
             NSString *desc = nil;



More information about the vlc-commits mailing list