additional error handling in retrieval of practice events
This commit is contained in:
parent
ac80e6217c
commit
4d2f36890f
2 changed files with 25 additions and 17 deletions
|
|
@ -587,18 +587,27 @@ class PangeaMessageEvent {
|
|||
/// Returns a list of all [PracticeActivityEvent] objects
|
||||
/// associated with this message event.
|
||||
List<PracticeActivityEvent> get _practiceActivityEvents {
|
||||
return _latestEdit
|
||||
final List<Event> events = _latestEdit
|
||||
.aggregatedEvents(
|
||||
timeline,
|
||||
PangeaEventTypes.pangeaActivity,
|
||||
)
|
||||
.map(
|
||||
(e) => PracticeActivityEvent(
|
||||
timeline: timeline,
|
||||
event: e,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
final List<PracticeActivityEvent> practiceEvents = [];
|
||||
for (final event in events) {
|
||||
try {
|
||||
practiceEvents.add(
|
||||
PracticeActivityEvent(
|
||||
timeline: timeline,
|
||||
event: event,
|
||||
),
|
||||
);
|
||||
} catch (e, s) {
|
||||
ErrorHandler.logError(e: e, s: s, data: event.toJson());
|
||||
}
|
||||
}
|
||||
return practiceEvents;
|
||||
}
|
||||
|
||||
/// Returns a boolean value indicating whether there are any
|
||||
|
|
@ -617,7 +626,6 @@ class PangeaMessageEvent {
|
|||
String langCode, {
|
||||
bool debug = false,
|
||||
}) {
|
||||
// @wcjord - disabled try catch for testing
|
||||
try {
|
||||
debugger(when: debug);
|
||||
final List<PracticeActivityEvent> activities = [];
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@ class WordAudioButtonState extends State<WordAudioButton> {
|
|||
onPressed: () async {
|
||||
if (_isPlaying) {
|
||||
await ttsController.tts.stop();
|
||||
setState(() {
|
||||
_isPlaying = false;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() => _isPlaying = false);
|
||||
}
|
||||
} else {
|
||||
setState(() {
|
||||
_isPlaying = true;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() => _isPlaying = true);
|
||||
}
|
||||
await ttsController.speak(widget.text);
|
||||
setState(() {
|
||||
_isPlaying = false;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() => _isPlaying = false);
|
||||
}
|
||||
}
|
||||
}, // Disable button if language isn't supported
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue