Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slider ignored #60

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,27 @@ abstract class AppRoutes {
) async {
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
final sessionToken = await _secureStorage.read(key: 'sessionToken');

final bool isLoggedKratos =
sessionToken is String && sessionToken.isNotEmpty;
final bool isLoggedMatrix = Matrix.of(context).client.isLogged();
final bool preAuth = state.fullPath!.startsWith('/home');
final String currentPath = state.uri.path;

final bool isAuthRoute = currentPath.startsWith('/home/');

if (isLoggedKratos && isLoggedMatrix) {
return '/rooms';
} else if (isLoggedKratos && !isLoggedMatrix && !preAuth) {
}

// Do not redirect if the user is on an authentication route
if (isAuthRoute) {
return null;
}

if (isLoggedKratos && !isLoggedMatrix) {
return '/home/login';
} else if (!isLoggedMatrix && !preAuth) {
}

if (!isLoggedMatrix && currentPath != '/home/welcome') {
return '/home/welcome';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/pages/welcome_slides/slides.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _WelcomeSlidePageState extends State<WelcomeSlidePage> {
child: Center(
child: ElevatedButton(
onPressed: () {
GoRouter.of(context).go('/home');
GoRouter.of(context).go('/home/register');
},
child: Text(currentIndex == slidesData.length - 1
? L10n.of(context)!.next
Expand Down
Loading