-
Notifications
You must be signed in to change notification settings - Fork 103
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
Implement SDL 0157 - Choice Set Manager #975
Conversation
* Update `deleteChoices:` to `deleteChoices:andAttachedImages:`
* Add a state machine to the choice set manager * Add checking voice optional
* Add ScreenManager delegate for checking errors
* ChoiceManager code organization
* Add missing properties to ChoiceSetManager * First pass at deleting choice cells
* In-progress
# 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
* In progress delete tests
* PresentChoiceSetOperation now correctly resets the keyboard only when using a searchable choice set
* Choice set manager removes deleted cells from in progress preloads * Choice set manager tests
SmartDeviceLink/SDLScreenManager.h
Outdated
|
||
@param error The error if one occurred | ||
*/ | ||
typedef void(^SDLPreloadChoiceCompletionHandler)(NSError *error); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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:
- If the
SDLChoiceCell
isnull
, the only way to get the error is to look at the logs. - 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this 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.
Fixes #970
This PR is ready for review.
Risk
This PR makes minor API changes.
Testing Plan
Summary
Implement SDL-0157, a choice set manager making implementing interactions (choice sets and keyboards) much easier.
Changelog
Enhancements
Tasks Remaining:
CLA