Skip to content

Conversation

@AmrAshraf-git
Copy link
Collaborator

Summary
This PR implements the complete type-safe navigation system for Crafto app and fixes critical issues in the authentication and setup flow. It establishes a clean architecture foundation by moving domain entities to the correct layer and introducing session management use cases.

What's Changed

  1. Created Session Management Use Cases

    GetUserSessionUseCase - Retrieve complete user session
    SaveUserTypeUseCase - Save selected user type
    MarkOnboardingCompleteUseCase - Mark onboarding as seen
    ClearUserSessionUseCase - Clear session on logout

  2. Navigation System

  • Implemented Type-Safe Navigation
    Created Destination.kt with @serializable sealed interfaces
    Organized routes by feature (Auth, Setup, BottomNav, Details)
    Bottom navigation with user-type awareness (Customer vs Craftsman)
    Proper back stack management with popUpTo, launchSingleTop

  • Navigation Structure
    presentation/navigation/
    ├── Destination.kt # All route definitions
    ├── BottomNavBar.kt # Bottom nav configuration
    ├── CraftoNavGraph.kt # Main navigation host
    └── routes/
    ├── AuthRoutes.kt # Onboarding, OTP, UserType
    ├── SetupRoutes.kt # Craftsman/Customer setup
    ├── BottomNavRoutes.kt # Home, Requests, Jobs, Messages, More
    └── DetailRoutes.kt # Detail screens

  1. User Type Selection Screen
  • Separated from Setup Flow
    Before: User type selection was step 1 of 5 in setup
    After: Standalone screen before setup (cleaner UX)

  • New Components
    UserTypeSelectionScreen.kt - Full-screen component
    UserTypeSelectionViewModel.kt - State management
    UserTypeSelectionUiState.kt - UI state
    Uses existing UserTypeSelectionPage composable (reused from setup)

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants