diff options
author | Frank Elias <francois.elias@livio.io> | 2021-04-26 15:17:21 -0400 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-04-26 15:17:21 -0400 |
commit | 8083b42f46bcf1343782854258fd6af9b57b038e (patch) | |
tree | 1690933f6e398fb76cd4a287a7eb695117dea1db | |
parent | cf2e16f93bc1430038448aabd9b6fd2b9acb4963 (diff) | |
download | sdl_ios-bugfix/issue-1964-voiceCommand-that-contains-no-string-should-be-removed.tar.gz |
-rw-r--r-- | SmartDeviceLink/private/SDLVoiceCommandManager.m | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/SmartDeviceLink/private/SDLVoiceCommandManager.m b/SmartDeviceLink/private/SDLVoiceCommandManager.m index f8586a408..33e5ca050 100644 --- a/SmartDeviceLink/private/SDLVoiceCommandManager.m +++ b/SmartDeviceLink/private/SDLVoiceCommandManager.m @@ -41,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN @property (assign, nonatomic) UInt32 lastVoiceCommandId; @property (copy, nonatomic) NSArray<SDLVoiceCommand *> *currentVoiceCommands; +@property (copy, nonatomic) NSArray<SDLVoiceCommand *> *comparedVoiceCommands; @end @@ -105,11 +106,14 @@ UInt32 const VoiceCommandIdMin = 1900000000; #pragma mark - Setters - (void)setVoiceCommands:(NSArray<SDLVoiceCommand *> *)voiceCommands { - if ([voiceCommands isEqualToArray:self.voiceCommands]) { + if (voiceCommands == self.comparedVoiceCommands) { SDLLogD(@"New voice commands are equal to the existing voice commands, skipping..."); return; } + // Set a copy of voiceCommands to reduce duplicate voiceCommands sent + self.comparedVoiceCommands = voiceCommands; + // Set the new voice commands internally _voiceCommands = [self sdl_removeEmptyVoiceCommands:voiceCommands]; |