Merge prod into main (#2867)

* chore: fully update match info after auto-accepting replacement, add more error handling in construct token span

* bump version

* fix: don't stop activity language on fail to fetch image URL

* fix: don't show copy class code buttons into class code is null

* fix: use activity type enum name in key instead of string

* chore: fully update match info after auto-accepting replacement, add … (#2866)

* chore: fully update match info after auto-accepting replacement, add more error handling in construct token span

* bump version

* fix: don't stop activity language on fail to fetch image URL

* fix: don't show copy class code buttons into class code is null

* fix: use activity type enum name in key instead of string
This commit is contained in:
ggurdin 2025-05-22 13:02:57 -04:00 committed by GitHub
parent ddc60b0a4f
commit 97876e5918
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 25 deletions

View file

@ -15,25 +15,6 @@ enum ActivityTypeEnum {
}
extension ActivityTypeExtension on ActivityTypeEnum {
String get string {
switch (this) {
case ActivityTypeEnum.wordMeaning:
return 'word_meaning';
case ActivityTypeEnum.wordFocusListening:
return 'word_focus_listening';
case ActivityTypeEnum.hiddenWordListening:
return 'hidden_word_listening';
case ActivityTypeEnum.lemmaId:
return 'lemma_id';
case ActivityTypeEnum.emoji:
return 'emoji';
case ActivityTypeEnum.morphId:
return 'morph_id';
case ActivityTypeEnum.messageMeaning:
return 'message_meaning'; // TODO: Add to L10n
}
}
bool get hiddenType {
switch (this) {
case ActivityTypeEnum.wordMeaning:

View file

@ -83,7 +83,7 @@ class MessageActivityRequest {
'message_tokens': messageTokens.map((e) => e.toJson()).toList(),
'activity_quality_feedback': activityQualityFeedback?.toJson(),
'target_tokens': targetTokens.map((e) => e.toJson()).toList(),
'target_type': targetType.string,
'target_type': targetType.name,
'target_morph_feature': targetMorphFeature,
};
}

View file

@ -326,7 +326,7 @@ class PracticeActivityModel {
Map<String, dynamic> toJson() {
return {
'lang_code': langCode,
'activity_type': activityType.string,
'activity_type': activityType.name,
'content': multipleChoiceContent?.toJson(),
'target_tokens': targetTokens.map((e) => e.toJson()).toList(),
'match_content': matchContent?.toJson(),

View file

@ -2,6 +2,8 @@ import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:collection/collection.dart';
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
import 'package:fluffychat/pangea/constructs/construct_identifier.dart';
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
@ -60,13 +62,22 @@ class PracticeTarget {
userL2.hashCode;
static PracticeTarget fromJson(Map<String, dynamic> json) {
final type = ActivityTypeEnum.values.firstWhereOrNull(
(v) => json['activityType'] == v.name,
);
if (type == null) {
throw Exception(
"ActivityTypeEnum ${json['activityType']} not found in enum",
);
}
return PracticeTarget(
tokens:
(json['tokens'] as List).map((e) => PangeaToken.fromJson(e)).toList(),
activityType: ActivityTypeEnum.values[json['activityType']],
activityType: type,
morphFeature: json['morphFeature'] == null
? null
: MorphFeaturesEnum.values[json['morphFeature']],
: MorphFeaturesEnumExtension.fromString(json['morphFeature']),
userL2: json['userL2'],
);
}
@ -83,7 +94,7 @@ class PracticeTarget {
//unique condensed deterministic key for local storage
String get storageKey {
return tokens.map((e) => e.text.content).join() +
activityType.string +
activityType.name +
(morphFeature?.name ?? "");
}

View file

@ -6,7 +6,7 @@ description: Learn a language while texting your friends.
# Pangea#
publish_to: none
# On version bump also increase the build number for F-Droid
version: 4.1.10+1
version: 4.1.10+2
environment:
sdk: ">=3.0.0 <4.0.0"