diff options
Diffstat (limited to 'SmartDeviceLink/private/SDLVoiceCommandManager.m')
-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]; |