diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-08-12 10:07:46 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-08-12 10:07:46 -0400 |
commit | c312e17ab5f35a718272a28ae3df1fa79c7a2143 (patch) | |
tree | fcf1ee56b2a15050a3300c1369bc9dccb993194c | |
parent | 2a86bb3bb553c0a3bfbb4db1ce042bb95ddad85e (diff) | |
download | sdl_ios-c312e17ab5f35a718272a28ae3df1fa79c7a2143.tar.gz |
Compatibility mode needs unique cells
-rw-r--r-- | SmartDeviceLink/private/SDLMenuReplaceOperation.m | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/SmartDeviceLink/private/SDLMenuReplaceOperation.m b/SmartDeviceLink/private/SDLMenuReplaceOperation.m index 5de4a6dd6..22e522336 100644 --- a/SmartDeviceLink/private/SDLMenuReplaceOperation.m +++ b/SmartDeviceLink/private/SDLMenuReplaceOperation.m @@ -82,23 +82,22 @@ NS_ASSUME_NONNULL_BEGIN [SDLMenuReplaceUtilities updateIdsOnMenuCells:self.updatedMenu parentId:ParentIdNotFound]; + // Strip the "current menu" and the new menu of properties that are not displayed on the head unit + NSArray<SDLMenuCell *> *updatedStrippedMenu = [self.class sdl_cellsWithRemovedPropertiesFromCells:self.updatedMenu basedOnWindowCapability:self.windowCapability]; + NSArray<SDLMenuCell *> *currentStrippedMenu = [self.class sdl_cellsWithRemovedPropertiesFromCells:self.mutableCurrentMenu basedOnWindowCapability:self.windowCapability]; + + // Generate unique names and ensure that all menus we are tracking have them so that we can properly compare when using the dynamic algorithm + BOOL supportsMenuUniqueness = [[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithMajor:7 minor:1 patch:0]]; + [self.class sdl_generateUniqueNamesForCells:updatedStrippedMenu supportsMenuUniqueness:supportsMenuUniqueness]; + [self.class sdl_applyUniqueNamesOnCells:updatedStrippedMenu toCells:self.updatedMenu]; + [self.class sdl_applyUniqueNamesOnCells:self.currentMenu toCells:currentStrippedMenu]; + SDLDynamicMenuUpdateRunScore *runScore = nil; if (self.compatibilityModeEnabled) { SDLLogV(@"Dynamic menu update inactive. Forcing the deletion of all old cells and adding all new ones, even if they're the same."); - runScore = [SDLDynamicMenuUpdateAlgorithm compatibilityRunScoreWithOldMenuCells:self.currentMenu updatedMenuCells:self.updatedMenu]; + runScore = [SDLDynamicMenuUpdateAlgorithm compatibilityRunScoreWithOldMenuCells:currentStrippedMenu updatedMenuCells:updatedStrippedMenu]; } else { SDLLogV(@"Dynamic menu update active. Running the algorithm to find the best way to delete / add cells."); - - // Strip the "current menu" and the new menu of properties that are not displayed on the head unit - NSArray<SDLMenuCell *> *updatedStrippedMenu = [self.class sdl_cellsWithRemovedPropertiesFromCells:self.updatedMenu basedOnWindowCapability:self.windowCapability]; - NSArray<SDLMenuCell *> *currentStrippedMenu = [self.class sdl_cellsWithRemovedPropertiesFromCells:self.mutableCurrentMenu basedOnWindowCapability:self.windowCapability]; - - // Generate unique names and ensure that all menus we are tracking have them so that we can properly compare when using the dynamic algorithm - BOOL supportsMenuUniqueness = [[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithMajor:7 minor:1 patch:0]]; - [self.class sdl_generateUniqueNamesForCells:updatedStrippedMenu supportsMenuUniqueness:supportsMenuUniqueness]; - [self.class sdl_applyUniqueNamesOnCells:updatedStrippedMenu toCells:self.updatedMenu]; - [self.class sdl_applyUniqueNamesOnCells:self.currentMenu toCells:currentStrippedMenu]; - runScore = [SDLDynamicMenuUpdateAlgorithm dynamicRunScoreOldMenuCells:currentStrippedMenu updatedMenuCells:updatedStrippedMenu]; } |