fix: Dont rerun server checks

onboarding
Krille Fear 4 years ago
parent 377a8ffd1c
commit 03f0641385

@ -103,13 +103,15 @@ class HomeserverPickerController extends State<HomeserverPicker> {
_intentDataStreamSubscription?.cancel();
}
String _lastCheckedHomeserver;
/// Starts an analysis of the given homeserver. It uses the current domain and
/// makes sure that it is prefixed with https. Then it searches for the
/// well-known information and forwards to the login page depending on the
/// login type.
Future<void> checkHomeserverAction() async {
_coolDown?.cancel();
try {
if (_lastCheckedHomeserver == domain) return;
if (domain.isEmpty) throw L10n.of(context).changeTheHomeserver;
var homeserver = domain;
@ -121,6 +123,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
error = _rawLoginTypes = registrationSupported = null;
isLoading = true;
});
try {
final wellKnown =
await Matrix.of(context).getLoginClient().checkHomeserver(homeserver);
@ -151,6 +155,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
} catch (e) {
setState(() => error = (e as Object).toLocalizedString(context));
} finally {
_lastCheckedHomeserver = domain;
if (mounted) {
setState(() => isLoading = false);
}

Loading…
Cancel
Save