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. * * ViewModels reach the container via `(application as IncidoApplication).container` * (see `NoteListViewModel.Factory` and `NoteEditorViewModel.factory`). * * 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() } }