diff --git a/Application/AppController.m b/Application/AppController.m
index 38517e662..74c722485 100644
--- a/Application/AppController.m
+++ b/Application/AppController.m
@@ -68,7 +68,7 @@
[p setResolvesAliases:YES];
[p beginSheetModalForWindow:mainWindow completionHandler:^(NSInteger result) {
- if ( result == NSModalResponseOK ) {
+ if ( result == NSFileHandlingPanelOKButton ) {
[self->playlistLoader willInsertURLs:[p URLs] origin:URLOriginInternal];
[self->playlistLoader didInsertURLs:[self->playlistLoader addURLs:[p URLs] sort:YES] origin:URLOriginInternal];
} else {
@@ -84,7 +84,7 @@
p = [NSSavePanel savePanel];
[p beginSheetModalForWindow:mainWindow completionHandler:^(NSInteger result) {
- if ( result == NSModalResponseOK ) {
+ if ( result == NSFileHandlingPanelOKButton ) {
[self->playlistLoader save:[[p URL] path]];
} else {
[p close];
@@ -103,7 +103,7 @@
- (void)openURLPanelDidEnd:(OpenURLPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
- if (returnCode == NSModalResponseOK)
+ if (returnCode == NSOKButton)
{
[playlistLoader willInsertURLs:[NSArray arrayWithObject:[panel url]] origin:URLOriginInternal];
[playlistLoader didInsertURLs:[playlistLoader addURLs:[NSArray arrayWithObject:[panel url]] sort:NO] origin:URLOriginInternal];
@@ -170,7 +170,6 @@
}
}
- [[miniWindow standardWindowButton:NSWindowZoomButton] setHidden:YES];
// Restore mini mode
[self setMiniMode:[[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]];
@@ -378,7 +377,7 @@
NSMutableDictionary *userDefaultsValuesDict = [NSMutableDictionary dictionary];
// Font defaults
- float fFontSize = [NSFont systemFontSizeForControlSize:NSControlSizeSmall];
+ float fFontSize = [NSFont systemFontSizeForControlSize:NSSmallControlSize];
NSNumber *fontSize = [NSNumber numberWithFloat:fFontSize];
[userDefaultsValuesDict setObject:fontSize forKey:@"fontSize"];
diff --git a/Application/PlaybackEventController.m b/Application/PlaybackEventController.m
index 64f02741e..e0c56a387 100644
--- a/Application/PlaybackEventController.m
+++ b/Application/PlaybackEventController.m
@@ -174,6 +174,37 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
content.sound = nil;
content.categoryIdentifier = @"play";
+ if ([defaults boolForKey:@"notifications.show-album-art"] && [pe albumArtInternal]) {
+ NSError *error = nil;
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSURL *tmpSubFolderURL = [[NSURL fileURLWithPath:NSTemporaryDirectory()]
+ URLByAppendingPathComponent:@"cog-artworks-cache" isDirectory:true];
+ if ([fileManager createDirectoryAtPath:[tmpSubFolderURL path]
+ withIntermediateDirectories:true
+ attributes:nil
+ error:&error]) {
+ NSString *tmpFileName = [[NSProcessInfo.processInfo globallyUniqueString] stringByAppendingString:@".jpg"];
+ NSURL *fileURL = [tmpSubFolderURL URLByAppendingPathComponent:tmpFileName];
+ NSImage *image = [pe albumArt];
+ CGImageRef cgRef = [image CGImageForProposedRect:NULL context:nil hints:nil];
+ NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];
+ NSData *jpgData = [newRep representationUsingType:NSBitmapImageFileTypeJPEG
+ properties:@{NSImageCompressionFactor: @0.5f}];
+ [jpgData writeToURL:fileURL atomically:YES];
+
+ UNNotificationAttachment *icon = [UNNotificationAttachment attachmentWithIdentifier:@"art"
+ URL:fileURL
+ options:nil
+ error:&error];
+ if (error) {
+ // We have size limit of 10MB per image attachment.
+ NSLog(@"%@", error.localizedDescription);
+ } else {
+ content.attachments = @[icon];
+ }
+ }
+ }
+
UNNotificationRequest * request = [UNNotificationRequest requestWithIdentifier:@"PlayTrack" content:content trigger:nil];
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib
index d5e41de95..0a13fd58b 100644
--- a/Base.lproj/MainMenu.xib
+++ b/Base.lproj/MainMenu.xib
@@ -582,21 +582,21 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
@@ -617,7 +617,7 @@
-
+
@@ -1739,19 +1739,19 @@ Gw
-
-
+
+
-
+
-
+
-
+
diff --git a/Preferences/General/Base.lproj/Preferences.xib b/Preferences/General/Base.lproj/Preferences.xib
index 2b9a6c667..59a8d00b3 100644
--- a/Preferences/General/Base.lproj/Preferences.xib
+++ b/Preferences/General/Base.lproj/Preferences.xib
@@ -11,6 +11,7 @@
+
@@ -400,12 +401,12 @@
-
+