aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt1
-rw-r--r--androidApp/src/main/res/layout/devices_fragment.xml3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt6
3 files changed, 5 insertions, 5 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/androidApp/src/main/res/layout/devices_fragment.xml b/androidApp/src/main/res/layout/devices_fragment.xml
index 1dd1690..6e4db3f 100644
--- a/androidApp/src/main/res/layout/devices_fragment.xml
+++ b/androidApp/src/main/res/layout/devices_fragment.xml
@@ -2,7 +2,8 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:background="@color/background">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/devicesList"
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 fd1e950..8c36d50 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt
@@ -33,6 +33,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
@@ -50,14 +51,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")