From 2476f8827dce7ff321417b3f9322b7e3cb6e3e43 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 14 Nov 2019 19:16:43 -0800 Subject: [PATCH] Hopefully fix compatibility with systems older than 10.12.1 --- Application/MediaKeysApplication.m | 6 +++--- Application/PlaybackController.m | 14 +++++++------- Cog.xcodeproj/project.pbxproj | 6 ++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Application/MediaKeysApplication.m b/Application/MediaKeysApplication.m index c61cbb185..c02ebc463 100644 --- a/Application/MediaKeysApplication.m +++ b/Application/MediaKeysApplication.m @@ -37,9 +37,9 @@ options:NSKeyValueObservingOptionNew context:nil]; - MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter]; - - if (remoteCommandCenter) { + if (NSClassFromString(@"MPRemoteCommandCenter")) { + MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter]; + [remoteCommandCenter.playCommand setEnabled:YES]; [remoteCommandCenter.pauseCommand setEnabled:YES]; [remoteCommandCenter.togglePlayPauseCommand setEnabled:YES]; diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index 7a8f39802..04d08121e 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -622,9 +622,9 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) } - (void)sendMetaData { - MPNowPlayingInfoCenter * defaultCenter = [MPNowPlayingInfoCenter defaultCenter]; - - if (defaultCenter) { + if (NSClassFromString(@"MPNowPlayingInfoCenter")) { + MPNowPlayingInfoCenter * defaultCenter = [MPNowPlayingInfoCenter defaultCenter]; + PlaylistEntry * entry = [playlistController currentEntry]; NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init]; @@ -641,14 +641,14 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) } if (playbackStatus == kCogStatusPlaying) { - [MPNowPlayingInfoCenter defaultCenter].playbackState = MPNowPlayingPlaybackStatePlaying; + defaultCenter.playbackState = MPNowPlayingPlaybackStatePlaying; } else if (playbackStatus == kCogStatusPaused) { - [MPNowPlayingInfoCenter defaultCenter].playbackState = MPNowPlayingPlaybackStatePaused; + defaultCenter.playbackState = MPNowPlayingPlaybackStatePaused; } else { - [MPNowPlayingInfoCenter defaultCenter].playbackState = MPNowPlayingPlaybackStateStopped; + defaultCenter.playbackState = MPNowPlayingPlaybackStateStopped; } - [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo]; + [defaultCenter setNowPlayingInfo:songInfo]; } } diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index b645958b4..672383a9e 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -174,7 +174,6 @@ 838491881808593200E7332D /* NDHotKey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8384917E1808585D00E7332D /* NDHotKey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 8399D4E21805A55000B503B1 /* XmlContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8399D4E01805A55000B503B1 /* XmlContainer.m */; }; 83A360B220E4E81D00192DAB /* Flac.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8303A30C20E4E3D000951EF8 /* Flac.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 83AB903E237CEFD300A433D5 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83AB9031237CEFD300A433D5 /* MediaPlayer.framework */; }; 83B06704180D579E008E3612 /* MIDI.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B066A1180D5669008E3612 /* MIDI.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 83BC5AB220E4C87100631CD4 /* DualWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BC5AB020E4C87100631CD4 /* DualWindow.m */; }; 83BC5ABF20E4CE7A00631CD4 /* InfoInspector.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17D1B0D00F6320EA00694C57 /* InfoInspector.xib */; }; @@ -1071,7 +1070,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 83AB903E237CEFD300A433D5 /* MediaPlayer.framework in Frameworks */, 83E6B7651816178200D4576D /* Sparkle.framework in Frameworks */, 838491871808591F00E7332D /* NDHotKey.framework in Frameworks */, 8355D6B8180613FB00D05687 /* Security.framework in Frameworks */, @@ -2863,6 +2861,8 @@ OTHER_LDFLAGS = ( "-weak_framework", CogAudio, + "-weak_framework", + MediaPlayer, "-undefined", dynamic_lookup, ); @@ -2900,6 +2900,8 @@ OTHER_LDFLAGS = ( "-weak_framework", CogAudio, + "-weak_framework", + MediaPlayer, "-undefined", dynamic_lookup, );