Skip to content

Commit

Permalink
Add requested Voicing query parameters for #968
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed May 21, 2024
1 parent 0c7e31c commit 28b9099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions js/preferences/PreferencesModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export default class PreferencesModel extends PhetioObject {
voiceRateProperty: voicingManager.voiceRateProperty,
voiceProperty: voicingManager.voiceProperty,

toolbarEnabledProperty: new BooleanProperty( true, {
// The toolbar is enabled by default, but can be initially disabled with a query parameter.
toolbarEnabledProperty: new BooleanProperty( !phet.chipper.queryParameters.voicingRemoveVoicingToolbar, {
tandem: options.tandem.createTandem( AUDIO_MODEL_TANDEM ).createTandem( 'toolbarEnabledProperty' ),
phetioState: false
} ),
Expand Down Expand Up @@ -358,11 +359,8 @@ export default class PreferencesModel extends PhetioObject {
!enabled && voicingUtteranceQueue.clear();
} );

// If initially enabled, then apply all responses on startup, can (and should) be overwritten by PreferencesStorage.
// If initially enabled, apply a prioritized default voice.
if ( phet.chipper.queryParameters.voicingInitiallyEnabled ) {
responseCollector.objectResponsesEnabledProperty.value = true;
responseCollector.contextResponsesEnabledProperty.value = true;
responseCollector.hintResponsesEnabledProperty.value = true;

// Set the first voice according to PhET's preferred english voices
const voicesMultilink = Multilink.multilink(
Expand All @@ -375,6 +373,12 @@ export default class PreferencesModel extends PhetioObject {
}
);
}

// Feature specific query parameters set the initial state of the voicing features. These can (and should) be
// overwritten by PreferencesStorage.
responseCollector.objectResponsesEnabledProperty.value = !!phet.chipper.queryParameters.voicingAddObjectResponses;
responseCollector.contextResponsesEnabledProperty.value = !!phet.chipper.queryParameters.voicingAddContextResponses;
responseCollector.hintResponsesEnabledProperty.value = !!phet.chipper.queryParameters.voicingAddHintResponses;
}

if ( phet.chipper.queryParameters.printVoicingResponses ) {
Expand Down
3 changes: 2 additions & 1 deletion js/toolbar/Toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class Toolbar extends Node {
fill: lookAndFeel.navigationBarFillProperty
} );

this.openProperty = new BooleanProperty( true );
// The Voicing toolbar is initially open unless explicitly collapsed because of a query parameter.
this.openProperty = new BooleanProperty( !phet.chipper.queryParameters.voicingCollapseVoicingToolbar );

this.isShowingProperty = DerivedProperty.and( [
this.isEnabledProperty,
Expand Down

0 comments on commit 28b9099

Please sign in to comment.