diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-02-17 00:51:26 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-02-17 00:51:26 -0600 |
commit | 1a37308c876d09b045a0202804762bf32e9f431c (patch) | |
tree | f7dc389f3e4e53ad8dcd510478e381faefd3d153 | |
parent | 489473b87bce707e97d162362d32dd1b3a0dff94 (diff) | |
parent | 9d753c9fa9e93171206e6036c1889ea17cac9db6 (diff) | |
download | etbsa-trackermap-mobile-1a37308c876d09b045a0202804762bf32e9f431c.tar.gz etbsa-trackermap-mobile-1a37308c876d09b045a0202804762bf32e9f431c.tar.bz2 etbsa-trackermap-mobile-1a37308c876d09b045a0202804762bf32e9f431c.zip |
Merge https://git.sr.ht/~avalos/trackermap-mobile
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt | 1 | ||||
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt index d7b6db1..ba29090 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt @@ -69,6 +69,7 @@ class UnitsViewModel( init { Log.d("UnitsViewModel", "Initializing Units View Model") + unitsController.fetchUnits(viewModelScope) viewModelScope.launch { setupObservers() } diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt index b282a34..a5d5bd7 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt @@ -32,6 +32,7 @@ import mx.trackermap.TrackerMap.client.models.UnitInformation import mx.trackermap.TrackerMap.utils.Coroutines import kotlin.time.Duration.Companion.seconds import kotlin.time.ExperimentalTime +import kotlinx.coroutines.Job @DelicateCoroutinesApi @ExperimentalTime @@ -49,14 +50,11 @@ class UnitsController( init { GlobalScope.launch { - fetchUnits(this) - } - GlobalScope.launch { setupFlows() } } - private suspend fun fetchUnits(scope: CoroutineScope) { + fun fetchUnits(scope: CoroutineScope) { Coroutines.tickerFlow(UPDATE_TIME.seconds) .map { print("Fetching new positions...\n") |