diff --git a/radiant-player-mac/AppDelegate.m b/radiant-player-mac/AppDelegate.m index 5b8cec76..af127fb6 100644 --- a/radiant-player-mac/AppDelegate.m +++ b/radiant-player-mac/AppDelegate.m @@ -849,6 +849,11 @@ - (void)notifySong:(NSString *)title withArtist:(NSString *)artist album:(NSStri { [[NotificationCenter center] scheduleNotificationWithTitle:title artist:artist album:album imageURL:art]; } + + if (![defaults boolForKey:@"disableDistributednotifications"]) + { + [[NotificationCenter center] postDistributedNotificationWithTitle:title artist:artist album:album imageURL:art]; + } if ([defaults boolForKey:@"dock.show-art"]) { diff --git a/radiant-player-mac/Notifications/NotificationCenter.h b/radiant-player-mac/Notifications/NotificationCenter.h index 3a1950cc..6fb5deed 100644 --- a/radiant-player-mac/Notifications/NotificationCenter.h +++ b/radiant-player-mac/Notifications/NotificationCenter.h @@ -32,5 +32,5 @@ typedef NS_ENUM(NSInteger, NotificationActivationType) { + (NotificationCenter *) center; - (void) scheduleNotificationWithTitle:(NSString *)title artist:(NSString *)artist album:(NSString *)album imageURL:(NSString *)imageURL; - +- (void) postDistributedNotificationWithTitle:(NSString *)title artist:(NSString *)artist album:(NSString *)album imageURL:(NSString *)imageURL; @end diff --git a/radiant-player-mac/Notifications/NotificationCenter.m b/radiant-player-mac/Notifications/NotificationCenter.m index 5da6e52b..6d10a70f 100644 --- a/radiant-player-mac/Notifications/NotificationCenter.m +++ b/radiant-player-mac/Notifications/NotificationCenter.m @@ -99,6 +99,14 @@ - (void)_scheduleNSUserNotificationWithTitle:(NSString *)title artist:(NSString [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notif]; } +- (void) postDistributedNotificationWithTitle:(NSString *)title artist:(NSString *)artist album:(NSString *)album imageURL:(NSString *)imageURL +{ + NSDistributedNotificationCenter *center = [NSDistributedNotificationCenter defaultCenter]; + NSDictionary *userInfo = @{@"title" : title, @"artist" : artist, @"album" : album, @"albumArtURL" : imageURL}; + + [center postNotificationName:@"com.sajidanwar.Radiant-Player.PlaybackStateChange" object:nil userInfo:userInfo options:NSDistributedNotificationDeliverImmediately]; +} + - (void)_scheduleGrowlNotificationWithTitle:(NSString *)title artist:(NSString *)artist album:(NSString *)album image:(NSImage *)image { NSData *imageData = [NSData data];