pass up audio card error to practice activity card
This commit is contained in:
parent
d227202d58
commit
e3416c967f
3 changed files with 11 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ class MessageAudioCard extends StatefulWidget {
|
|||
final PangeaTokenText? selection;
|
||||
final TtsController tts;
|
||||
final Function(bool) setIsPlayingAudio;
|
||||
final VoidCallback? onError;
|
||||
|
||||
const MessageAudioCard({
|
||||
super.key,
|
||||
|
|
@ -30,6 +31,7 @@ class MessageAudioCard extends StatefulWidget {
|
|||
required this.tts,
|
||||
required this.setIsPlayingAudio,
|
||||
this.selection,
|
||||
this.onError,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -163,6 +165,7 @@ class MessageAudioCardState extends State<MessageAudioCard> {
|
|||
if (mounted) setState(() => _isLoading = false);
|
||||
} catch (e, s) {
|
||||
debugger(when: kDebugMode);
|
||||
widget.onError?.call();
|
||||
debugPrint(StackTrace.current.toString());
|
||||
if (!mounted) return;
|
||||
setState(() => _isLoading = false);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class MultipleChoiceActivity extends StatefulWidget {
|
|||
final PracticeActivityModel currentActivity;
|
||||
final TtsController tts;
|
||||
final String eventID;
|
||||
final VoidCallback? onError;
|
||||
|
||||
const MultipleChoiceActivity({
|
||||
super.key,
|
||||
|
|
@ -29,6 +30,7 @@ class MultipleChoiceActivity extends StatefulWidget {
|
|||
required this.currentActivity,
|
||||
required this.tts,
|
||||
required this.eventID,
|
||||
this.onError,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -143,6 +145,7 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
|
|||
tts: widget.practiceCardController.widget.overlayController.tts,
|
||||
setIsPlayingAudio: widget.practiceCardController.widget
|
||||
.overlayController.setIsPlayingAudio,
|
||||
onError: widget.onError,
|
||||
),
|
||||
ChoicesArray(
|
||||
isLoading: false,
|
||||
|
|
|
|||
|
|
@ -306,6 +306,10 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
}
|
||||
}
|
||||
|
||||
void _onDownstreamError() {
|
||||
_setPracticeActivity(null);
|
||||
}
|
||||
|
||||
/// clear the current activity, record, and selection
|
||||
/// fetch a new activity, including the offending activity in the request
|
||||
Future<void> submitFeedback(String feedback) async {
|
||||
|
|
@ -373,6 +377,7 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
currentActivity: currentActivity!,
|
||||
tts: widget.ttsController,
|
||||
eventID: widget.pangeaMessageEvent.eventId,
|
||||
onError: _onDownstreamError,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue