mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
Port sample-app to KMP with Android, iOS, Web, and SQLite (#16)
* chore(sample-app): hoist gradle wrapper to sample-app root * chore(sample-app): add KMP root gradle config * chore(sample-app): add composeApp KMP module build config * chore(sample-app): add Android manifest for composeApp * feat(sample-app): add shared domain models and auth constants * feat(sample-app): add shared number and date formatting * feat(sample-app): add cross-platform storage, clock, and id * feat(sample-app): add shared repository with file-backed state * feat(sample-app): add shared in-memory navigator * feat(sample-app): add Compose theme and design tokens * feat(sample-app): add shared UI components (icons, screen, widgets) * feat(sample-app): add Login and Home pages * feat(sample-app): add AddAccount, Ledger, AddTransaction pages * feat(sample-app): add App root composable with routing * feat(sample-app): add Android Application and Activity hosting Compose UI * chore(sample-app): remove legacy android module (replaced by composeApp) * chore(sample-app): bump to latest stable Kotlin/AGP/Compose deps * fix(sample-app): make iOS compile (drop @Volatile, set bundleId) * feat(sample-app): add xcodegen spec, SwiftUI host, and iOS Info.plist * chore(sample-app): ignore build artifacts and generated xcodeproj * chore(sample-app): update justfile for composeApp layout, add ios target * docs(sample-app): rewrite README for KMP + iOS flow * refactor(sample-app): drop in-app status bar and formatClock * feat(sample-app): add SQLDelight schema and per-platform drivers * refactor(sample-app): back Repository with SQLite, drop file serializer * feat(sample-app): wire native back on Android and iOS edge swipe * feat(sample-app): semantic roles, labels, and a11y descriptions * fix(sample-app): link libsqlite3 for iOS target SQLDelight's native driver needs libsqlite3.tbd on iOS; without it the linker fails with undefined _sqlite3_bind_blob and friends. * refactor(sample-app): abstract storage behind LedgerStore interface Platform-specific createLedgerStore() returns a SqlLedgerStore backed by SQLDelight on Android + iOS. Opens the door for a pure in-memory web implementation that does not require a SQLite driver. * feat(sample-app): add wasmJs target with in-memory LedgerStore Wires a Compose Multiplatform browser canvas entry point. The web implementation of LedgerStore is an in-memory model with localStorage persistence, so it does not need a SQLite driver. Back navigation maps the browser back button to the same BackHandler contract Android and iOS use. * chore(sample-app): settings + gitignore for wasmJs dev run Registers the Node.js distributions repository and switches repositoriesMode to PREFER_PROJECT so the Kotlin wasmJs plugin can download its toolchain. Adds kotlin-js-store (lockfile) and ignores runs/, web screenshots, playwright-mcp scratch output. * fix(sample-app): singularize transaction count on Home Shows "1 transaction" not "1 transactions" for accounts with a single transaction; falls back to "$count transactions" otherwise.
This commit is contained in:
61 files changed
+2247
-166
No files matched your search
@@ -1,23 +1,56 @@
|
||||
# uatu sample app
|
||||
|
||||
Tiny Android app wired to the uatu SDK, plus a TypeScript spec that drives it.
|
||||
Use it as a reference for integrating uatu into your own app.
|
||||
A minimal Kotlin Multiplatform ledger app that mirrors the React reference:
|
||||
login with demo credentials, create accounts, add credits and debits. Same
|
||||
features, monospace look, and demo creds, shared across Android and iOS via
|
||||
Compose Multiplatform.
|
||||
|
||||
## Stack
|
||||
|
||||
- Kotlin Multiplatform + Compose Multiplatform (shared UI)
|
||||
- kotlinx.serialization for file-backed persistence
|
||||
- kotlinx.coroutines for state flows
|
||||
- uatu `sdk-android` for harness integration on Android
|
||||
|
||||
Everything in `composeApp/src/commonMain/kotlin/dev/uatu/sample/` is shared
|
||||
between platforms. Platform-specific I/O (file storage, clock, UUID) lives
|
||||
in `androidMain/` and `iosMain/` as `actual`s of the `Platform` expect object.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `uatu` CLI on `PATH` (see [getting started](https://priyanshujain.github.io/uatu/manual/getting-started.html))
|
||||
- Android SDK installed (uatu auto-discovers `adb` and `emulator` under
|
||||
`$ANDROID_HOME`, `~/Library/Android/sdk`, or the Homebrew cask; nothing to
|
||||
export if you use a standard install)
|
||||
- `just` task runner
|
||||
- `just`
|
||||
- JDK 17
|
||||
- Android SDK (auto-discovered under `$ANDROID_HOME`, `~/Library/Android/sdk`,
|
||||
or the Homebrew cask)
|
||||
- Xcode 16+ and `xcodegen` (`brew install xcodegen`) for iOS
|
||||
|
||||
## Install the app
|
||||
## Android
|
||||
|
||||
```sh
|
||||
just install
|
||||
just install # build + install on a booted emulator / device
|
||||
just uninstall
|
||||
just clean
|
||||
```
|
||||
|
||||
## Run a test
|
||||
## iOS
|
||||
|
||||
```sh
|
||||
just ios # default device: iPhone 17 Pro
|
||||
IOS_DEVICE="iPhone 15" just ios # pick a different simulator
|
||||
```
|
||||
|
||||
`just ios` regenerates `iosApp/iosApp.xcodeproj` from `iosApp/project.yml`,
|
||||
builds the KMP framework, links it into the SwiftUI host, installs, and
|
||||
launches.
|
||||
|
||||
## Demo credentials
|
||||
|
||||
```
|
||||
email: [email protected]
|
||||
password: ledger123
|
||||
```
|
||||
|
||||
## Run a uatu test (Android)
|
||||
|
||||
```sh
|
||||
just test
|
||||
@@ -39,12 +72,26 @@ DURATION=5m
|
||||
|
||||
Traces land in `./runs/<timestamp>/`.
|
||||
|
||||
## How the pieces connect
|
||||
## Layout
|
||||
|
||||
- `android/build.gradle.kts` depends on `io.github.priyanshujain:sdk-android` from
|
||||
Maven Central
|
||||
- `android/src/main/kotlin/.../SampleApplication.kt` calls `Uatu.start(this)` and
|
||||
registers snapshot extractors (`app_state`, `click_count`)
|
||||
- `spec.ts` imports `@uatu/spec` (see `package.json`), reads those snapshots,
|
||||
asserts properties on them, and weights the actions the fuzzer picks from
|
||||
- `just test` invokes `uatu test` against the installed APK on the connected device (or the AVD named via `AVD=`)
|
||||
```
|
||||
composeApp/
|
||||
src/commonMain/kotlin/dev/uatu/sample/ shared domain, state, UI
|
||||
src/androidMain/ Android Application + Activity
|
||||
src/iosMain/ iOS UIViewController entry
|
||||
iosApp/
|
||||
project.yml xcodegen spec
|
||||
iosApp/iOSApp.swift SwiftUI host
|
||||
iosApp/Info.plist
|
||||
justfile
|
||||
spec.ts uatu test spec
|
||||
```
|
||||
|
||||
## How it connects to uatu
|
||||
|
||||
- `composeApp/src/androidMain/.../SampleApplication.kt` calls `Uatu.start(this)`
|
||||
and registers snapshot extractors (`logged_in`, `account_count`,
|
||||
`total_balance`, `route`)
|
||||
- `spec.ts` imports `@uatu/spec`, reads those snapshots, asserts properties,
|
||||
and weights the actions the fuzzer picks from
|
||||
- `just test` invokes `uatu test` against the installed APK
|
||||
Reference in new issue
Block a user