Skip to content

Commit

Permalink
TW-1711: Error handle with wrong login
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Apr 26, 2024
1 parent 6184a4f commit ee0da32
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lib/pages/auto_homeserver_picker/auto_homeserver_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,25 @@ class AutoHomeserverPickerController extends State<AutoHomeserverPicker>
);
final loginToken = getQueryParameter('loginToken');
if (loginToken != null || loginToken?.isNotEmpty == true) {
Matrix.of(context).loginType = LoginType.mLoginToken;
Matrix.of(context).loginHomeserverSummary =
await Matrix.of(context).getLoginClient().checkHomeserver(
Uri.parse(
AppConfig.homeserver,
),
);
await TwakeDialog.showFutureLoadingDialogFullScreen(
future: () => Matrix.of(context).getLoginClient().login(
LoginType.mLoginToken,
token: loginToken,
initialDeviceDisplayName: PlatformInfos.clientName,
),
);
try {
Matrix.of(context).loginType = LoginType.mLoginToken;
Matrix.of(context).loginHomeserverSummary =
await Matrix.of(context).getLoginClient().checkHomeserver(
Uri.parse(
AppConfig.homeserver,
),
);
await TwakeDialog.showFutureLoadingDialogFullScreen(
future: () => Matrix.of(context).getLoginClient().login(
LoginType.mLoginToken,
token: loginToken,
initialDeviceDisplayName: PlatformInfos.clientName,
),
);
} catch (e) {
autoHomeserverPickerUIState.value =
AutoHomeServerPickerFailureState();
}
_resetLocationPath();
return;
}
Expand Down

0 comments on commit ee0da32

Please sign in to comment.