summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-08-12 10:07:46 -0400
committerJoel Fischer <joeljfischer@gmail.com>2021-08-12 10:07:46 -0400
commitc312e17ab5f35a718272a28ae3df1fa79c7a2143 (patch)
treefcf1ee56b2a15050a3300c1369bc9dccb993194c
parent2a86bb3bb553c0a3bfbb4db1ce042bb95ddad85e (diff)
downloadsdl_ios-c312e17ab5f35a718272a28ae3df1fa79c7a2143.tar.gz
Compatibility mode needs unique cells
-rw-r--r--SmartDeviceLink/private/SDLMenuReplaceOperation.m23
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];
}