Skip to content

Migrate SDK to Kotlin Multiplatform (KMP) for use in KMP/CMP projects #13

Description

@michelutke

Summary

The Updraft SDK is currently an Android-only library (com.android.library module using Retrofit/RxJava2, ViewBinding, Fragments/Activities). More and more of our projects are built with Kotlin Multiplatform (KMP) and Compose Multiplatform (CMP), where a single shared codebase targets Android and iOS. Today, these projects cannot use the Updraft SDK from shared code — Android apps must wire it up in androidMain platform code, and iOS targets have no Kotlin-consumable SDK at all (the separate updraft-sdk-ios exists, but must be integrated natively via Swift).

This issue requests migrating the SDK to KMP so it can be consumed as a single dependency from a KMP/CMP project's commonMain, with feature parity on Android and iOS.

Motivation

  • KMP/CMP is the default stack for new mobile projects at many agencies (including ours) — an Android-only SDK forces per-platform integration glue or dropping Updraft features on iOS.
  • Auto-update and feedback logic (version comparison, API calls, settings) is platform-agnostic business logic — a natural fit for commonMain.
  • One SDK codebase instead of two (updraft-sdk-android + updraft-sdk-ios) reduces maintenance and feature drift between platforms.

Proposed scope

Phase 1 — KMP core (shared business logic)

Extract non-UI logic into a commonMain module:

  • Networking: replace Retrofit/OkHttp with Ktor Client; keep kotlinx.serialization (already in use).
  • Concurrency: replace RxJava2 with Kotlin Coroutines/Flow.
  • Domain logic: CheckUpdateInteractor, CheckFeedbackEnabledInteractor, version comparison, Settings, API request/response models.
  • Storage/prefs: expect/actual or multiplatform-settings.
  • Public API entry point (Updraft.initialize(...)) callable from commonMain.

Phase 2 — Platform integrations (expect/actual)

  • Screenshot capture, shake detection, install/update flow (APK install vs. TestFlight/itms link), current-activity/lifecycle tracking.
  • Android actual reuses existing implementations; iOS actual implemented in Kotlin/Native or bridged to existing iOS SDK internals.

Phase 3 — CMP UI (optional, follow-up)

  • Rebuild feedback form + drawing/annotation UI (currently ViewBinding Fragments + custom FreeDrawView) in Compose Multiplatform so the whole feedback flow is shared.
  • Until then, platform-native UI can remain behind an interface.

Non-goals (for now)

  • Desktop/web targets — Android + iOS first.
  • Breaking the existing Android-only artifact: com.appswithlove.updraft:updraft-sdk should keep working, e.g. by publishing the KMP artifact alongside or making the Android artifact a thin wrapper.

Acceptance criteria

  • SDK consumable from commonMain of a KMP project targeting Android + iOS
  • Auto-update check works on both platforms from shared code
  • Feedback flow (screenshot + annotate + submit) works on both platforms
  • Existing Android integration path keeps working (no breaking change without a major version bump)
  • Sample CMP app added to the repo demonstrating integration
  • README documents KMP setup

Open questions

  • Relationship to updraft-sdk-ios: replace it, or keep it and share only the core?
  • Minimum supported Kotlin/AGP versions for consumers?
  • Keep Loco-based string localization, or move to a multiplatform resource solution (e.g. compose-resources / moko-resources)?
  • Is CMP UI (Phase 3) required for a first release, or is shared core + native UI enough?

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions