Skip to content

Add kmp modules for shareable domain and ui components#3595

Open
andreia-ferreira wants to merge 7 commits intomasterfrom
andreia/3575/create-kmp-modules
Open

Add kmp modules for shareable domain and ui components#3595
andreia-ferreira wants to merge 7 commits intomasterfrom
andreia/3575/create-kmp-modules

Conversation

@andreia-ferreira
Copy link
Collaborator

Towards #3575

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

Copy link
Contributor

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

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.

import kotlinx.serialization.json.JsonObject

/** Represents the data collected for a specific LOI which can be downloaded and shared */
data class LoiReport(val geoJson: JsonObject)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The repository style guide requires unit tests for new behaviors. While LoiReport is a simple data class, adding tests for its serialization/deserialization would be beneficial, especially since it's part of a shared domain module.

References
  1. Rule [Edit Record] Save button sometimes has no effect #5 states to add or update unit tests for all new or changed behaviors. (link)

Comment on lines +37 to +42
fun GroundQrCode(
modifier: Modifier = Modifier,
content: String,
contentDescription: String,
centerLogoPainter: Painter?,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The repository style guide requires unit tests for new or changed behaviors. While a @Preview is provided, please also add unit tests for this new composable to verify its behavior, for example, checking that the correct content is passed to the QR code painter and that the content description is set correctly.

References
  1. Rule [Edit Record] Save button sometimes has no effect #5 states to add or update unit tests for all new or changed behaviors. (link)

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.11%. Comparing base (db59fc7) to head (c14c7c9).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3595   +/-   ##
=========================================
  Coverage     71.11%   71.11%           
  Complexity     1629     1629           
=========================================
  Files           338      338           
  Lines          9114     9114           
  Branches       1003     1003           
=========================================
  Hits           6481     6481           
  Misses         2031     2031           
  Partials        602      602           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant