diff options
author | Frank Elias <francois.elias@livio.io> | 2021-01-05 14:43:27 -0500 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-01-05 14:43:27 -0500 |
commit | 96ed063acf78044e2d300520a608da66e3b7439d (patch) | |
tree | ad19d5e0eafd77e4f0ffa162f92fdf2c1c91e771 | |
parent | 651d4f7b071b919fdc54747e144c3ecccea20f25 (diff) | |
download | sdl_ios-96ed063acf78044e2d300520a608da66e3b7439d.tar.gz |
Code changes from Sets to Arrays
-rw-r--r-- | SmartDeviceLink/private/SDLChoiceSetManager.m | 9 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLGlobals.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLMenuManager.m | 19 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLPreloadChoicesOperation.m | 4 |
4 files changed, 22 insertions, 11 deletions
diff --git a/SmartDeviceLink/private/SDLChoiceSetManager.m b/SmartDeviceLink/private/SDLChoiceSetManager.m index e0a03b11a..9801ae1b2 100644 --- a/SmartDeviceLink/private/SDLChoiceSetManager.m +++ b/SmartDeviceLink/private/SDLChoiceSetManager.m @@ -356,6 +356,7 @@ UInt16 const ChoiceCellCancelIdMin = 1; } return NO; } + - (void)presentChoiceSet:(SDLChoiceSet *)choiceSet mode:(SDLInteractionMode)mode withKeyboardDelegate:(nullable id<SDLKeyboardDelegate>)delegate { if (![self.currentState isEqualToString:SDLChoiceManagerStateReady]) { SDLLogE(@"Attempted to present choices in an incorrect state: %@, it will not be presented", self.currentState); @@ -548,8 +549,8 @@ UInt16 const ChoiceCellCancelIdMin = 1; #pragma mark - Getters -- (NSSet<SDLChoiceCell *> *)preloadedChoices { - __block NSSet<SDLChoiceCell *> *set = nil; +- (NSArray<SDLChoiceCell *> *)preloadedChoices { + __block NSArray<SDLChoiceCell *> *set = nil; [SDLGlobals runSyncOnSerialSubQueue:self.readWriteQueue block:^{ set = [self->_preloadedMutableChoices copy]; }]; @@ -557,8 +558,8 @@ UInt16 const ChoiceCellCancelIdMin = 1; return set; } -- (NSSet<SDLChoiceCell *> *)pendingPreloadChoices { - __block NSSet<SDLChoiceCell *> *set = nil; +- (NSArray<SDLChoiceCell *> *)pendingPreloadChoices { + __block NSArray<SDLChoiceCell *> *set = nil; [SDLGlobals runSyncOnSerialSubQueue:self.readWriteQueue block:^{ set = [self->_pendingMutablePreloadChoices copy]; }]; diff --git a/SmartDeviceLink/private/SDLGlobals.h b/SmartDeviceLink/private/SDLGlobals.h index eb1969a96..549be6f2d 100644 --- a/SmartDeviceLink/private/SDLGlobals.h +++ b/SmartDeviceLink/private/SDLGlobals.h @@ -40,6 +40,7 @@ extern void *const SDLConcurrentQueueName; + (instancetype)sharedGlobals; +- (instancetype)init; - (void)setDynamicMTUSize:(NSUInteger)maxMTUSize forServiceType:(SDLServiceType)serviceType; - (NSUInteger)mtuSizeForServiceType:(SDLServiceType)serviceType; diff --git a/SmartDeviceLink/private/SDLMenuManager.m b/SmartDeviceLink/private/SDLMenuManager.m index 76a93015e..636e28add 100644 --- a/SmartDeviceLink/private/SDLMenuManager.m +++ b/SmartDeviceLink/private/SDLMenuManager.m @@ -184,6 +184,16 @@ UInt32 const MenuCellIdMin = 1; voiceCommandCount += cell.voiceCommands.count; } + // Update our Lists + // set old list, according to version changes + SDLVersion *version = [[SDLVersion alloc] initWithMajor:7 minor:0 patch:0]; + SDLGlobals *globals = [[SDLGlobals alloc] init]; + if ([globals.rpcVersion isLessThanVersion:version]) { + _oldMenuCells = self.uniqueNamedMenuCells; + } else { + _oldMenuCells = self.menuCells; + } + // Check for duplicate titles if (titleCheckSet.count != [self menuCellListToBeUsed].count) { SDLLogE(@"Not all cell titles are unique. The menu will not be set."); @@ -196,11 +206,6 @@ UInt32 const MenuCellIdMin = 1; return; } - if ([[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:0 patch:0]]) { - _oldMenuCells = self.uniqueNamedMenuCells; - } else { - _oldMenuCells = self.menuCells; - } _menuCells = menuCells; _uniqueNamedMenuCells = @[]; @@ -573,7 +578,9 @@ UInt32 const MenuCellIdMin = 1; } - (NSArray<SDLMenuCell *> *) menuCellListToBeUsed { - if ([[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:0 patch:0]]) { + SDLVersion *version = [[SDLVersion alloc] initWithMajor:7 minor:0 patch:0]; + SDLGlobals *globals = [[SDLGlobals alloc] init]; + if ([globals.rpcVersion isLessThanVersion:version]) { return self.uniqueNamedMenuCells; } else { return self.menuCells; diff --git a/SmartDeviceLink/private/SDLPreloadChoicesOperation.m b/SmartDeviceLink/private/SDLPreloadChoicesOperation.m index 9aa64f230..f5edde1f6 100644 --- a/SmartDeviceLink/private/SDLPreloadChoicesOperation.m +++ b/SmartDeviceLink/private/SDLPreloadChoicesOperation.m @@ -56,7 +56,9 @@ NS_ASSUME_NONNULL_BEGIN _displayName = displayName; _windowCapability = defaultMainWindowCapability; _vrOptional = isVROptional; - if ([[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:0 patch:0]]) { + SDLVersion *version = [[SDLVersion alloc] initWithMajor:7 minor:0 patch:0]; + SDLGlobals *globals = [[SDLGlobals alloc] init]; + if ([globals.rpcVersion isLessThanVersion:version]) { _cellsToUpload = [self sdl_updateCellsForUniqueNames:([cells copy])]; } else { _cellsToUpload = [cells mutableCopy]; |