summaryrefslogtreecommitdiff
path: root/android-app/app
diff options
context:
space:
mode:
authorClaudomator Agent <agent@claudomator>2026-03-16 19:56:47 +0000
committerClaudomator Agent <agent@claudomator>2026-03-16 19:56:47 +0000
commit8457d32d89ef703fa8e748a0592472e3d21a16f9 (patch)
tree55d96acd983ca82e26e85313f27da87f44a94650 /android-app/app
parentc0ba29283dcb318cb918615e34f2d90d05cc1019 (diff)
fix: resolve compilation error in PerformanceViewModelFactory
modelClass.kotlin.viewModelScope called viewModelScope on KClass<T> rather than a ViewModel instance. Replace with CoroutineScope(Dispatchers.IO + SupervisorJob()) which is valid at factory creation time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app')
-rw-r--r--android-app/app/src/main/kotlin/org/terst/nav/PerformanceViewModelFactory.kt8
1 files changed, 3 insertions, 5 deletions
diff --git a/android-app/app/src/main/kotlin/org/terst/nav/PerformanceViewModelFactory.kt b/android-app/app/src/main/kotlin/org/terst/nav/PerformanceViewModelFactory.kt
index ed6d1eb..4984870 100644
--- a/android-app/app/src/main/kotlin/org/terst/nav/PerformanceViewModelFactory.kt
+++ b/android-app/app/src/main/kotlin/org/terst/nav/PerformanceViewModelFactory.kt
@@ -2,19 +2,17 @@ package org.terst.nav
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
-import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.SupervisorJob
import org.terst.nav.nmea.NmeaParser
import org.terst.nav.nmea.NmeaStreamManager
class PerformanceViewModelFactory : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
if (modelClass.isAssignableFrom(PerformanceViewModel::class.java)) {
- // NmeaStreamManager will be tied to the ViewModel's lifecycle
val nmeaParser = NmeaParser()
- // We'll pass the ViewModel's own viewModelScope to NmeaStreamManager
- // The actual CoroutineScope passed here will be the one associated with the ViewModel
- val nmeaStreamManager = NmeaStreamManager(nmeaParser, CoroutineScope(modelClass.kotlin.viewModelScope.coroutineContext))
+ val nmeaStreamManager = NmeaStreamManager(nmeaParser, CoroutineScope(Dispatchers.IO + SupervisorJob()))
@Suppress("UNCHECKED_CAST")
return PerformanceViewModel(nmeaStreamManager) as T
}