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

Implement SDL 0157 - Choice Set Manager #975

Merged
merged 54 commits into from
Jun 27, 2018

Conversation

joeljfischer
Copy link
Contributor

@joeljfischer joeljfischer commented May 21, 2018

Fixes #970

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

  • Unit tests
  • Smoke tests

Summary

Implement SDL-0157, a choice set manager making implementing interactions (choice sets and keyboards) much easier.

Changelog

Enhancements

Tasks Remaining:

  • Implement the manager
  • Unit tests

CLA

* Update `deleteChoices:` to `deleteChoices:andAttachedImages:`
@joeljfischer joeljfischer added enhancement proposal Accepted SDL Evolution Proposal labels May 21, 2018
@joeljfischer joeljfischer added this to the 6.1.0 milestone May 21, 2018
@joeljfischer joeljfischer self-assigned this May 21, 2018
* Add a state machine to the choice set manager
* Add checking voice optional
* Add ScreenManager delegate for checking errors
* Add missing properties to ChoiceSetManager
* First pass at deleting choice cells
# Conflicts:
#	SmartDeviceLink/SDLScreenManager.h
* Rework error information and completion handler information from operations
* Updating present choice set operation
* Updates to ChoiceSetManager
* Fix CheckChoiceVROptionalOperation not working
* Fixes to check choice VR optional operation
* Fix crash when preloading choices without artworks
* Update log modules to split screen manager into separate modules for easier filtering
* Add new SDLChoiceSet initializer for easier TTS creation
* Update Swift example app to use new ChoiceSetManager
* Fix preloading without artworks not properly returning
* Fix choices without images not properly creating the Choice
* Fix presentation errors not properly returning
* Add description methods to SDLChoiceCell and SDLChoiceSet
* Fix not setting screen manager keyboard configuration
* Documentation
* All keyboard presentations now set keyboard properties before hand. It simplifies logic and makes sure we have the correct properties available
* PreloadChoiceCompletionHandler error should be nullable
* Fix name of ChoiceSetManager transaction queue
* Don’t attempt to upload choices if the choices are uploaded or pending
* Add uploaded choices to the uploaded choices and remove from the pending upload choices
* Make sure presented choice sets have correct choice ids
@joeljfischer joeljfischer changed the title WIP: Implement SDL 0157 - Choice Set Manager Implement SDL 0157 - Choice Set Manager Jun 15, 2018

@param error The error if one occurred
*/
typedef void(^SDLPreloadChoiceCompletionHandler)(NSError *error);
Copy link
Contributor

Choose a reason for hiding this comment

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

The returned error in the SDLPreloadChoiceCompletionHandler should be nullable.
Also, there appears to be a duplicate of SDLPreloadChoiceCompletionHandler in the SDLChoiceSetManager class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

if (choiceVoiceCommandSet.count < nonNilVoiceCommands.count) {
SDLLogW(@"Attempted to create a choice set with duplicate voice commands. Voice commands must be unique.");
return nil;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better if the data validation was done in the SDLChoiceSetManager's preloadChoices:withCompletionHandler method. Currently:

  1. If the SDLChoiceCell is null, the only way to get the error is to look at the logs.
  2. It is still possible to send invalid data if setting each of params individually.

If data validation is done in the preloadChoices:withCompletionHandler method, the custom error can be passed back via the handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We shouldn't do it in preloadChoices:withCompletionHandler: because we can upload multiple choices with the same primary text, but we just can't display a choice set with 2 that have the same text. I believe it's the same for voice commands.

Copy link
Contributor

Choose a reason for hiding this comment

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

True, it is the most efficient way to validate the choice sets since the manager has 3 choice set upload methods.


NS_ASSUME_NONNULL_BEGIN

@interface SDLChoiceCell: NSObject
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be handy to have a cellSelectedHandler on the SDLChoiceCell. That way, when the SDLChoiceSetDelegate's choiceSet:didSelectChoice:withSource is called, the handler can be triggered. Otherwise, I have to check the cell's text and figure out what I'm going to do based on that... which can get messy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem with blocks is that we'd have to store all of them...and there could be a lot. For now, I've added a row index to the delegate callback, which should be sufficient. If we want to go to blocks, we can do so in a later release.

SDLChoice *choice = [[SDLChoice alloc] init];
choice.choiceID = @0;
choice.menuName = @"Test Cell";
choice.vrCommands = hasVR ? @[@"Test VR"] : nil;
Copy link
Contributor

Choose a reason for hiding this comment

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

This shows up on Manticore's Voice tab. Could be confusing for developers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, that's unavoidable. This has to have a VR command to be valid, and it's used for the keyboard.

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

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

I left a few comments and enhancement requests.


#pragma mark - SDLChoiceSetDelegate

- (void)choiceSet:(SDLChoiceSet *)choiceSet didSelectChoice:(SDLChoiceCell *)choice withSource:(SDLTriggerSource)source {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method needs to be updated to include the new rowIndex param. App crashes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

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

The Obj-C example app SDLChoiceSetDelegate methods need to be updated.

@joeljfischer joeljfischer merged commit aa39378 into develop Jun 27, 2018
@joeljfischer joeljfischer deleted the feature/issue_970_mobile_choice_manager branch June 27, 2018 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Accepted SDL Evolution Proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants