Phase 1 milestone M1b: a Compose Multiplatform window driven by the same
NoteRepositoryImpl the Android app uses, over its own ObjectBox library.
DesktopContainer mirrors AppContainer's construction order (store,
CipherHolder, repository). Owns its library at
$XDG_DATA_HOME/incido — a separate library per machine,
since ObjectBox is single-writer; the backup file (M2)
is the only bridge to the phone. --data-dir opens
another library, e.g. one pulled off a phone.
Main.kt two panes, save-as-you-type with a 400ms debounce,
favourite toggle. Material 3 defaults on purpose: the
app's theme and screens arrive with the M4 composeApp
conversion, which deletes this stand-in.
Verified headlessly (--self-test drives the same repository calls the "+"
button and the star make, --exit-after auto-closes), against a library
previously written by :core:data-jvm:smoke — i.e. a different module's
generated MyObjectBox, same schema:
RENDER notes=0 selected=null first frame (collectAsState initial value)
RENDER notes=1 selected=1 ObjectBox flow delivered
SELFTEST wrote note id=2 write path through the UI's own calls
RENDER notes=2 selected=2 and it came back through the flow
reopen -> RENDER notes=2 persisted
Gotcha recorded in the findings doc: the first composition always sees the
empty initial value of collectAsState, so anything asserting on note counts
must watch the flow rather than the first frame.
Still synthetic: theme + screens. Not wired yet: settings, encryption (M3),
backup bridge (M2), packaging (M5). assembleDebug verified green.
50 lines
1.8 KiB
Kotlin
50 lines
1.8 KiB
Kotlin
// desktopApp — Incido for the desktop (Development Plan §6, Phase 1, M1b).
|
|
//
|
|
// A Compose Multiplatform window over :core:data-jvm, i.e. the SAME data layer
|
|
// the Android app compiles (shared sources, sibling ObjectBox codegen). The
|
|
// desktop build owns its own library in the XDG data dir; the encrypted backup
|
|
// file is the only bridge to the phone (M2) because ObjectBox is single-writer.
|
|
|
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
|
|
plugins {
|
|
alias(libs.plugins.kotlinJvm)
|
|
alias(libs.plugins.compose)
|
|
alias(libs.plugins.kotlinCompose)
|
|
// SPIKE FINDING: the `application` plugin is NOT applied explicitly —
|
|
// org.jetbrains.compose applies it itself, and applying it first collides
|
|
// on task registration. `compose.desktop { application { } }` gives `run`.
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(17)
|
|
}
|
|
|
|
dependencies {
|
|
implementation(compose.desktop.currentOs)
|
|
implementation(compose.ui)
|
|
implementation(compose.foundation)
|
|
implementation(compose.material3)
|
|
implementation(compose.materialIconsExtended)
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
implementation(libs.kotlinx.coroutines.swing)
|
|
|
|
implementation(project(":core:domain"))
|
|
implementation(project(":core:data-jvm"))
|
|
}
|
|
|
|
// Packaging works (proven in Phase 0), but per-OS installers and icons are
|
|
// milestone M5. Version is pinned numerically here because jpackage only
|
|
// accepts major.minor.patch; M5 wires it to the app's version scheme.
|
|
compose.desktop {
|
|
application {
|
|
mainClass = "org.incido.desktop.MainKt"
|
|
nativeDistributions {
|
|
targetFormats(TargetFormat.Deb, TargetFormat.Rpm, TargetFormat.AppImage)
|
|
packageName = "incido"
|
|
packageVersion = "0.4.2"
|
|
vendor = "Incido"
|
|
description = "Incido — offline-first notes (desktop)."
|
|
}
|
|
}
|
|
} |