Skip to content

Commit

Permalink
Dont play tokens on flag activity (#1145)
Browse files Browse the repository at this point in the history
* don't play target tokens unless the hashcode of the activity model changes

* hide immersion mode
  • Loading branch information
ggurdin authored Dec 4, 2024
1 parent a59a673 commit df60195
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/pangea/models/space_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ extension SettingCopy on ToolSetting {
case ToolSetting.interactiveTranslator:
case ToolSetting.interactiveGrammar:
case ToolSetting.definitions:
return false;
case ToolSetting.immersionMode:
return false;
case ToolSetting.autoIGC:
return true;
}
Expand Down
6 changes: 2 additions & 4 deletions lib/pangea/models/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class UserToolSettings {
json[ToolSetting.interactiveTranslator.toString()] ?? true,
interactiveGrammar:
json[ToolSetting.interactiveGrammar.toString()] ?? true,
immersionMode: json[ToolSetting.immersionMode.toString()] ?? false,
immersionMode: false,
definitions: json[ToolSetting.definitions.toString()] ?? true,
autoIGC: json[ToolSetting.autoIGC.toString()] ?? true,
);
Expand Down Expand Up @@ -170,9 +170,7 @@ class UserToolSettings {
?.content[ToolSetting.interactiveGrammar.toString()]
as bool?) ??
true,
immersionMode: (accountData[ToolSetting.immersionMode.toString()]
?.content[ToolSetting.immersionMode.toString()] as bool?) ??
false,
immersionMode: false,
definitions: (accountData[ToolSetting.definitions.toString()]
?.content[ToolSetting.definitions.toString()] as bool?) ??
true,
Expand Down
13 changes: 2 additions & 11 deletions lib/pangea/widgets/practice_activity/multiple_choice_activity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,8 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
@override
void didUpdateWidget(covariant MultipleChoiceActivity oldWidget) {
super.didUpdateWidget(oldWidget);
if (currentRecordModel?.responses.isEmpty ?? false) {
// This gets triggered when the activity switches and when the activity is
// flagged. Only want to speak the target tokens when the activity switches.
final activityEventFuture =
widget.practiceCardController.currentActivityCompleter?.future;

activityEventFuture?.then((event) {
final redacted = event?.event.redacted ?? false;
if (mounted && !redacted) speakTargetTokens();
});

if (widget.currentActivity.hashCode != oldWidget.currentActivity.hashCode) {
speakTargetTokens();
setState(() => selectedChoiceIndex = null);
}
}
Expand Down

0 comments on commit df60195

Please sign in to comment.