diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index cf6842c1c..98ee3a8d7 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -4660,5 +4660,6 @@ "publicProfileDesc": "By enabling this option, I confirm that I am of legal age in my country of residence", "clickWordsInstructions": "Click on individual words for more activities.", "chooseBestDefinition": "Choose the best definition", - "chooseBaseForm": "Choose the base form" + "chooseBaseForm": "Choose the base form", + "notTheCodeError": "Sorry, that's not the code!" } diff --git a/lib/pangea/controllers/class_controller.dart b/lib/pangea/controllers/class_controller.dart index 3ba4c112d..89d5f077f 100644 --- a/lib/pangea/controllers/class_controller.dart +++ b/lib/pangea/controllers/class_controller.dart @@ -68,7 +68,11 @@ class ClassController extends BaseController { } } - Future joinClasswithCode(BuildContext context, String classCode) async { + Future joinClasswithCode( + BuildContext context, + String classCode, { + String? notFoundError, + }) async { final client = Matrix.of(context).client; final space = await showFutureLoadingDialog( context: context, @@ -88,7 +92,7 @@ class ClassController extends BaseController { throw L10n.of(context).tooManyRequest; } if (knockResponse.statusCode != 200) { - throw L10n.of(context).unableToFindClass; + throw notFoundError ?? L10n.of(context).unableToFindClass; } final knockResult = jsonDecode(knockResponse.body); @@ -106,7 +110,7 @@ class ClassController extends BaseController { } if (foundClasses.isEmpty) { - throw L10n.of(context).unableToFindClass; + throw notFoundError ?? L10n.of(context).unableToFindClass; } final chosenClassId = foundClasses.first; diff --git a/lib/widgets/public_room_bottom_sheet.dart b/lib/widgets/public_room_bottom_sheet.dart index adee798e1..9c4bf4946 100644 --- a/lib/widgets/public_room_bottom_sheet.dart +++ b/lib/widgets/public_room_bottom_sheet.dart @@ -54,6 +54,7 @@ class PublicRoomBottomSheetState extends State { await MatrixState.pangeaController.classController.joinClasswithCode( context, _codeController.text, + notFoundError: L10n.of(context).notTheCodeError, ); }