Completes the M4.3 container seam:
* NoteListViewModel + NoteEditorViewModel (UiStates and SharedImage
included) move to commonMain. NoteEditorViewModel had zero android.*
imports; its four withContext(Dispatchers.IO) sites become
withContext(ioDispatcher) — a new internal expect/actual whose ACTUALS
are literally Dispatchers.IO on both targets, so Android behaviour is
byte-identical (invariant §2.1), merely spelled through the seam.
* New commonMain EncryptionBadge/LibraryVerification: the read-only
mirror of :core:data's EncryptionVerification. Required because
:core:data is an androidLibrary invisible to commonMain and must stay
so (invariant §2.3 — objectbox-android vs objectbox-java classpaths).
AppGraph gains encryptionBadge; both containers map the real verifier
result 1:1 at their own seam.
* SettingsViewModel stays in androidMain (SecurityManager, Keystore key
provider, BackupManager Uri IO, CarnetImporter are genuine Android-only
services — the graph was NOT widened to fake them, §9) but its factory
now takes the concrete AppContainer via a new LocalAndroidContainer,
provided alongside LocalAppGraph in IncidoApp. No APPLICATION_KEY /
IncidoApplication reference survives in ANY ViewModel: all six call
sites (drawer, list, editor, settings, pin setup, pin change) build
factories from the graph/container locals at composition time.
* M4.3 exit proof: DesktopContainer : AppGraph — the same face
(noteRepository/settingsRepository/encryptionBadge) the commonMain
ViewModels consume, compiler-checked by :desktopApp building against
:composeApp's jvm target. repository → noteRepository rename.
The stand-in two-pane UI still runs (M4.5 consumes the real screens).
Verification (all green, one suite):
./gradlew assembleDebug :composeApp:compileKotlinJvm :desktopApp:build
→ BUILD SUCCESSFUL
./gradlew :desktopApp:run … --self-test --exit-after 6 → SELFTEST id=1, clean exit
./gradlew :core:data-jvm:smoke → RESULT: M1a PASS
crypto legs (separate processes): leg-A ALL-OK → LEG-B PASS/ALL-OK
git diff '*/objectbox-models/*' → empty
37 lines
1.3 KiB
Kotlin
37 lines
1.3 KiB
Kotlin
package org.incido.compose
|
|
|
|
import android.app.Application
|
|
import org.incido.compose.data.security.SecurityManager
|
|
import org.incido.compose.di.AppContainer
|
|
|
|
/**
|
|
* Application class. Constructs the singleton [AppContainer] holding the
|
|
* ObjectBox store and the note repository.
|
|
*
|
|
* M4.3: the screens reach the container through `LocalAppGraph` (provided
|
|
* by `IncidoApp`); the graph-based ViewModel factories (`factory(graph)`)
|
|
* no longer touch the Application through CreationExtras. The Application
|
|
* still owns construction order.
|
|
*
|
|
* v0.3.2.0 — initialises the [SecurityManager] lock state during
|
|
* `onCreate` so the first composition of the root Compose tree
|
|
* already knows whether to render `PinEntryScreen` or jump straight
|
|
* into the regular UI.
|
|
*/
|
|
class IncidoApplication : Application() {
|
|
lateinit var container: AppContainer
|
|
private set
|
|
|
|
val securityManager: SecurityManager
|
|
get() = container.securityManager
|
|
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
container = AppContainer(this)
|
|
// Decide whether to start locked based on the persisted
|
|
// security preferences. Safe here — no UI thread contention
|
|
// because we're on the main thread pre-Activity.
|
|
container.securityManager.start()
|
|
}
|
|
}
|