Feature/navigation system #46
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



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
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
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
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)