mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
Merge branch 'soru/login-no-server' into 'main'
fix: Allow fallback to previous url if there is no homeserver on the mxid domain See merge request famedly/fluffychat!477
This commit is contained in:
commit
3905baa964
@ -1351,6 +1351,14 @@
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noMatrixServer": "{server1} is no matrix server, use {server2} instead?",
|
||||
"@noMatrixServer": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"server1": {},
|
||||
"server2": {}
|
||||
}
|
||||
},
|
||||
"noMegolmBootstrap": "Please turn on online key backup from within Element instead.",
|
||||
"@noMegolmBootstrap": {
|
||||
"type": "text",
|
||||
|
@ -117,10 +117,33 @@ class LoginController extends State<Login> {
|
||||
.setItem(SettingKeys.jitsiInstance, jitsi);
|
||||
AppConfig.jitsiInstance = jitsi;
|
||||
}
|
||||
final oldHomeserver = Matrix.of(context).client.homeserver;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.checkHomeserver(newDomain),
|
||||
// do nothing if we error, we'll handle it below
|
||||
future: () => Matrix.of(context)
|
||||
.client
|
||||
.checkHomeserver(newDomain)
|
||||
.catchError((e) => null),
|
||||
);
|
||||
if (Matrix.of(context).client.homeserver == null) {
|
||||
Matrix.of(context).client.homeserver = oldHomeserver;
|
||||
// okay, the server we checked does not appear to be a matrix server
|
||||
Logs().v(
|
||||
'$newDomain is not running a homeserver, asking to use $oldHomeserver');
|
||||
final dialogResult = await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver),
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
);
|
||||
if (dialogResult == OkCancelResult.ok) {
|
||||
setState(() => usernameError = null);
|
||||
} else {
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
}
|
||||
}
|
||||
setState(() => usernameError = null);
|
||||
}
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user