feat(platform): adopt hardened core contracts

This commit is contained in:
2026-07-10 12:25:17 +02:00
parent e46a2522ce
commit 2271f453f1
5 changed files with 64 additions and 14 deletions

View File

@@ -81,6 +81,11 @@ class VniDropAppViewModel(
private var selectedFile: PickedShareFile? = null
override fun onCleared() {
repository.shutdown()
super.onCleared()
}
init {
AppLogger.initialize(appDataDir)
AppLogger.info("lifecycle", "app started", mapOf("platform" to platformName))

View File

@@ -39,6 +39,12 @@ class CoreRepository(
private var core: VnidropCore? = null
fun shutdown() {
core?.shutdown()
core = null
_state.update { it.copy(isInitialized = false, status = "Not initialized") }
}
private val sink = object : CoreEventSink {
override fun onEvent(event: CoreEvent) {
_state.update { current ->

View File

@@ -143,7 +143,7 @@ fun friendlyCoreError(raw: String?): String? {
}
private val progressPhases = setOf("import", "ticket", "access", "transfer", "download", "export", "lifecycle")
private val activeTransferStatuses = setOf("sharing", "receiving")
private val activeTransferStatuses = setOf("importing", "sharing", "receiving")
private fun eventLabel(event: CoreEvent): String {
val direction = event.direction?.replaceFirstChar { it.uppercase() }