|
|
|
@ -19,6 +19,7 @@ import 'package:neon/src/pages/login_qr_code.dart';
|
|
|
|
|
import 'package:neon/src/pages/nextcloud_app_settings.dart'; |
|
|
|
|
import 'package:neon/src/pages/route_not_found.dart'; |
|
|
|
|
import 'package:neon/src/pages/settings.dart'; |
|
|
|
|
import 'package:neon/src/platform/platform.dart'; |
|
|
|
|
import 'package:neon/src/utils/provider.dart'; |
|
|
|
|
import 'package:neon/src/utils/stream_listenable.dart'; |
|
|
|
|
|
|
|
|
@ -54,6 +55,13 @@ GoRouter buildAppRouter({
|
|
|
|
|
|
|
|
|
|
// redirect to login screen when no account is logged in |
|
|
|
|
if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) { |
|
|
|
|
final windowLocation = NeonProvider.of<NeonPlatform>(context).getWindowLocation(); |
|
|
|
|
if (windowLocation != null) { |
|
|
|
|
var uri = Uri.parse(windowLocation).removeFragment(); |
|
|
|
|
uri = uri.replace(path: uri.path.replaceFirst(RegExp(r'/$', multiLine: true), '')); |
|
|
|
|
return LoginCheckServerStatusRoute(serverUrl: uri).location; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return const LoginRoute().location; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|