diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-02-22 15:27:24 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-02-22 15:27:24 -0500 |
commit | dc15b45f58c65b6d5d961062c5374997f6747689 (patch) | |
tree | 6c14a95ca7bb61e725c09b08ec0c77d4eb9d19f7 /SmartDeviceLink/SDLResponseDispatcher.m | |
parent | 463357d2c16ce9141646f8c315f41dc0b2c08155 (diff) | |
download | sdl_ios-dc15b45f58c65b6d5d961062c5374997f6747689.tar.gz |
Implement SDL 0027
* Fixes #537
* Update button & command handlers to be specific
Diffstat (limited to 'SmartDeviceLink/SDLResponseDispatcher.m')
-rw-r--r-- | SmartDeviceLink/SDLResponseDispatcher.m | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m index f6e07ea1e..3c2928912 100644 --- a/SmartDeviceLink/SDLResponseDispatcher.m +++ b/SmartDeviceLink/SDLResponseDispatcher.m @@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)sdl_runHandlerForCommand:(NSNotification *)notification { SDLOnCommand *onCommandNotification = notification.userInfo[SDLNotificationUserInfoObject]; - SDLRPCNotificationHandler handler = nil; + SDLRPCCommandNotificationHandler handler = nil; handler = self.commandHandlerMap[onCommandNotification.cmdID]; if (handler) { @@ -188,14 +188,14 @@ NS_ASSUME_NONNULL_BEGIN - (void)sdl_runHandlerForButton:(NSNotification *)notification { __kindof SDLRPCNotification *rpcNotification = notification.userInfo[SDLNotificationUserInfoObject]; - SDLRPCNotificationHandler handler = nil; + SDLRPCButtonNotificationHandler handler = nil; SDLButtonName name = nil; NSNumber *customID = nil; - if ([rpcNotification isKindOfClass:[SDLOnButtonEvent class]]) { + if ([rpcNotification isMemberOfClass:[SDLOnButtonEvent class]]) { name = ((SDLOnButtonEvent *)rpcNotification).buttonName; customID = ((SDLOnButtonEvent *)rpcNotification).customButtonID; - } else if ([rpcNotification isKindOfClass:[SDLOnButtonPress class]]) { + } else if ([rpcNotification isMemberOfClass:[SDLOnButtonPress class]]) { name = ((SDLOnButtonPress *)rpcNotification).buttonName; customID = ((SDLOnButtonPress *)rpcNotification).customButtonID; } @@ -207,7 +207,11 @@ NS_ASSUME_NONNULL_BEGIN } if (handler) { - handler(rpcNotification); + if ([rpcNotification isMemberOfClass:[SDLOnButtonEvent class]]) { + handler(nil, rpcNotification); + } else if ([rpcNotification isMemberOfClass:[SDLOnButtonPress class]]) { + handler(rpcNotification, nil); + } } } |