Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Choice Set Manager #1080

Merged
merged 82 commits into from
Jun 14, 2019
Merged

Mobile Choice Set Manager #1080

merged 82 commits into from
Jun 14, 2019

Conversation

bilal-alsharifi
Copy link
Contributor

@bilal-alsharifi bilal-alsharifi commented May 28, 2019

Fixes #764

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

To be added later

Summary

This PR implements the ChoiceSetManager for Android, JavaSE, and JavaEE projects as described in the proposal

Tasks Remaining:

  • [Task 1]
  • [Task 2]

CLA

@codecov-io
Copy link

codecov-io commented May 28, 2019

Codecov Report

Merging #1080 into develop will decrease coverage by 2.58%.
The diff coverage is 37.02%.

Impacted file tree graph

@@             Coverage Diff              @@
##             develop   #1080      +/-   ##
============================================
- Coverage      46.48%   43.9%   -2.59%     
- Complexity      3852    3996     +144     
============================================
  Files            440     450      +10     
  Lines          21052   23633    +2581     
  Branches        2327    2976     +649     
============================================
+ Hits            9787   10375     +588     
- Misses         10718   12652    +1934     
- Partials         547     606      +59
Impacted Files Coverage Δ Complexity Δ
...smartdevicelink/managers/screen/menu/MenuCell.java 88.23% <0%> (-1.32%) 28 <3> (ø)
...vicelink/managers/screen/menu/BaseMenuManager.java 47.1% <100%> (+0.18%) 84 <0> (ø) ⬇️
...ink/managers/screen/choiceset/ChoiceSetLayout.java 100% <100%> (ø) 2 <2> (?)
...ers/screen/choiceset/PresentKeyboardOperation.java 14.89% <14.89%> (ø) 2 <2> (?)
...tdevicelink/managers/screen/BaseScreenManager.java 67.71% <15.78%> (-7.06%) 41 <0> (ø)
...gers/screen/choiceset/PreloadChoicesOperation.java 20.72% <20.72%> (ø) 12 <12> (?)
...ain/java/com/smartdevicelink/proxy/rpc/Choice.java 66.66% <22.22%> (ø) 18 <1> (+1) ⬆️
...rs/screen/choiceset/PresentChoiceSetOperation.java 23.14% <23.14%> (ø) 7 <7> (?)
...reen/choiceset/CheckChoiceVROptionalOperation.java 26.22% <26.22%> (ø) 6 <6> (?)
...agers/screen/choiceset/DeleteChoicesOperation.java 32.25% <32.25%> (ø) 3 <3> (?)
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b60f51...75b703d. Read the comment docs.

@@ -61,7 +59,6 @@ public void testInstantiation(){
assertNull(screenManager.getSoftButtonObjectByName("test"));
assertNull(screenManager.getSoftButtonObjectById(1));
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be able to add this back?

// make sure there is at least one vr param
List<String> existingVrCommands = getVrCommands();
// this is added to allow the choice set manager to disable this functionality
if (!getIgnoreAddingVRItems()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a direct access to the variable as it's private and in the class. Unless you moved this to a static instance for all choice instances and then synchronized the read/write operations.

@@ -97,6 +97,7 @@
public static final String KEY_VR_COMMANDS = "vrCommands";
public static final String KEY_CHOICE_ID = "choiceID";
public static final String KEY_IMAGE = "image";
private boolean ignoreAddingVRItems;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a description to this variable so that it's clear why we have it.

int nextChoiceId;
final int choiceCellIdMin = 1;

SystemContext currentSystemContext;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra whitespace here

executor.submit(deleteChoicesOperation);
}

public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing javadoc

}
}

public void deleteChoices(@NonNull List<ChoiceCell> choices){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing javadoc

executor.submit(checkChoiceVR);
}

public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing javadoc

pendingPresentOperation = executor.submit(presentOp);
}

public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing javadoc

// if this is not an instance of this class, not the same
if (!(o instanceof ChoiceCell)) return false;

return hashCode() == o.hashCode();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'o' could be null here and that will throw an NPE

pi.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
finishOperation();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't check the onError method, meaning if there is an error this will never call finishOperation

DeleteInteractionChoiceSet delete = createDeleteInteractionChoiceSet();
delete.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not overriding onError here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants