fix: on login, don't open two separate databases (#4449)

This commit is contained in:
ggurdin 2025-10-20 13:51:09 -04:00 committed by GitHub
parent aca36e67d5
commit 23aa75bb13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 16 deletions

View file

@ -61,24 +61,25 @@ class LoginController extends State<Login> {
// TODO: implement initState
super.initState();
loadingSignIn = true;
pangeaController.checkHomeServerAction().then((value) {
setState(() {
loadingSignIn = false;
});
pangeaController.checkHomeServerAction().then((client) {
if (mounted) {
setState(() {
loadingSignIn = false;
this.client = client;
});
}
}).catchError((e) {
final String err = e.toString();
setState(() {
loadingSignIn = false;
passwordError = err.toLocalizedString(context);
});
if (mounted) {
setState(() {
loadingSignIn = false;
passwordError = err.toLocalizedString(context);
});
}
});
usernameController.addListener(() => setState(() {}));
passwordController.addListener(() => setState(() {}));
Matrix.of(context).getLoginClient().then((client) {
if (mounted) setState(() => this.client = client);
});
}
@override

View file

@ -142,11 +142,11 @@ class PangeaController {
await Future.wait(futures);
}
Future<void> checkHomeServerAction() async {
Future<Client> checkHomeServerAction() async {
final client = await matrixState.getLoginClient();
if (client.homeserver != null) {
await Future.delayed(Duration.zero);
return;
return client;
}
final String homeServer =
@ -163,8 +163,7 @@ class PangeaController {
matrixState.loginRegistrationSupported =
e.requireAdditionalAuthentication;
}
// setState(() => error = (e).toLocalizedString(context));
return client;
}
/// check user information if not found then redirect to Date of birth page