summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Elias <francois.elias@livio.io>2021-04-28 11:40:23 -0400
committerFrank Elias <francois.elias@livio.io>2021-04-28 11:40:23 -0400
commita7ad2622ac9d11ac34368818da5b33508d2b7fd6 (patch)
tree0887595e936822e709140db02d52de15dd126808
parent618294f18cb68b7c19ecebfa6dc5ed1de90dd03b (diff)
downloadsdl_ios-bugfix/issue-1959-two-voiceCommands-contains-the-same-string.tar.gz
-rw-r--r--SmartDeviceLink/private/SDLVoiceCommandManager.m12
-rw-r--r--SmartDeviceLink/public/SDLVoiceCommand.m1
2 files changed, 6 insertions, 7 deletions
diff --git a/SmartDeviceLink/private/SDLVoiceCommandManager.m b/SmartDeviceLink/private/SDLVoiceCommandManager.m
index 88a39d50f..0a33a2148 100644
--- a/SmartDeviceLink/private/SDLVoiceCommandManager.m
+++ b/SmartDeviceLink/private/SDLVoiceCommandManager.m
@@ -109,20 +109,20 @@ UInt32 const VoiceCommandIdMin = 1900000000;
return;
}
+ // Check if all new voice commands have unique strings
+ if (![self sdl_arePendingVoiceCommandsUnique:voiceCommands]) {
+ SDLLogE(@"Not all voice command strings are unique across all voice commands. Voice commands will not be set.");
+ return;
+ }
+
// Set the ids
[self sdl_updateIdsOnVoiceCommands:voiceCommands];
// Set the new voice commands internally
_voiceCommands = voiceCommands;
- if (![self sdl_arePendingVoiceCommandsUnique:voiceCommands]) {
- SDLLogE(@"Not all voice command strings are unique across all voice commands. Voice commands will not be set.");
- return;
- }
-
// Create the operation, cancel previous ones and set this one
__weak typeof(self) weakSelf = self;
-
SDLVoiceCommandUpdateOperation *updateOperation = [[SDLVoiceCommandUpdateOperation alloc] initWithConnectionManager:self.connectionManager pendingVoiceCommands:voiceCommands oldVoiceCommands:_currentVoiceCommands updateCompletionHandler:^(NSArray<SDLVoiceCommand *> *newCurrentVoiceCommands, NSError * _Nullable error) {
weakSelf.currentVoiceCommands = newCurrentVoiceCommands;
[weakSelf sdl_updatePendingOperationsWithNewCurrentVoiceCommands:newCurrentVoiceCommands];
diff --git a/SmartDeviceLink/public/SDLVoiceCommand.m b/SmartDeviceLink/public/SDLVoiceCommand.m
index 8c8a08c4e..ba0421fc6 100644
--- a/SmartDeviceLink/public/SDLVoiceCommand.m
+++ b/SmartDeviceLink/public/SDLVoiceCommand.m
@@ -7,7 +7,6 @@
//
#import "SDLVoiceCommand.h"
-#import "NSArray+Extensions.h"
NS_ASSUME_NONNULL_BEGIN