From 42c626a45efde5a4925bcc4cd8bbe176e434974a Mon Sep 17 00:00:00 2001 From: Frank Elias Date: Fri, 26 Feb 2021 10:34:48 -0500 Subject: [PATCH 1/2] Fix for empty string bug --- SmartDeviceLink/private/SDLMenuManager.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SmartDeviceLink/private/SDLMenuManager.m b/SmartDeviceLink/private/SDLMenuManager.m index a01861d6f..87f933e35 100644 --- a/SmartDeviceLink/private/SDLMenuManager.m +++ b/SmartDeviceLink/private/SDLMenuManager.m @@ -673,8 +673,8 @@ - (SDLAddCommand *)sdl_commandForMenuCell:(SDLMenuCell *)cell withArtwork:(BOOL) params.menuName = cell.title; params.parentID = cell.parentCellId != UINT32_MAX ? @(cell.parentCellId) : nil; params.position = @(position); - params.tertiaryText = cell.tertiaryText; - params.secondaryText = cell.secondaryText; + params.secondaryText = ([cell.secondaryText isEqualToString:@""]) ? nil : cell.secondaryText; + params.tertiaryText = ([cell.tertiaryText isEqualToString:@""]) ? nil : cell.tertiaryText; command.menuParams = params; command.vrCommands = (cell.voiceCommands.count == 0) ? nil : cell.voiceCommands; @@ -695,7 +695,11 @@ - (SDLAddSubMenu *)sdl_subMenuCommandForMenuCell:(SDLMenuCell *)cell withArtwork } else { submenuLayout = self.menuConfiguration.defaultSubmenuLayout; } - return [[SDLAddSubMenu alloc] initWithMenuID:cell.cellId menuName:cell.title position:@(position) menuIcon:icon menuLayout:submenuLayout parentID:nil secondaryText:cell.secondaryText tertiaryText:cell.tertiaryText secondaryImage:secondaryImage]; + + NSString *secondaryText = ([cell.secondaryText isEqualToString:@""]) ? nil : cell.secondaryText; + NSString *tertiaryText = ([cell.tertiaryText isEqualToString:@""]) ? nil : cell.tertiaryText; + + return [[SDLAddSubMenu alloc] initWithMenuID:cell.cellId menuName:cell.title position:@(position) menuIcon:icon menuLayout:submenuLayout parentID:nil secondaryText:secondaryText tertiaryText:tertiaryText secondaryImage:secondaryImage]; } #pragma mark - Calling handlers From 65dc4b5d08666bf8e568fe195ab3c2eb2f84e601 Mon Sep 17 00:00:00 2001 From: Frank Elias Date: Tue, 2 Mar 2021 14:42:59 -0500 Subject: [PATCH 2/2] Commnets review --- SmartDeviceLink/private/SDLMenuManager.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SmartDeviceLink/private/SDLMenuManager.m b/SmartDeviceLink/private/SDLMenuManager.m index 87f933e35..df796ea88 100644 --- a/SmartDeviceLink/private/SDLMenuManager.m +++ b/SmartDeviceLink/private/SDLMenuManager.m @@ -673,8 +673,8 @@ - (SDLAddCommand *)sdl_commandForMenuCell:(SDLMenuCell *)cell withArtwork:(BOOL) params.menuName = cell.title; params.parentID = cell.parentCellId != UINT32_MAX ? @(cell.parentCellId) : nil; params.position = @(position); - params.secondaryText = ([cell.secondaryText isEqualToString:@""]) ? nil : cell.secondaryText; - params.tertiaryText = ([cell.tertiaryText isEqualToString:@""]) ? nil : cell.tertiaryText; + params.secondaryText = (cell.secondaryText.length == 0) ? nil : cell.secondaryText; + params.tertiaryText = (cell.tertiaryText.length == 0) ? nil : cell.tertiaryText; command.menuParams = params; command.vrCommands = (cell.voiceCommands.count == 0) ? nil : cell.voiceCommands; @@ -696,8 +696,8 @@ - (SDLAddSubMenu *)sdl_subMenuCommandForMenuCell:(SDLMenuCell *)cell withArtwork submenuLayout = self.menuConfiguration.defaultSubmenuLayout; } - NSString *secondaryText = ([cell.secondaryText isEqualToString:@""]) ? nil : cell.secondaryText; - NSString *tertiaryText = ([cell.tertiaryText isEqualToString:@""]) ? nil : cell.tertiaryText; + NSString *secondaryText = (cell.secondaryText.length == 0) ? nil : cell.secondaryText; + NSString *tertiaryText = (cell.tertiaryText.length == 0) ? nil : cell.tertiaryText; return [[SDLAddSubMenu alloc] initWithMenuID:cell.cellId menuName:cell.title position:@(position) menuIcon:icon menuLayout:submenuLayout parentID:nil secondaryText:secondaryText tertiaryText:tertiaryText secondaryImage:secondaryImage]; }