mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(platform): adopt hardened core contracts
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
@@ -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() }
|
||||
|
||||
Reference in New Issue
Block a user