summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjustingluck93 <47197545+justingluck93@users.noreply.github.com>2019-08-01 14:30:02 -0400
committerGitHub <noreply@github.com>2019-08-01 14:30:02 -0400
commit0e59f1637bef5cf68651c0605d12e2b276e19e33 (patch)
treecaf2838c75e48b80282fc10a75cf844f98cba85a
parent4b6a8554ecc9bae94664ac23cf1986614c79a7b8 (diff)
downloadsdl_ios-feature/issue-806-OpenMenuRPC.tar.gz
Apply suggestions from code review feature/issue-806-OpenMenuRPC
PR fixes Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
-rw-r--r--SmartDeviceLink/SDLMenuManager.m13
-rw-r--r--SmartDeviceLink/SDLScreenManager.h6
-rw-r--r--SmartDeviceLink/SDLScreenManager.m2
-rw-r--r--SmartDeviceLink/SDLShowAppMenu.h10
4 files changed, 16 insertions, 15 deletions
diff --git a/SmartDeviceLink/SDLMenuManager.m b/SmartDeviceLink/SDLMenuManager.m
index 722906fc4..792111b9b 100644
--- a/SmartDeviceLink/SDLMenuManager.m
+++ b/SmartDeviceLink/SDLMenuManager.m
@@ -643,6 +643,7 @@ UInt32 const MenuCellIdMin = 1;
- (BOOL)openMenu {
if([SDLGlobals.sharedGlobals.rpcVersion isLessThanVersion:[[SDLVersion alloc] initWithMajor:6 minor:0 patch:0]]) {
+ SDLLogE(@"The openMenu method is not supported on this head unit.");
return NO;
}
@@ -658,14 +659,14 @@ UInt32 const MenuCellIdMin = 1;
}
- (BOOL)openSubmenu:(SDLMenuCell *)cell {
- if(cell.subCells == 0) {
- SDLLogW(@"The cell does not contain any sub cells, so no submenu can be opened");
+ if (cell.subCells.count == 0) {
+ SDLLogE(@"The cell %@ does not contain any sub cells, so no submenu can be opened", cell);
return NO;
- }else if([SDLGlobals.sharedGlobals.rpcVersion isLessThanVersion:[[SDLVersion alloc] initWithMajor:6 minor:0 patch:0]]) {
- SDLLogW(@"The RPC Version does not support Open Menu. Please make sure you have the most up to date version");
+ } else if([SDLGlobals.sharedGlobals.rpcVersion isLessThanVersion:[[SDLVersion alloc] initWithMajor:6 minor:0 patch:0]]) {
+ SDLLogE(@"The openSubmenu method is not supported on this head unit.");
return NO;
- }else if(![self.menuCells containsObject:cell]) {
- SDLLogW(@"This cell has not been sent to the head unit, so no submenu can be opened. Make sure that the cell exists in the SDLManager.menu array");
+ } else if(![self.menuCells containsObject:cell]) {
+ SDLLogE(@"This cell has not been sent to the head unit, so no submenu can be opened. Make sure that the cell exists in the SDLManager.menu array");
return NO;
}
diff --git a/SmartDeviceLink/SDLScreenManager.h b/SmartDeviceLink/SDLScreenManager.h
index a811bf910..1c5468f5b 100644
--- a/SmartDeviceLink/SDLScreenManager.h
+++ b/SmartDeviceLink/SDLScreenManager.h
@@ -279,14 +279,14 @@ If set to `SDLDynamicMenuUpdatesModeForceOff`, menu updates will work the legacy
#pragma mark Menu
/**
- Present the application menu. This method should be called if the menu needs to be opened programmatically because the built in menu button is hidden.
+ Present the top-level of your application menu. This method should be called if the menu needs to be opened programmatically because the built in menu button is hidden.
*/
- (BOOL)openMenu;
/**
- Present the application menu. This method should be called if the menu needs to be opened programmatically because the built in menu button is hidden. You must update the menu with the proper cells before calling this method. This RPC will fail if the cell does not exist, is not a sub menu or is not in the menu array.
+ Present the application menu. This method should be called if the menu needs to be opened programmatically because the built in menu button is hidden. You must update the menu with the proper cells before calling this method. This RPC will fail if the cell does not contain a sub menu, or is not in the menu array.
-@param cell The submenu cell that should be opened
+@param cell The submenu cell that should be opened as a sub menu, with its sub cells as the options.
*/
- (BOOL)openSubmenu:(SDLMenuCell *)cell;
diff --git a/SmartDeviceLink/SDLScreenManager.m b/SmartDeviceLink/SDLScreenManager.m
index fcc07e19d..eceb409bb 100644
--- a/SmartDeviceLink/SDLScreenManager.m
+++ b/SmartDeviceLink/SDLScreenManager.m
@@ -13,8 +13,6 @@
#import "SDLSoftButtonManager.h"
#import "SDLTextAndGraphicManager.h"
#import "SDLVoiceCommandManager.h"
-#import "SDLVersion.h"
-#import "SDLGlobals.h"
NS_ASSUME_NONNULL_BEGIN
@interface SDLScreenManager()
diff --git a/SmartDeviceLink/SDLShowAppMenu.h b/SmartDeviceLink/SDLShowAppMenu.h
index b6d0ebd7d..a7ca2cf0f 100644
--- a/SmartDeviceLink/SDLShowAppMenu.h
+++ b/SmartDeviceLink/SDLShowAppMenu.h
@@ -11,20 +11,22 @@
NS_ASSUME_NONNULL_BEGIN
/**
- * Used by an app typically of navigation type to show the apps menu.
+ Used by an app to show the app's menu, typically this is used by a navigation app if the menu button is hidden.
+
+ Added in SmartDeviceLink 6.0
*/
@interface SDLShowAppMenu : SDLRPCRequest
/**
- Creates an open sub menu RPC
+ Creates a ShowAppMenu RPC to open the app menu directly to a AddSubMenu RPC's submenu.
- @param menuID The ID of the sub menu to open
+ @param menuID The ID of the AddSubMenu to open
@return SDLShowAppMenu RPCRequest
*/
- (instancetype)initWithMenuID:(UInt32)menuID;
/**
- A Menu ID that identifies the sub menu to open. If not set the top level menu will be opened.
+ A Menu ID that identifies the AddSubMenu to open if it correlates with the AddSubMenu menuID parameter. If not set the top level menu will be opened.
*/
@property (nullable, strong, nonatomic) NSNumber<SDLInt> *menuID;