Skip to content

Conversation

@techsavvy185
Copy link
Contributor

@techsavvy185 techsavvy185 commented Dec 26, 2025

Fixes - Jira-MIFOSAC-619

Before

before.webm

After

after.webm

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

  • New Features
    • Enhanced theme settings: Users can now configure the app to automatically follow their system's dark theme preference, in addition to manually selecting dark or light mode options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

The pull request refactors the dark theme handling by replacing a boolean flag with a DarkThemeConfig enum in the app state. The theme calculation logic now explicitly maps configuration states (DARK, LIGHT, FOLLOW_SYSTEM) to the computed boolean used by MifosTheme.

Changes

Cohort / File(s) Summary
Theme state and calculation
cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeAppViewModel.kt, cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeApp.kt
Replaced AppState.darkTheme: Boolean with AppState.darkThemeConfig: DarkThemeConfig. Updated handleAppThemeUpdated to assign config directly. Added enum-to-boolean mapping logic in ComposeApp with new imports for DarkThemeConfig and isSystemInDarkTheme() to resolve FOLLOW_SYSTEM state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 From booleans we hop to configs so fine,
DARK, LIGHT, and SYSTEM in perfect line,
Theme follows the system with elegant grace,
A refactor that brightens this coding space!

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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: fixing the follow system theme implementation, which aligns with the codebase changes that replace a boolean darkTheme with DarkThemeConfig to properly handle system theme following.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78b3242 and 34e802d.

📒 Files selected for processing (2)
  • cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeApp.kt
  • cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeAppViewModel.kt
🧰 Additional context used
🧬 Code graph analysis (1)
cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeApp.kt (1)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/Theme.kt (1)
  • MifosTheme (250-275)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR Checks / Static Analysis Check
🔇 Additional comments (5)
cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeApp.kt (2)

12-12: LGTM: Necessary imports added.

The new imports support the enum-based theme configuration logic.

Also applies to: 18-18


41-48: Excellent fix for system theme handling!

The enum-to-boolean mapping correctly handles all three theme configurations. The key improvement is that FOLLOW_SYSTEM now calls isSystemInDarkTheme() at composition time, allowing the app to reactively update when the system theme changes. This addresses the root cause where the configuration was likely converted to a boolean too early, losing the system-following capability.

cmp-navigation/src/commonMain/kotlin/cmp/navigation/ComposeAppViewModel.kt (3)

30-34: LGTM: Appropriate initial state.

Using FOLLOW_SYSTEM as the default respects the user's system preference, which is good UX. The field name change from darkTheme to darkThemeConfig accurately reflects that it now stores the configuration enum.


67-72: LGTM: Cleaner state management.

The handler now directly stores the DarkThemeConfig enum without premature conversion to boolean. This preserves the full configuration state and allows the composable layer to handle the theme resolution logic appropriately.


79-83: The AppState field change is correctly implemented across the codebase.

The change from darkTheme: Boolean to darkThemeConfig: DarkThemeConfig has been properly applied. Verification confirms no orphaned references to the old field exist. The AppState instantiation in ComposeAppViewModel and consumption in ComposeApp.kt both correctly use the new darkThemeConfig field with appropriate type handling.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@therajanmaurya therajanmaurya enabled auto-merge (squash) December 28, 2025 13:57
@therajanmaurya therajanmaurya merged commit fbb8ed0 into openMF:development Dec 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants