diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 752292540..d2239141f 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -881,7 +881,11 @@ class ChatController extends State 'waveform': result.waveform, }, }, - ).catchError((e) { + // #Pangea + // ).catchError((e) { + ).catchError((e, s) { + ErrorHandler.logError(e: e, s: s); + // Pangea# scaffoldMessenger.showSnackBar( SnackBar( content: Text( @@ -891,9 +895,12 @@ class ChatController extends State ); return null; }); - setState(() { - replyEvent = null; - }); + // #Pangea + // setState(() { + // replyEvent = null; + // }); + if (mounted) setState(() => replyEvent = null); + // Pangea# } void hideEmojiPicker() { diff --git a/lib/pangea/models/practice_activities.dart/practice_activity_model.dart b/lib/pangea/models/practice_activities.dart/practice_activity_model.dart index 13e55ae46..6e0971584 100644 --- a/lib/pangea/models/practice_activities.dart/practice_activity_model.dart +++ b/lib/pangea/models/practice_activities.dart/practice_activity_model.dart @@ -31,12 +31,20 @@ class ConstructIdentifier { } } + final type = ConstructTypeEnum.values.firstWhereOrNull( + (e) => e.string == json['type'], + ); + + if (type == null) { + Sentry.addBreadcrumb(Breadcrumb(message: "type is: ${json['type']}")); + Sentry.addBreadcrumb(Breadcrumb.fromJson(json)); + throw Exception("Matching construct type not found"); + } + try { return ConstructIdentifier( lemma: json['lemma'] as String, - type: ConstructTypeEnum.values.firstWhere( - (e) => e.string == json['type'], - ), + type: type, category: category ?? "", ); } catch (e, s) { @@ -138,7 +146,7 @@ class PracticeActivityRequest { factory PracticeActivityRequest.fromJson(Map json) { return PracticeActivityRequest( - mode: PracticeActivityMode.values.firstWhere( + mode: PracticeActivityMode.values.firstWhereOrNull( (e) => e.value == json['mode'], ), targetConstructs: (json['target_constructs'] as List?) @@ -148,7 +156,7 @@ class PracticeActivityRequest { .map((e) => CandidateMessage.fromJson(e as Map)) .toList(), userIds: (json['user_ids'] as List?)?.map((e) => e as String).toList(), - activityType: ActivityTypeEnum.values.firstWhere( + activityType: ActivityTypeEnum.values.firstWhereOrNull( (e) => e.toString().split('.').last == json['activity_type'], ), numActivities: json['num_activities'] as int,