mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-03 22:07:23 +01:00 
			
		
		
		
	fix: Allow fallback to previous url if there is no homeserver on the mxid domain
This commit is contained in:
		
							parent
							
								
									7f66fc733f
								
							
						
					
					
						commit
						eabb548215
					
				@ -1351,6 +1351,14 @@
 | 
			
		||||
    "type": "text",
 | 
			
		||||
    "placeholders": {}
 | 
			
		||||
  },
 | 
			
		||||
  "noMatrixServer": "{server1} is no matrix server, use {server2} instead?",
 | 
			
		||||
  "@noMatrixServer": {
 | 
			
		||||
    "type": "text",
 | 
			
		||||
    "placeholders": {
 | 
			
		||||
      "server1": {},
 | 
			
		||||
      "server2": {}
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "noMegolmBootstrap": "Please turn on online key backup from within Element instead.",
 | 
			
		||||
  "@noMegolmBootstrap": {
 | 
			
		||||
    "type": "text",
 | 
			
		||||
 | 
			
		||||
@ -117,10 +117,33 @@ class LoginController extends State<Login> {
 | 
			
		||||
              .setItem(SettingKeys.jitsiInstance, jitsi);
 | 
			
		||||
          AppConfig.jitsiInstance = jitsi;
 | 
			
		||||
        }
 | 
			
		||||
        final oldHomeserver = Matrix.of(context).client.homeserver;
 | 
			
		||||
        await showFutureLoadingDialog(
 | 
			
		||||
          context: context,
 | 
			
		||||
          future: () => Matrix.of(context).client.checkHomeserver(newDomain),
 | 
			
		||||
          // do nothing if we error, we'll handle it below
 | 
			
		||||
          future: () => Matrix.of(context)
 | 
			
		||||
              .client
 | 
			
		||||
              .checkHomeserver(newDomain)
 | 
			
		||||
              .catchError((e) => null),
 | 
			
		||||
        );
 | 
			
		||||
        if (Matrix.of(context).client.homeserver == null) {
 | 
			
		||||
          Matrix.of(context).client.homeserver = oldHomeserver;
 | 
			
		||||
          // okay, the server we checked does not appear to be a matrix server
 | 
			
		||||
          Logs().v(
 | 
			
		||||
              '$newDomain is not running a homeserver, asking to use $oldHomeserver');
 | 
			
		||||
          final dialogResult = await showOkCancelAlertDialog(
 | 
			
		||||
            context: context,
 | 
			
		||||
            useRootNavigator: false,
 | 
			
		||||
            message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver),
 | 
			
		||||
            okLabel: L10n.of(context).ok,
 | 
			
		||||
            cancelLabel: L10n.of(context).cancel,
 | 
			
		||||
          );
 | 
			
		||||
          if (dialogResult == OkCancelResult.ok) {
 | 
			
		||||
            setState(() => usernameError = null);
 | 
			
		||||
          } else {
 | 
			
		||||
            Navigator.of(context, rootNavigator: false).pop();
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        setState(() => usernameError = null);
 | 
			
		||||
      }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user