mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Fix issue when WebSocket is closed
This commit is contained in:
		@@ -36,7 +36,10 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
 | 
			
		||||
    super.listen<InvalidLoginTokensEvent>((ev) => _openLoginPage());
 | 
			
		||||
 | 
			
		||||
    // Listen to WebSocket close event
 | 
			
		||||
    super.listen<WSClosedEvent>((e) => _tryConnect());
 | 
			
		||||
    super.listen<WSClosedEvent>((e) {
 | 
			
		||||
      _popToMainRoute();
 | 
			
		||||
      _tryConnect();
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
@@ -65,9 +68,7 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
 | 
			
		||||
      print("Could not connect to server! $e");
 | 
			
		||||
      print(stack);
 | 
			
		||||
 | 
			
		||||
      // Pop until we reach main route
 | 
			
		||||
      Navigator.of(context).popUntil((settings) =>
 | 
			
		||||
          ModalRoute.of(context).isCurrent || !ModalRoute.of(context).isActive);
 | 
			
		||||
      _popToMainRoute();
 | 
			
		||||
 | 
			
		||||
      setState(() {
 | 
			
		||||
        _error = true;
 | 
			
		||||
@@ -138,4 +139,10 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
 | 
			
		||||
      ],
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void _popToMainRoute() {
 | 
			
		||||
    // Pop until we reach main route
 | 
			
		||||
    Navigator.of(context).popUntil((settings) =>
 | 
			
		||||
        ModalRoute.of(context).isCurrent || !ModalRoute.of(context).isActive);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user