Skip to content

Add kmp modules for shareable domain and ui components#3595

Merged
andreia-ferreira merged 10 commits into
masterfrom
andreia/3575/create-kmp-modules
Mar 9, 2026
Merged

Add kmp modules for shareable domain and ui components#3595
andreia-ferreira merged 10 commits into
masterfrom
andreia/3575/create-kmp-modules

Conversation

@andreia-ferreira

@andreia-ferreira andreia-ferreira commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Towards #3575 ; #3600

In order to share LOI geometry as a QR code containing a GeoJSON, this PR adds a reusable UI component GroundQrCode, intended to be used in at least two places: the LOI job sheet and the end of a data collection flow.

It also introduces a new domain model LoiReport (currently holding the LOI GeoJSON). In a follow-up step, this will be expanded to include the full LOI survey data so it can be downloaded/exported as a PDF.

As a step toward #3416 , the shareable pieces were extracted into KMP modules :core:ui (reusable UI) and :core:domain (pure domain models/logic). More code will be moved incrementally in smaller PRs to keep reviews focused and reduce risk.

Note: The new modules compatibility with iOS was tested in a separate branch (open iosApp in xcode and run the project, it should display a simple qr code element)

@shobhitagarwal1612 PTAL?

@auto-assign auto-assign Bot requested a review from gino-m March 5, 2026 16:30
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for enhanced data sharing capabilities by introducing Kotlin Multiplatform modules for core domain logic and UI components. The primary goal is to enable the generation and display of QR codes containing LOI GeoJSON data, with future plans to support comprehensive LOI survey data export. This architectural change promotes code reusability and prepares the project for multiplatform development.

Highlights

  • New Kotlin Multiplatform Modules: Introduced two new Kotlin Multiplatform (KMP) modules: :core:domain for pure domain models and logic, and :core:ui for reusable UI components. These modules are configured for JVM, Android, and iOS targets, enabling code sharing across platforms.
  • Shareable LOI Geometry via QR Code: Added a new LoiReport domain model to hold LOI GeoJSON data, facilitating the sharing of LOI geometry as QR codes. This is a foundational step towards expanding LOI survey data export.
  • Reusable QR Code UI Component: Implemented a GroundQrCode composable in the :core:ui module, designed to display QR codes from any string payload. This component is intended for use in various parts of the application, such as LOI job sheets and data collection flows.
  • Gradle Configuration Updates: Updated Gradle build files across the project to integrate the new KMP modules, migrate SDK and JVM toolchain versions to the libs.versions.toml catalog, and include necessary KMP and Compose Multiplatform plugins and dependencies.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/build.gradle
    • Updated compileSdk, minSdkVersion, targetSdkVersion, and jvmToolchain to reference versions from libs.versions.toml.
    • Added a dependency on the new :core:domain module.
  • build.gradle
    • Added new Gradle plugins for Kotlin Multiplatform, Android Kotlin Multiplatform Library, Android Lint, and Compose Multiplatform.
    • Removed the ext block that previously defined androidCompileSdk, androidMinSdk, androidTargetSdk, and jvmToolchainVersion, as these are now managed in libs.versions.toml.
  • core/domain/.gitignore
    • Added /build to ignore build artifacts for the new module.
  • core/domain/build.gradle.kts
    • Created a new Kotlin Multiplatform Gradle module.
    • Configured JVM, iOSX64, iOSArm64, and iOSSimulatorArm64 targets.
    • Added dependencies for kotlin.stdlib and kotlinx.serialization.json.
  • core/domain/src/commonMain/kotlin/org/groundplatform/domain/model/LoiReport.kt
    • Added a new data class LoiReport to represent LOI data, including a geoJson field of type JsonObject.
  • core/ui/.gitignore
    • Added /build to ignore build artifacts for the new module.
  • core/ui/build.gradle.kts
    • Created a new Kotlin Multiplatform Gradle module.
    • Configured Android Library, iOSX64, iOSArm64, and iOSSimulatorArm64 targets, including XCFramework setup for iOS.
    • Added dependencies for Compose Multiplatform libraries (runtime, foundation, material3, ui, ui.tooling.preview, components.resources, androidx.lifecycle.runtime.compose) and qrose for QR code generation.
  • core/ui/src/commonMain/kotlin/org/groundplatform/ui/components/GroundQrCode.kt
    • Added a new @Composable function GroundQrCode for displaying QR codes.
    • Implemented QR code generation using rememberQrCodePainter from the qrose library, supporting an optional center logo.
  • e2eTest/build.gradle
    • Updated compileSdk, minSdkVersion, targetSdkVersion, and jvmToolchain to reference versions from libs.versions.toml.
  • gradle/libs.versions.toml
    • Added new version entries for androidCompileSdk, androidMinSdk, androidTargetSdk, androidXLifecycleVersion, composeMultiplatformVersion, jvmToolchainVersion, material3Version, and qroseVersion.
    • Updated kotlinx-serialization-json to explicitly use kotlinxBom version reference.
    • Added new library aliases for Compose Multiplatform components (androidx-lifecycle-runtime-compose, compose-components-resources, compose-foundation, compose-material3, compose-runtime, compose-ui, compose-ui-tooling, compose-ui-tooling-preview) and qrose.
    • Added new plugin aliases for compose-multiplatform, kotlin-multiplatform, android-kotlin-multiplatform-library, and android-lint.
  • settings.gradle
    • Included the new :core:ui and :core:domain modules in the project.
Activity
  • The pull request author, andreia-ferreira, created this PR to introduce Kotlin Multiplatform modules and a QR code generation feature.
  • The author specifically requested a review from @shobhitagarwal1612.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new Kotlin Multiplatform (KMP) modules, :core:domain and :core:ui, to facilitate code sharing for domain models and UI components. This is a great step towards modularizing the application. The changes also involve migrating build configurations to use the version catalog, which improves dependency management. My review includes several suggestions to align with the repository's style guide, particularly regarding copyright headers and the addition of unit tests for new code. I've also included some recommendations to improve the implementation of the new GroundQrCode composable for better clarity and simplicity.

Comment thread core/domain/build.gradle.kts
Comment thread core/ui/build.gradle.kts
Comment thread core/ui/src/commonMain/kotlin/org/groundplatform/ui/components/GroundQrCode.kt Outdated
Comment thread core/ui/src/commonMain/kotlin/org/groundplatform/ui/components/GroundQrCode.kt Outdated
@codecov

codecov Bot commented Mar 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.33%. Comparing base (b0220ea) to head (d762443).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3595   +/-   ##
=========================================
  Coverage     70.33%   70.33%           
  Complexity     1816     1816           
=========================================
  Files           353      353           
  Lines          9895     9895           
  Branches       1061     1061           
=========================================
  Hits           6960     6960           
  Misses         2300     2300           
  Partials        635      635           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira andreia-ferreira merged commit 285e888 into master Mar 9, 2026
9 checks passed
@andreia-ferreira andreia-ferreira deleted the andreia/3575/create-kmp-modules branch March 9, 2026 14:21
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