Skip to content

Conversation

@Aryan-Baglane
Copy link
Contributor

@Aryan-Baglane Aryan-Baglane commented Nov 11, 2025

[Doc Update - MM-438 ](docs: Add comprehensive documentation for QR feature module)

  • Added comprehensive KDoc documentation for the QR feature module
  • Documented QR code reader, display, and import screens with their navigation helpers
  • Added documentation for QrModule Koin dependency injection setup

Fixes - Jira-#438

Submission Checklist:

  • 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

    • Added type-safe navigation helpers for QR graph, reader, display, and import screens
    • Registered QR display screen to enable QR display flow
    • Added platform image picker integration for QR import
  • Refactor

    • Restructured QR navigation into a nested graph with helper functions
    • Modularized QR reader into dialog/content pieces and improved event/navigation wiring
    • Updated display and import screens to drive UI from view-model state
  • Documentation

    • Expanded KDoc/documentation for QR navigation and screens

@coderabbitai
Copy link

coderabbitai bot commented Nov 11, 2025

Walkthrough

Registers QrCodeDisplayViewModel in DI; adds a nested QR navigation graph and type-safe navigation helpers; expands route builders for reader, display, and import to accept callbacks; refactors reader/display/import screens to accept ViewModel/state and explicit callbacks and adds several private composables and KDoc updates.

Changes

Cohort / File(s) Summary
Dependency Injection
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/di/QrModule.kt
Adds KDoc and registers QrCodeDisplayViewModel in the Koin module alongside existing view models.
Navigation Graph & Helpers
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/navigation/QrNavGraph.kt
Adds QrGraphRoute data object, NavController.navigateToQrGraph(...), and NavGraphBuilder.qrNavGraph(...) to construct a nested QR navigation graph and wire destinations with callbacks.
QR Reader (routes + UI)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderRoute.kt, feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt
Adds navigateToQrReaderScreen; updates qrReaderDestination to accept openBeneficiaryApplication: (Beneficiary, BeneficiaryState) -> Unit; refactors QrCodeReaderScreen to accept explicit callbacks and ViewModel, adds QrCodeReaderDialog, QrCodeReaderContent, Modifier.drawQrCorners, and a preview; wires ViewModel events to callbacks.
QR Display (routes + UI)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeDisplay/QrCodeDisplayRoute.kt, feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeDisplay/QrCodeDisplayScreen.kt
Adds navigateToQrDisplayScreen and qrDisplayDestination; updates public QrCodeDisplayScreen to collect ViewModel state/events and expose a private stateless composable that accepts state and onAction; content now accepts modifier.
QR Import (routes + UI & docs)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportRoute.kt, feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt
Adds navigateToQrImportScreen and qrImportDestination accepting openBeneficiaryApplication callback; expands KDoc; updates QrCodeImportScreen and content signatures to accept explicit viewModel, modifier, and openBeneficiaryApplication; adds QrCodeImagePicker expect and dialog/content composables.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as App UI
  participant Nav as NavController
  participant Graph as QrNavGraph
  participant Reader as QrCodeReaderScreen
  participant Import as QrCodeImportScreen
  participant Display as QrCodeDisplayScreen
  participant VM as ViewModel

  Note over Nav,Graph: Nested QR graph & helpers
  UI->>Nav: navigateToQrGraph()
  Nav->>Graph: open nested QR graph
  Graph->>Reader: qrReaderDestination(openBeneficiaryApplication)
  Graph->>Import: qrImportDestination(openBeneficiaryApplication)
  Graph->>Display: qrDisplayDestination()

  Note over Reader,VM: ViewModel-driven flow
  Reader->>VM: collect state / send actions
  VM-->>Reader: state updates
  Reader->>Nav: navigateToQrImportScreen() / navigateToQrDisplayScreen(qrString)
  Reader->>UI: openBeneficiaryApplication(beneficiary, state)

  Import->>VM: collect state / send actions
  Import->>UI: openBeneficiaryApplication(beneficiary, state)

  Display->>VM: collect state / send actions
  Display->>Nav: navigateBack()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review navigation wiring in QrNavGraph.kt to ensure callbacks propagate and routes are registered correctly.
  • Inspect QrCodeReaderScreen.kt event-to-navigation mapping and new composables (Dialog, Content, drawQrCorners).
  • Verify DI registration in QrModule.kt for QrCodeDisplayViewModel.
  • Check QrCodeImportScreen.kt for expect/actual image picker usage and updated public signatures.

Suggested reviewers

  • WizCoderr

Poem

🐇 I hop through routes both neat and wide,
QR graphs nested, callbacks by my side,
ViewModels snug in Koin's warm tree,
Screens composed with care — a sight to see,
A joyful rabbit's hop of glee! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.26% 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 PR title accurately describes the main changes: comprehensive KDoc documentation added across the QR feature module (QrModule, QrCodeReaderScreen, QrCodeDisplayScreen, QrCodeImportScreen, and navigation helpers).
✨ 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.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (1)

94-99: Remove the hardcoded error-level log

Logger.e("Revanth") looks like a temporary debug statement. Shipping an error-level log on each beneficiary navigation will pollute production logs and make real failures harder to spot. Please drop it or reduce it to an appropriate structured debug trace.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 768a6a6 and 690c9f3.

📒 Files selected for processing (8)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/di/QrModule.kt (1 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/navigation/QrNavGraph.kt (1 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderRoute.kt (1 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (5 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeDisplay/QrCodeDisplayRoute.kt (1 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeDisplay/QrCodeDisplayScreen.kt (4 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportRoute.kt (1 hunks)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt (5 hunks)
🔇 Additional comments (1)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderRoute.kt (1)

34-52: Navigation wiring looks solid.

Documentation and the reworked qrReaderDestination cleanly surface the new openBeneficiaryApplication callback while keeping the route type-safe. No issues spotted here.

@biplab1
Copy link
Contributor

biplab1 commented Nov 12, 2025

@coderabbitai can you improve the PR title and add this to PR description: Fixes - Jira-#438

@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# First, let's get the current PR description to preserve the checklist
gh pr view 3001 --json body --jq '.body'

Length of output: 947


🏁 Script executed:

#!/bin/bash

# Update PR title and description
# New title: More descriptive about the documentation additions
# Add Jira link to description while preserving the checklist

gh pr edit 3001 \
  --title "docs: Add comprehensive documentation for QR feature module" \
  --body "- Added comprehensive KDoc documentation for the QR feature module
- Documented QR code reader, display, and import screens with their navigation helpers
- Added documentation for QrModule Koin dependency injection setup

Fixes - [Jira-#438](https://mifosforge.jira.com/browse/MM-438)

## Submission Checklist:
- [x] 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."

Length of output: 298


@biplab1, I'm unable to directly edit the PR due to workflow restriction settings on this repository. However, here are my suggested improvements that you can apply manually:

Suggested PR Title:

docs: Add comprehensive documentation for QR feature module

Suggested PR Description:

- Added comprehensive KDoc documentation for the QR feature module
- Documented QR code reader, display, and import screens with their navigation helpers
- Added documentation for QrModule Koin dependency injection setup

Fixes - [Jira-#438](https://mifosforge.jira.com/browse/MM-438)

## Submission Checklist:
- [x] 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.

The improved title follows conventional commit format and is more descriptive about what was actually done. The description now includes the Jira link as requested and provides more detail about the documentation additions while preserving the submission checklist.

@biplab1
Copy link
Contributor

biplab1 commented Nov 12, 2025

@Aryan-Baglane Please update PR title and Jira ticket link in PR description as suggested by @coderabbitai

@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

Tip

For best results, initiate chat on the files or code changes.

@biplab1, thank you for following up with the PR author! I'm here if you need any additional assistance with the PR or have any questions about the suggested changes. 🐰

@biplab1
Copy link
Contributor

biplab1 commented Nov 12, 2025

@Aryan-Baglane You can use this instead:
docs(feature:qr): add module documentation

@Aryan-Baglane Aryan-Baglane changed the title Docs update feature/qr (MM- 438) docs: Add comprehensive documentation for QR feature module Nov 12, 2025
Copy link
Contributor

@biplab1 biplab1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant parameter docs for standard parameters like modifier, painter (unless there's a specific reason to customize it)

Fix the redundants comments
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (1)

94-96: Remove debug log statement before merging.

This debug log with a developer name should not be in production code. It uses error-level logging inappropriately and provides no value in the production environment.

Apply this diff to remove the debug log:

             is QrCodeReaderEvent.NavigateToBeneficiary -> {
-                Logger.e("Revanth") {
-                    event.beneficiary.toString()
-                }
                 openBeneficiaryApplication(event.beneficiary, event.beneficiaryState)
             }
🧹 Nitpick comments (1)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (1)

67-76: Consider removing documentation for the modifier parameter.

Based on past review comments, documentation for standard parameters like modifier is not required according to the project's conventions. While the KDoc description mentions all parameters, you might want to omit explicit mention of modifier to align with the established guidelines.

Based on learnings

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 690c9f3 and 22fc660.

📒 Files selected for processing (1)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (5 hunks)
🔇 Additional comments (3)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qr/QrCodeReaderScreen.kt (3)

117-122: LGTM!

The KDoc documentation for the dialog composable is clear and concise, properly documenting the purpose and parameters.


142-145: LGTM!

The documentation is clear and appropriately omits the standard modifier parameter, aligning with project conventions.


330-332: LGTM!

The preview documentation is clear and follows KDoc conventions appropriately.

fixed redundant comments
fix the redundant comments
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt (3)

39-52: Document the modifier parameter.

The KDoc is missing documentation for the modifier parameter (line 51). Since this PR aims to provide comprehensive documentation, all parameters should be documented.

Apply this diff to add the missing parameter documentation:

 /**
  * The main composable for the QR Code Import screen. It connects the UI to the ViewModel,
  * handles state and events, and orchestrates navigation.
  *
  * @param navigateBack Callback to navigate to the previous screen.
  * @param openBeneficiaryApplication Callback to open the beneficiary application with parsed data.
+ * @param modifier The [Modifier] to be applied to this composable.
  * @param viewModel The [QrCodeImportViewModel] for this screen.
  */

110-119: Document the modifier parameter.

The KDoc is missing documentation for the modifier parameter (line 117). For comprehensive documentation, all parameters should be documented, including those with default values.

Apply this diff to add the missing parameter documentation:

 /**
  * The main content layout for the QR Code Import screen, including the scaffold and
  * bottom bar.
+ *
+ * @param modifier The [Modifier] to be applied to this composable.
  * @param onAction Callback for user actions on the screen.
  */

163-172: Document the modifier parameter.

The KDoc is missing documentation for the modifier parameter (line 171).

Apply this diff to add the missing parameter documentation:

 /**
  * A wrapper composable that hosts the platform-specific [QrCodeImagePicker].
  *
  * @param proceedClicked Callback invoked when an image is selected and ready to be processed.
+ * @param modifier The [Modifier] to be applied to this composable.
  */
🧹 Nitpick comments (1)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt (1)

173-179: Consider simplifying the lambda invocation.

The explicit .invoke() call is unnecessary in Kotlin. Lambdas can be called directly.

Apply this diff for a more idiomatic Kotlin style:

     QrCodeImagePicker(
         onProceed = { bitmap ->
-            proceedClicked.invoke(bitmap)
+            proceedClicked(bitmap)
         },
         modifier = modifier,
     )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b93bb4 and 63c0811.

📒 Files selected for processing (1)
  • feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt (5 hunks)
🔇 Additional comments (3)
feature/qr/src/commonMain/kotlin/org/mifos/mobile/feature/qr/qrCodeImport/QrCodeImportScreen.kt (3)

84-108: LGTM!

The KDoc for this private composable is clear, concise, and documents all parameters appropriately.


149-161: LGTM!

The KDoc for this expect function is comprehensive, clearly explains the platform-specific nature of the implementation, and documents all parameters.


181-193: LGTM!

The KDoc for this preview function is appropriate. Preview functions don't require extensive documentation.

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.

2 participants