fix: show different error message when space code not found in public room bottom sheet (#1359)
This commit is contained in:
parent
f1c89a4f9a
commit
3fe673160e
3 changed files with 10 additions and 4 deletions
|
|
@ -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!"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,11 @@ class ClassController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> joinClasswithCode(BuildContext context, String classCode) async {
|
||||
Future<void> joinClasswithCode(
|
||||
BuildContext context,
|
||||
String classCode, {
|
||||
String? notFoundError,
|
||||
}) async {
|
||||
final client = Matrix.of(context).client;
|
||||
final space = await showFutureLoadingDialog<Room?>(
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class PublicRoomBottomSheetState extends State<PublicRoomBottomSheet> {
|
|||
await MatrixState.pangeaController.classController.joinClasswithCode(
|
||||
context,
|
||||
_codeController.text,
|
||||
notFoundError: L10n.of(context).notTheCodeError,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue