feat: Add On boarding Empty Screens
https://mifosforge.jira.com/browse/KMPPT-88
https://github.com/user-attachments/assets/92342d82-2837-4b10-bbad-54a2e3d904f4
A new onboarding feature module is introduced with DI integration, navigation routing, multi-page UI screens, state management via ViewModel, and persistence layer. Default user data is updated to mark first-time users. Build configuration and module inclusions are updated accordingly. 🎯 4 (Complex) | ⏱️ ~50 minutes 🐰 Hop, hop, hooray! A new onboarding path,📝 Walkthrough
Walkthrough
Changes
Cohort / File(s)
Summary
Build & Configuration
cmp-navigation/build.gradle.kts, feature/onboarding/build.gradle.kts, settings.gradle.kts, gradle/libs.versions.tomlAdded onboarding feature module dependency and Gradle module inclusion; defined new build script for onboarding with Compose and core dependencies; added espressoCore 3.7.0 and material 1.13.0 library versions.
Dependency Injection
cmp-navigation/src/commonMain/kotlin/cmp/navigation/di/KoinModules.kt, feature/onboarding/src/commonMain/kotlin/org/mifos/feature/onboarding/OnBoardingModule.ktRegistered OnboardingModule in root feature module includes; created new Koin DI module that wires OnboardingViewmodel into the dependency graph.
Navigation
cmp-navigation/src/commonMain/kotlin/cmp/navigation/rootnav/RootNavScreen.kt, feature/onboarding/src/commonMain/kotlin/org/mifos/feature/onboarding/OnBoardingRoute.ktActivated onboarding destination in root NavHost and routing decision logic; introduced OnBoardingRoute, navigateToOnBoarding() extension, and onboardingDestination() builder for navigation graph.
UI Components
feature/onboarding/src/commonMain/kotlin/org/mifos/feature/onboarding/OnBoardingScreen.kt, feature/onboarding/src/commonMain/kotlin/org/mifos/feature/onboarding/components/OnBoardingScreenPage.ktCreated OnboardingScreen composable with multi-page display logic (2 pages); added OnBoardingScreenPage and OnboardingTextBlock components with pagination dots and next-button controls.
State Management
feature/onboarding/src/commonMain/kotlin/org/mifos/feature/onboarding/OnboardingViewmodel.ktIntroduced OnboardingViewmodel with currentPage StateFlow, onNextPage() handler advancing through pages, and updateOnboardingStatus() coroutine that persists first-time user state via UserPreferencesRepository.
Model
core/model/src/commonMain/kotlin/org/mifos/core/model/UserData.ktUpdated UserData.DEFAULT to initialize firstTimeUser to true.
Version Control
feature/onboarding/.gitignoreAdded /build path to ignore list.
Sequence Diagram
sequenceDiagram
participant User
participant NavController
participant RootNav as Root Navigation
participant Screen as OnboardingScreen
participant ViewModel as OnboardingViewmodel
participant Repository as UserPreferencesRepository
User->>NavController: navigateToOnBoarding()
NavController->>RootNav: Navigate to OnBoardingRoute
RootNav->>Screen: Render Composable
Screen->>ViewModel: Observe currentPage (via koinViewModel)
ViewModel->>Screen: Emit currentPage = 1
Screen->>Screen: Render Page 1 (of 2)
User->>Screen: Click Next
Screen->>ViewModel: onNextPage()
ViewModel->>ViewModel: currentPage = 2
ViewModel->>Screen: Emit currentPage = 2
Screen->>Screen: Render Page 2 (of 2)
User->>Screen: Click Next (final page)
Screen->>ViewModel: onNextPage()
ViewModel->>ViewModel: currentPage exceeds TOTAL_PAGES
ViewModel->>ViewModel: updateOnboardingStatus()
ViewModel->>Repository: setFirstTimeState(false)
Repository->>Repository: Persist preference
Repository-->>ViewModel: Complete
ViewModel->>Screen: Emit currentPage = 3
Screen->>NavController: Navigation ends (onboarding complete)
Estimated Code Review Effort
Poem
Where pages turn and states update with Compose and wrath,
ViewModel hops through screens so fine,
Persistence saves the day—first-time flags align!
The feature's wired, the navigation's set,
A fluffy welcome—the smoothest ride yet! 🥕✨
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The PR title accurately describes the main change: adding onboarding screens as a new feature to the codebase. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
@revanthkumarJ When starting a new project, it's standard procedure to eliminate current project feature modules. This is usually because significant refactoring is needed to match them with user needs or the application's design guidelines. The present pull request includes UI-related changes that don't impact this project and would require a substantial amount of work to remove from the code during the creation of a new project.