Files
Siro/auth_flow_cleanup_report.md
2026-06-12 20:40:40 +03:00

3.5 KiB

Siro Driver App - Authentication Flow & Cleanup Report

We traced the active routing flow of the driver app starting from the main entry point to document the actual user journey and identify unused legacy files.

1. Active User Authentication Flow

graph TD
    A[main.dart] --> B[SplashScreen]
    B --> C{onboarding Done?}
    C -- No --> D[OnBoardingPage]
    C -- Yes --> E{Phone Registered?}
    E -- No --> F[LoginCaptin]
    E -- Yes --> G[Auto Login & Go to HomeCaptain]
    F --> H{Terms & Location Perms?}
    H -- No --> I[Show Agreement & Perm Pages]
    H -- Yes --> J[PhoneNumberScreen in otp_page.dart]
    J --> K[Send OTP via Nabih]
    K --> L[OtpVerificationScreen]
    L --> M{isRegistered?}
    M -- No --> N[RegistrationView]
    M -- Yes --> G

Flow Breakdown

  1. Splash & Initial Check: Starting from main.dart, the app boots into SplashScreen and queries SplashScreenController.
  2. Onboarding Check: Checks BoxName.onBoarding. If not completed, redirects to OnBoardingPage.
  3. Identity Check: If BoxName.phoneDriver is null, routes to LoginCaptin inside login_captin.dart.
  4. Permissions & Phone Screen: LoginCaptin builds and checks agreeTerms and locationPermission. Once granted, it renders the PhoneNumberScreen widget directly (which is imported from otp_page.dart).
  5. OTP Validation: Once the 3-digit SMS OTP code is verified, PhoneAuthHelper.verifyOtp determines next steps:
    • New Captain: Redirects to RegistrationView in registration_view.dart (which guides them through document capture and Gemini OCR extraction).
    • Existing Captain: Authenticates using the standard controller credentials and redirects to the HomeCaptain map/dashboard page.

2. Identified Unused Legacy Files

The following files are completely unreferenced by the driver app's active screens and routing controllers:

Unused Authentication Views

Unused Controllers