From df60195d395492715ea5f0229474bae2adf24a9d Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:47:48 -0500 Subject: [PATCH] Dont play tokens on flag activity (#1145) * don't play target tokens unless the hashcode of the activity model changes * hide immersion mode --- lib/pangea/models/space_model.dart | 2 +- lib/pangea/models/user_model.dart | 6 ++---- .../practice_activity/multiple_choice_activity.dart | 13 ++----------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/pangea/models/space_model.dart b/lib/pangea/models/space_model.dart index 402ba0a149..58e4f62d8f 100644 --- a/lib/pangea/models/space_model.dart +++ b/lib/pangea/models/space_model.dart @@ -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; } diff --git a/lib/pangea/models/user_model.dart b/lib/pangea/models/user_model.dart index 50456fc3e0..f3e3531d02 100644 --- a/lib/pangea/models/user_model.dart +++ b/lib/pangea/models/user_model.dart @@ -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, ); @@ -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, diff --git a/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart b/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart index 798c64b1a9..70287f518c 100644 --- a/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart +++ b/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart @@ -53,17 +53,8 @@ class MultipleChoiceActivityState extends State { @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); } }