summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-04-27 14:42:18 -0400
committerJoel Fischer <joeljfischer@gmail.com>2018-04-27 14:42:18 -0400
commit567cf3f57a10bcdc3e6f465510948c7e46fceb89 (patch)
tree1b1f10f979ac9efeed25d28c4342f3e22b6f7424
parent9cf266fefdbd32c851162c903fa23eeb4d0b547b (diff)
downloadsdl_ios-567cf3f57a10bcdc3e6f465510948c7e46fceb89.tar.gz
Fix trigger source not passed with menu cell
-rw-r--r--SmartDeviceLink/SDLMenuCell.h4
-rw-r--r--SmartDeviceLink/SDLMenuManager.m2
-rw-r--r--SmartDeviceLink_Example/Classes/ProxyManager.m8
3 files changed, 8 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLMenuCell.h b/SmartDeviceLink/SDLMenuCell.h
index fd78e1ad1..80edc70b1 100644
--- a/SmartDeviceLink/SDLMenuCell.h
+++ b/SmartDeviceLink/SDLMenuCell.h
@@ -8,11 +8,13 @@
#import <Foundation/Foundation.h>
+#import "SDLTriggerSource.h"
+
@class SDLArtwork;
NS_ASSUME_NONNULL_BEGIN
-typedef void(^SDLMenuCellSelectionHandler)(void);
+typedef void(^SDLMenuCellSelectionHandler)(SDLTriggerSource triggerSource);
@interface SDLMenuCell : NSObject
diff --git a/SmartDeviceLink/SDLMenuManager.m b/SmartDeviceLink/SDLMenuManager.m
index 4465de47f..bf71066ad 100644
--- a/SmartDeviceLink/SDLMenuManager.m
+++ b/SmartDeviceLink/SDLMenuManager.m
@@ -367,7 +367,7 @@ UInt32 const MenuCellIdMin = 1;
for (SDLMenuCell *cell in self.menuCells) {
if (onCommand.cmdID.unsignedIntegerValue != cell.cellId) { continue; }
- cell.handler();
+ cell.handler(onCommand.triggerSource);
break;
}
}
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m
index 08714ecac..adf083eef 100644
--- a/SmartDeviceLink_Example/Classes/ProxyManager.m
+++ b/SmartDeviceLink_Example/Classes/ProxyManager.m
@@ -362,21 +362,21 @@ NS_ASSUME_NONNULL_BEGIN
[self.sdlManager sendRequest:choiceSet];
__weak typeof(self) weakself = self;
- SDLMenuCell *speakCell = [[SDLMenuCell alloc] initWithTitle:@"Speak" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"speak"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Speak"] handler:^{
+ SDLMenuCell *speakCell = [[SDLMenuCell alloc] initWithTitle:@"Speak" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"speak"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Speak"] handler:^(SDLTriggerSource _Nonnull triggerSource) {
[weakself.sdlManager sendRequest:[ProxyManager sdlex_appNameSpeak]];
}];
- SDLMenuCell *interactionSetCell = [[SDLMenuCell alloc] initWithTitle:@"Perform Interaction" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"choice_set"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Perform Interaction"] handler:^{
+ SDLMenuCell *interactionSetCell = [[SDLMenuCell alloc] initWithTitle:@"Perform Interaction" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"choice_set"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Perform Interaction"] handler:^(SDLTriggerSource _Nonnull triggerSource) {
[ProxyManager sdlex_sendPerformOnlyChoiceInteractionWithManager:weakself.sdlManager];
}];
- SDLMenuCell *getVehicleDataCell = [[SDLMenuCell alloc] initWithTitle:@"Get Vehicle Data" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"car"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Get Vehicle Data"] handler:^{
+ SDLMenuCell *getVehicleDataCell = [[SDLMenuCell alloc] initWithTitle:@"Get Vehicle Data" icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"car"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[@"Get Vehicle Data"] handler:^(SDLTriggerSource _Nonnull triggerSource) {
[ProxyManager sdlex_sendGetVehicleDataWithManager:weakself.sdlManager];
}];
NSMutableArray *menuArray = [NSMutableArray array];
for (int i = 0; i < 75; i++) {
- SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:[NSString stringWithFormat:@"%i", i] icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"hexagon_on_softbutton_icon"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:nil handler:^{}];
+ SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:[NSString stringWithFormat:@"%i", i] icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:@"hexagon_on_softbutton_icon"] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource){}];
[menuArray addObject:cell];
}