Skip to content

Commit c2fec1e

Browse files
HeniganHenigan
authored andcommitted
Fix Review feedback, error logs and delete error
1 parent af19401 commit c2fec1e

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ public void onError(String error) {
301301
choiceSet.getChoiceSetSelectionListener().onError("Incorrect State");
302302
} else {
303303
DebugTool.logError(TAG, "Present finished but an unhandled state occurred and callback failed");
304+
choiceSet.getChoiceSetSelectionListener().onError("callback failed");
304305
}
305-
choiceSet.getChoiceSetSelectionListener().onError(error);
306306
}
307307
}
308308
};

base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class DeleteChoicesOperation extends Task {
5353
private HashSet<ChoiceCell> cellsToDelete;
5454
private final BaseChoiceSetManager.ChoicesOperationCompletionListener completionListener;
5555
private HashSet<ChoiceCell> loadedCells;
56+
private List<DeleteInteractionChoiceSet> deleteChoices;
5657
private boolean completionSuccess = false;
5758

5859
DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, HashSet<ChoiceCell> loadedCells, BaseChoiceSetManager.ChoicesOperationCompletionListener completionListener) {
@@ -79,7 +80,7 @@ public void onExecute() {
7980

8081
private void sendDeletions() {
8182

82-
List<DeleteInteractionChoiceSet> deleteChoices = createDeleteSets();
83+
deleteChoices = createDeleteSets();
8384

8485
if (deleteChoices.size() > 0) {
8586

@@ -110,7 +111,7 @@ public void onResponse(int correlationId, RPCResponse response) {
110111
DeleteChoicesOperation.super.onFinished();
111112
} else {
112113
if (loadedCells != null) {
113-
loadedCells.remove(loadedCellFromChoiceId(correlationId));
114+
loadedCells.remove(loadedCellFromCorrelationId(deleteChoices, correlationId));
114115
}
115116
}
116117
}
@@ -144,7 +145,20 @@ private void updateCellsToDelete() {
144145
this.cellsToDelete = updatedCellsToDelete;
145146
}
146147

147-
private ChoiceCell loadedCellFromChoiceId(int choiceId) {
148+
private ChoiceCell loadedCellFromCorrelationId(List<DeleteInteractionChoiceSet> deleteRpcs, int correlationId) {
149+
150+
Integer choiceId = null;
151+
152+
for (DeleteInteractionChoiceSet rpc : deleteRpcs) {
153+
if (rpc.getCorrelationID() == correlationId) {
154+
choiceId = rpc.getInteractionChoiceSetID();
155+
}
156+
}
157+
158+
if (choiceId == null) {
159+
return null;
160+
}
161+
148162
for (ChoiceCell cell : this.loadedCells) {
149163
if (cell.getChoiceId() == choiceId) {
150164
return cell;

0 commit comments

Comments
 (0)