pass up audio card error to practice activity card

pull/1490/head
ggurdin 1 year ago
parent d227202d58
commit e3416c967f
No known key found for this signature in database
GPG Key ID: A01CB41737CBB478

@ -22,6 +22,7 @@ class MessageAudioCard extends StatefulWidget {
final PangeaTokenText? selection; final PangeaTokenText? selection;
final TtsController tts; final TtsController tts;
final Function(bool) setIsPlayingAudio; final Function(bool) setIsPlayingAudio;
final VoidCallback? onError;
const MessageAudioCard({ const MessageAudioCard({
super.key, super.key,
@ -30,6 +31,7 @@ class MessageAudioCard extends StatefulWidget {
required this.tts, required this.tts,
required this.setIsPlayingAudio, required this.setIsPlayingAudio,
this.selection, this.selection,
this.onError,
}); });
@override @override
@ -163,6 +165,7 @@ class MessageAudioCardState extends State<MessageAudioCard> {
if (mounted) setState(() => _isLoading = false); if (mounted) setState(() => _isLoading = false);
} catch (e, s) { } catch (e, s) {
debugger(when: kDebugMode); debugger(when: kDebugMode);
widget.onError?.call();
debugPrint(StackTrace.current.toString()); debugPrint(StackTrace.current.toString());
if (!mounted) return; if (!mounted) return;
setState(() => _isLoading = false); setState(() => _isLoading = false);

@ -22,6 +22,7 @@ class MultipleChoiceActivity extends StatefulWidget {
final PracticeActivityModel currentActivity; final PracticeActivityModel currentActivity;
final TtsController tts; final TtsController tts;
final String eventID; final String eventID;
final VoidCallback? onError;
const MultipleChoiceActivity({ const MultipleChoiceActivity({
super.key, super.key,
@ -29,6 +30,7 @@ class MultipleChoiceActivity extends StatefulWidget {
required this.currentActivity, required this.currentActivity,
required this.tts, required this.tts,
required this.eventID, required this.eventID,
this.onError,
}); });
@override @override
@ -143,6 +145,7 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
tts: widget.practiceCardController.widget.overlayController.tts, tts: widget.practiceCardController.widget.overlayController.tts,
setIsPlayingAudio: widget.practiceCardController.widget setIsPlayingAudio: widget.practiceCardController.widget
.overlayController.setIsPlayingAudio, .overlayController.setIsPlayingAudio,
onError: widget.onError,
), ),
ChoicesArray( ChoicesArray(
isLoading: false, isLoading: false,

@ -306,6 +306,10 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
} }
} }
void _onDownstreamError() {
_setPracticeActivity(null);
}
/// clear the current activity, record, and selection /// clear the current activity, record, and selection
/// fetch a new activity, including the offending activity in the request /// fetch a new activity, including the offending activity in the request
Future<void> submitFeedback(String feedback) async { Future<void> submitFeedback(String feedback) async {
@ -373,6 +377,7 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
currentActivity: currentActivity!, currentActivity: currentActivity!,
tts: widget.ttsController, tts: widget.ttsController,
eventID: widget.pangeaMessageEvent.eventId, eventID: widget.pangeaMessageEvent.eventId,
onError: _onDownstreamError,
); );
} }
} }

Loading…
Cancel
Save