From 864c56a408997004155edbf07577181a62c05339 Mon Sep 17 00:00:00 2001 From: Dzmitry Neviadomski Date: Sun, 7 Feb 2021 00:33:47 +0300 Subject: [PATCH] Store AppController in MediaKeysApplication --- Application/MediaKeysApplication.m | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Application/MediaKeysApplication.m b/Application/MediaKeysApplication.m index bc3f425a2..627f05263 100644 --- a/Application/MediaKeysApplication.m +++ b/Application/MediaKeysApplication.m @@ -16,10 +16,13 @@ #import #import -@implementation MediaKeysApplication +@implementation MediaKeysApplication { + AppController *_appController; +} - (void)finishLaunching { [super finishLaunching]; + _appController = (AppController *)[self delegate]; MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter]; @@ -41,32 +44,32 @@ } - (MPRemoteCommandHandlerStatus)clickPlay { - [(AppController *)[self delegate] clickPlay]; + [_appController clickPlay]; return MPRemoteCommandHandlerStatusSuccess; } - (MPRemoteCommandHandlerStatus)clickPause { - [(AppController *)[self delegate] clickPause]; + [_appController clickPause]; return MPRemoteCommandHandlerStatusSuccess; } - (MPRemoteCommandHandlerStatus)clickStop { - [(AppController *)[self delegate] clickStop]; + [_appController clickStop]; return MPRemoteCommandHandlerStatusSuccess; } - (MPRemoteCommandHandlerStatus)clickNext { - [(AppController *)[self delegate] clickNext]; + [_appController clickNext]; return MPRemoteCommandHandlerStatusSuccess; } - (MPRemoteCommandHandlerStatus)clickPrev { - [(AppController *)[self delegate] clickPrev]; + [_appController clickPrev]; return MPRemoteCommandHandlerStatusSuccess; } - (MPRemoteCommandHandlerStatus)clickSeek: (MPChangePlaybackPositionCommandEvent*)event { - [(AppController *)[self delegate] clickSeek:event.positionTime]; + [_appController clickSeek:event.positionTime]; return MPRemoteCommandHandlerStatusSuccess; }