chore: follow up of web sso fix

This commit is contained in:
Christian Pauly 2021-06-18 16:15:11 +02:00
parent 92e4b50955
commit cb84e82365
3 changed files with 11 additions and 5 deletions

View File

@ -198,7 +198,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
ssoHomeserverKey, Matrix.of(context).client.homeserver.toString());
}
final redirectUrl = kIsWeb
? AppConfig.webBaseUrl
? AppConfig.webBaseUrl + '/#/'
: AppConfig.appOpenUrlScheme.toLowerCase() + '://login';
launch(
'${Matrix.of(context).client.homeserver?.toString()}/_matrix/client/r0/login/sso/redirect/${Uri.encodeComponent(id)}?redirectUrl=${Uri.encodeQueryComponent(redirectUrl)}',

View File

@ -7,10 +7,14 @@ class LoadingView extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (Matrix.of(context).loginState != null) {
WidgetsBinding.instance.addPostFrameCallback((_) => context.vRouter.push(
WidgetsBinding.instance.addPostFrameCallback(
(_) => context.vRouter.push(
Matrix.of(context).loginState == LoginState.logged
? '/rooms'
: '/home'));
: '/home',
queryParameters: VRouter.of(context).queryParameters,
),
);
}
return Scaffold(body: Center(child: CircularProgressIndicator()));
}

View File

@ -330,8 +330,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
.contains(widget.router.currentState.url);
if (widget.router.currentState.url == '/' ||
(state == LoginState.logged) == isInLoginRoutes) {
widget.router.currentState
.push(loginState == LoginState.logged ? '/rooms' : '/home');
widget.router.currentState.push(
loginState == LoginState.logged ? '/rooms' : '/home',
queryParameters: widget.router.currentState.queryParameters,
);
}
}
});