diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-11-03 16:15:03 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-11-03 16:15:03 -0400 |
commit | 88814f2687087f7a00de91554972b5817b9414d5 (patch) | |
tree | 7aeee7dbb8fc869067c53d2954e0ed1ea12595a3 | |
parent | dde0230cfb59b0c2ba8e427eac55b3fc8894edc6 (diff) | |
download | sdl_ios-88814f2687087f7a00de91554972b5817b9414d5.tar.gz |
Fix menu replace op check for submenu icon
* Fix menu utilities version check to be 7.0 and add command icon check
-rw-r--r-- | SmartDeviceLink/private/SDLMenuReplaceOperation.m | 15 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLMenuReplaceUtilities.m | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/SmartDeviceLink/private/SDLMenuReplaceOperation.m b/SmartDeviceLink/private/SDLMenuReplaceOperation.m index 8f656c8a5..91c667579 100644 --- a/SmartDeviceLink/private/SDLMenuReplaceOperation.m +++ b/SmartDeviceLink/private/SDLMenuReplaceOperation.m @@ -341,12 +341,14 @@ NS_ASSUME_NONNULL_BEGIN // Strip away fields that cannot be used to determine uniqueness visually including fields not supported by the HMI cell.voiceCommands = nil; - // Don't check SDLImageFieldNameSubMenuIcon because it was added in 7.0 when the feature was added in 5.0. Just assume that if CommandIcon is not available, the submenu icon is not either. - if (![windowCapability hasImageFieldOfName:SDLImageFieldNameCommandIcon]) { - cell.icon = nil; - } - if (cell.subCells != nil) { + // If we're >= 5.0 && < 7.0, but don't have command icon image, no icon. If we're < 5.0 || >= 7.0 and don't have submenu icon, no icon. + if (![windowCapability hasImageFieldOfName:SDLImageFieldNameSubMenuIcon] + || ([[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithString:@"5.0"]] + && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithString:@"7.0"]] + && ![windowCapability hasImageFieldOfName:SDLImageFieldNameCommandIcon])) { + cell.icon = nil; + } if (![windowCapability hasTextFieldOfName:SDLTextFieldNameMenuSubMenuSecondaryText]) { cell.secondaryText = nil; } @@ -358,6 +360,9 @@ NS_ASSUME_NONNULL_BEGIN } cell.subCells = [self sdl_cellsWithRemovedPropertiesFromCells:cell.subCells basedOnWindowCapability:windowCapability]; } else { + if (![windowCapability hasImageFieldOfName:SDLImageFieldNameCommandIcon]) { + cell.icon = nil; + } if (![windowCapability hasTextFieldOfName:SDLTextFieldNameMenuCommandSecondaryText]) { cell.secondaryText = nil; } diff --git a/SmartDeviceLink/private/SDLMenuReplaceUtilities.m b/SmartDeviceLink/private/SDLMenuReplaceUtilities.m index 85d1a5ee5..30d107813 100644 --- a/SmartDeviceLink/private/SDLMenuReplaceUtilities.m +++ b/SmartDeviceLink/private/SDLMenuReplaceUtilities.m @@ -122,7 +122,8 @@ static UInt32 _menuId = 0; BOOL supportsImage = NO; if (cell.subCells != nil) { if ([[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithMajor:5 minor:0 patch:0]] - && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:1 patch:0]]) { + && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:0 patch:0]] + && [windowCapability hasImageFieldOfName:SDLImageFieldNameCommandIcon]) { supportsImage = YES; } else { supportsImage = [windowCapability hasImageFieldOfName:SDLImageFieldNameSubMenuIcon]; |