mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-04 06:17:26 +01:00 
			
		
		
		
	fix: SSO on web
This commit is contained in:
		
							parent
							
								
									22674e6e3c
								
							
						
					
					
						commit
						30d4bc5c49
					
				@ -57,14 +57,23 @@ void main() async {
 | 
			
		||||
    BackgroundPush.clientOnly(client);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  final queryParameters = <String, String>{};
 | 
			
		||||
  if (kIsWeb) {
 | 
			
		||||
    queryParameters
 | 
			
		||||
        .addAll(Uri.parse(html.window.location.href).queryParameters);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  runZonedGuarded(
 | 
			
		||||
    () => runApp(PlatformInfos.isMobile
 | 
			
		||||
        ? AppLock(
 | 
			
		||||
            builder: (args) => FluffyChatApp(client: client),
 | 
			
		||||
            builder: (args) => FluffyChatApp(
 | 
			
		||||
              client: client,
 | 
			
		||||
              queryParameters: queryParameters,
 | 
			
		||||
            ),
 | 
			
		||||
            lockScreen: LockScreen(),
 | 
			
		||||
            enabled: false,
 | 
			
		||||
          )
 | 
			
		||||
        : FluffyChatApp(client: client)),
 | 
			
		||||
        : FluffyChatApp(client: client, queryParameters: queryParameters)),
 | 
			
		||||
    SentryController.captureException,
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
@ -72,8 +81,10 @@ void main() async {
 | 
			
		||||
class FluffyChatApp extends StatefulWidget {
 | 
			
		||||
  final Widget testWidget;
 | 
			
		||||
  final Client client;
 | 
			
		||||
  final Map<String, String> queryParameters;
 | 
			
		||||
 | 
			
		||||
  const FluffyChatApp({Key key, this.testWidget, @required this.client})
 | 
			
		||||
  const FluffyChatApp(
 | 
			
		||||
      {Key key, this.testWidget, @required this.client, this.queryParameters})
 | 
			
		||||
      : super(key: key);
 | 
			
		||||
 | 
			
		||||
  /// getInitialLink may rereturn the value multiple times if this view is
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,6 @@ import 'package:vrouter/vrouter.dart';
 | 
			
		||||
import 'package:fluffychat/utils/platform_infos.dart';
 | 
			
		||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
 | 
			
		||||
import 'package:uni_links/uni_links.dart';
 | 
			
		||||
import 'package:universal_html/html.dart' as html;
 | 
			
		||||
 | 
			
		||||
import '../main.dart';
 | 
			
		||||
 | 
			
		||||
@ -85,9 +84,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
 | 
			
		||||
    _initReceiveUri();
 | 
			
		||||
    if (kIsWeb) {
 | 
			
		||||
      WidgetsBinding.instance.addPostFrameCallback((_) {
 | 
			
		||||
        final token =
 | 
			
		||||
            Uri.parse(html.window.location.href).queryParameters['loginToken'];
 | 
			
		||||
        _loginWithToken(token);
 | 
			
		||||
        final token = Matrix.of(context).widget.queryParameters['loginToken'];
 | 
			
		||||
        if (token != null) _loginWithToken(token);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -37,11 +37,14 @@ class Matrix extends StatefulWidget {
 | 
			
		||||
 | 
			
		||||
  final Client client;
 | 
			
		||||
 | 
			
		||||
  final Map<String, String> queryParameters;
 | 
			
		||||
 | 
			
		||||
  Matrix({
 | 
			
		||||
    this.child,
 | 
			
		||||
    @required this.router,
 | 
			
		||||
    @required this.context,
 | 
			
		||||
    @required this.client,
 | 
			
		||||
    this.queryParameters,
 | 
			
		||||
    Key key,
 | 
			
		||||
  }) : super(key: key);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user