fix: don't play activity target tokens on init (#1342)
This commit is contained in:
parent
e417af93fa
commit
be7bb5dd36
2 changed files with 0 additions and 27 deletions
|
|
@ -228,11 +228,6 @@ class PracticeActivityModel {
|
|||
|
||||
String get question => content.question;
|
||||
|
||||
bool get shouldPlayTargetTokens =>
|
||||
targetTokens != null &&
|
||||
activityType != ActivityTypeEnum.hiddenWordListening &&
|
||||
activityType != ActivityTypeEnum.morphId;
|
||||
|
||||
factory PracticeActivityModel.fromJson(Map<String, dynamic> json) {
|
||||
// moving from multiple_choice to content as the key
|
||||
// this is to make the model more generic
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import 'package:fluffychat/config/app_config.dart';
|
|||
import 'package:fluffychat/pangea/choreographer/widgets/choice_array.dart';
|
||||
import 'package:fluffychat/pangea/controllers/put_analytics_controller.dart';
|
||||
import 'package:fluffychat/pangea/enum/activity_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_model.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_record_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
|
|
@ -46,35 +45,14 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
|
|||
PracticeActivityRecordModel? get currentRecordModel =>
|
||||
widget.practiceCardController.currentCompletionRecord;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
speakTargetTokens();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant MultipleChoiceActivity oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.currentActivity.hashCode != oldWidget.currentActivity.hashCode) {
|
||||
speakTargetTokens();
|
||||
setState(() => selectedChoiceIndex = null);
|
||||
}
|
||||
}
|
||||
|
||||
void speakTargetTokens() {
|
||||
if (widget.practiceCardController.currentActivity?.shouldPlayTargetTokens ??
|
||||
false) {
|
||||
tts.tryToSpeak(
|
||||
PangeaToken.reconstructText(
|
||||
widget.practiceCardController.currentActivity!.targetTokens!,
|
||||
),
|
||||
context,
|
||||
null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TtsController get tts =>
|
||||
widget.overlayController.widget.chatController.choreographer.tts;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue