diff options
author | Julian Kast <julian@livio.com> | 2021-05-24 11:33:38 -0400 |
---|---|---|
committer | Julian Kast <julian@livio.com> | 2021-05-24 11:33:38 -0400 |
commit | 76cbf367bab51ffae4a44e516c507f81762772f2 (patch) | |
tree | b7d75daae974f24c0633b6cecb4b0d1a9571de39 | |
parent | d5da8a089551fb285bf6197c692a152063c5cd59 (diff) | |
download | sdl_android-76cbf367bab51ffae4a44e516c507f81762772f2.tar.gz |
Update voiceCommand listeners from previous uploads
-rw-r--r-- | base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperation.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperation.java index 928a8b54a..59caffbdb 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperation.java @@ -53,6 +53,15 @@ class VoiceCommandUpdateOperation extends Task { onFinished(); return; } + // Check if a voiceCommand has already been uploaded and update its VoiceCommandSelectionListener to + // prevent calling the wrong listener in a case where a voice command was uploaded and then its voiceCommandSelectionListener was updated in another upload. + if (pendingVoiceCommands != null && pendingVoiceCommands.size() > 0) { + for (VoiceCommand voiceCommand : pendingVoiceCommands) { + if (currentVoiceCommands.contains(voiceCommand)) { + currentVoiceCommands.get(currentVoiceCommands.indexOf(voiceCommand)).setVoiceCommandSelectionListener(voiceCommand.getVoiceCommandSelectionListener()); + } + } + } sendDeleteCurrentVoiceCommands(new CompletionListener() { @Override @@ -169,7 +178,7 @@ class VoiceCommandUpdateOperation extends Task { if (voiceCommandsToAdd.size() == 0) { if (listener != null) { - listener.onComplete(true); // no voice commands to send doesnt mean that its an error + listener.onComplete(true); // no voice commands to send doesn't mean that its an error } return; } |