Update: 2026-05-06 04:02:34
This commit is contained in:
@@ -2,7 +2,10 @@ import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../features/auth/views/phone_input_view.dart';
|
||||
import '../../features/auth/views/otp_verify_view.dart';
|
||||
import '../../features/auth/views/biometric_setup_view.dart';
|
||||
import '../../features/auth/views/biometric_auth_view.dart';
|
||||
import '../../features/dashboard/views/dashboard_view.dart';
|
||||
import '../../core/storage/secure_storage.dart';
|
||||
|
||||
part 'app_routes.dart';
|
||||
|
||||
@@ -13,9 +16,16 @@ class AppPages {
|
||||
GetPage(
|
||||
name: AppRoutes.SPLASH,
|
||||
page: () {
|
||||
// Simple splash logic to navigate to login after delay
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
Get.offAllNamed(AppRoutes.PHONE_INPUT);
|
||||
// Check login state after a short delay
|
||||
Future.delayed(const Duration(seconds: 2), () async {
|
||||
final token = await SecureStorage().getToken();
|
||||
if (token != null && token.isNotEmpty) {
|
||||
// User is already logged in, request Biometric unlock before dashboard
|
||||
Get.offAllNamed(AppRoutes.BIOMETRIC_AUTH);
|
||||
} else {
|
||||
// New user, go to login
|
||||
Get.offAllNamed(AppRoutes.PHONE_INPUT);
|
||||
}
|
||||
});
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
@@ -39,6 +49,14 @@ class AppPages {
|
||||
name: AppRoutes.OTP_VERIFY,
|
||||
page: () => OtpVerifyView(),
|
||||
),
|
||||
GetPage(
|
||||
name: AppRoutes.BIOMETRIC_SETUP,
|
||||
page: () => BiometricSetupView(),
|
||||
),
|
||||
GetPage(
|
||||
name: AppRoutes.BIOMETRIC_AUTH,
|
||||
page: () => const BiometricAuthView(),
|
||||
),
|
||||
GetPage(
|
||||
name: AppRoutes.DASHBOARD,
|
||||
page: () => DashboardView(),
|
||||
|
||||
@@ -5,6 +5,7 @@ abstract class AppRoutes {
|
||||
static const PHONE_INPUT = '/phone-input';
|
||||
static const OTP_VERIFY = '/otp-verify';
|
||||
static const BIOMETRIC_SETUP = '/biometric-setup';
|
||||
static const BIOMETRIC_AUTH = '/biometric-auth';
|
||||
static const LOGIN = '/login';
|
||||
static const DASHBOARD = '/dashboard';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user