NSMutableDictionary *registrationDictionary;
id lastNotification;
bool isInForeground;
+ bool hasNativeNotifications;
intf_thread_t *interfaceThread;
}
// 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;
registrationDictionary = nil;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
// Clear the remaining lastNotification in Notification Center, if any
@autoreleasepool {
- if (lastNotification) {
+ if (lastNotification && hasNativeNotifications) {
[NSUserNotificationCenter.defaultUserNotificationCenter
removeDeliveredNotification:(NSUserNotification *)lastNotification];
[lastNotification release];
[GrowlApplicationBridge setGrowlDelegate:self];
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
- [[NSUserNotificationCenter defaultUserNotificationCenter]
- setDelegate:(id<NSUserNotificationCenterDelegate>)self];
+ if (hasNativeNotifications) {
+ [[NSUserNotificationCenter defaultUserNotificationCenter]
+ setDelegate:(id<NSUserNotificationCenterDelegate>)self];
+ }
#endif
}
}
isSticky:NO
clickContext:nil
identifier:@"VLCNowPlayingNotification"];
- } else {
+ } else if (hasNativeNotifications) {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
// Make the OS X notification and string
NSUserNotification *notification = [NSUserNotification new];