From 0eafa485ca53512033a1a450c8d047f8c516b792 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Thu, 30 Mar 2017 15:38:57 -0400 Subject: Fix review issues --- SmartDeviceLink/SDLPerformAudioPassThru.h | 2 +- SmartDeviceLink/SDLPerformAudioPassThru.m | 2 +- SmartDeviceLink/SDLResponseDispatcher.h | 3 +-- SmartDeviceLink/SDLResponseDispatcher.m | 12 +++++++++--- SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m | 1 - 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.h b/SmartDeviceLink/SDLPerformAudioPassThru.h index 985e4ac3d..9f550fe6a 100644 --- a/SmartDeviceLink/SDLPerformAudioPassThru.h +++ b/SmartDeviceLink/SDLPerformAudioPassThru.h @@ -106,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN /** * A handler that will be called whenever an `onAudioPassThru` notification is received. */ -@property (copy, nonatomic, nullable) SDLAudioPassThruHandler audioDataHandler; +@property (strong, nonatomic, nullable) SDLAudioPassThruHandler audioDataHandler; @end diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.m b/SmartDeviceLink/SDLPerformAudioPassThru.m index 0af59e83d..f2bbbdf10 100644 --- a/SmartDeviceLink/SDLPerformAudioPassThru.m +++ b/SmartDeviceLink/SDLPerformAudioPassThru.m @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN self.bitsPerSample = bitsPerSample; self.audioType = audioType; self.maxDuration = @(maxDuration); - self.audioDataHandler = [audioDataHandler copy]; + self.audioDataHandler = audioDataHandler; return self; } diff --git a/SmartDeviceLink/SDLResponseDispatcher.h b/SmartDeviceLink/SDLResponseDispatcher.h index 3e746a75e..dae3e64a2 100644 --- a/SmartDeviceLink/SDLResponseDispatcher.h +++ b/SmartDeviceLink/SDLResponseDispatcher.h @@ -53,8 +53,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Holds an audio pass thru block. */ -@property (copy, nonatomic, readonly, nullable) SDLAudioPassThruHandler audioPassThruHandler; - +@property (strong, nonatomic, readonly, nullable) SDLAudioPassThruHandler audioPassThruHandler; /** * Create a new response dispatcher. diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m index c54d601ef..f8b4cc800 100644 --- a/SmartDeviceLink/SDLResponseDispatcher.m +++ b/SmartDeviceLink/SDLResponseDispatcher.m @@ -35,6 +35,13 @@ NS_ASSUME_NONNULL_BEGIN +@interface SDLResponseDispatcher () + +@property (strong, nonatomic, readwrite, nullable) SDLAudioPassThruHandler audioPassThruHandler; + +@end + + @implementation SDLResponseDispatcher - (instancetype)init { @@ -108,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN [self sdl_addToCustomButtonHandlerMap:show.softButtons]; } else if ([request isKindOfClass:[SDLPerformAudioPassThru class]]) { SDLPerformAudioPassThru *performAudioPassThru = (SDLPerformAudioPassThru *)request; - _audioPassThruHandler = [performAudioPassThru.audioDataHandler copy]; + self.audioPassThruHandler = performAudioPassThru.audioDataHandler; } // Always store the request, it's needed in some cases whether or not there was a handler (e.g. DeleteCommand). @@ -170,8 +177,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - // If it's a DeleteCommand or UnsubscribeButton, we need to remove handlers for the corresponding commands / buttons - // If it's a PerformAudioPassThru, we can also remove it. + // If it's a DeleteCommand, UnsubscribeButton, or PerformAudioPassThru we need to remove handlers for the corresponding RPCs if ([response isKindOfClass:[SDLDeleteCommandResponse class]]) { SDLDeleteCommand *deleteCommandRequest = (SDLDeleteCommand *)request; NSNumber *deleteCommandId = deleteCommandRequest.cmdID; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m index 49d4eb161..f7f04f2ce 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m @@ -711,7 +711,6 @@ describe(@"a response dispatcher", ^{ }); it(@"should store the handler" ,^{ - expect(testDispatcher.audioPassThruHandler).toNot(beNil()); expect(testDispatcher.audioPassThruHandler).to(equal(testPerformAudioPassThru.audioDataHandler)); }); -- cgit v1.2.1