fix: on login, don't open two separate databases (#4449)
This commit is contained in:
parent
aca36e67d5
commit
23aa75bb13
2 changed files with 16 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue