don't play target tokens on practice activity init if it's a hidden word activity (#1121)

This commit is contained in:
ggurdin 2024-12-02 09:47:06 -05:00 committed by GitHub
parent 78cb3afe0b
commit ceea63b3a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -222,6 +222,10 @@ class PracticeActivityModel {
String get question => content.question;
bool get shouldPlayTargetTokens =>
targetTokens != null &&
activityType != ActivityTypeEnum.hiddenWordListening;
factory PracticeActivityModel.fromJson(Map<String, dynamic> json) {
// moving from multiple_choice to content as the key
// this is to make the model more generic

View file

@ -63,7 +63,8 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
}
void speakTargetTokens() {
if (widget.practiceCardController.currentActivity?.targetTokens != null) {
if (widget.practiceCardController.currentActivity?.shouldPlayTargetTokens ??
false) {
widget.practiceCardController.tts.tryToSpeak(
PangeaToken.reconstructText(
widget.practiceCardController.currentActivity!.targetTokens!,