aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-31 22:47:33 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-31 22:47:33 -0600
commit9d753c9fa9e93171206e6036c1889ea17cac9db6 (patch)
tree8f345aaece8d850f8dea005fd1b039761fcefc92 /androidApp/src/main/java/mx
parent92ab928f9efd238be7232ee4ec5962bfbb5a0e12 (diff)
downloadetbsa-trackermap-mobile-9d753c9fa9e93171206e6036c1889ea17cac9db6.tar.gz
etbsa-trackermap-mobile-9d753c9fa9e93171206e6036c1889ea17cac9db6.tar.bz2
etbsa-trackermap-mobile-9d753c9fa9e93171206e6036c1889ea17cac9db6.zip
Attach tickerFlow to viewModelScope in an attempt to bind it to app lifecycle more effectively
Diffstat (limited to 'androidApp/src/main/java/mx')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt1
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt5
2 files changed, 1 insertions, 5 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
index a327234..4371eed 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
@@ -78,7 +78,6 @@ class UnitsActivity : AppCompatActivity() {
override fun onDestroy() {
super.onDestroy()
_binding = null
- unitsViewModel.stopUpdates()
}
private fun setupViews() {
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 8401ee7..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()
}
@@ -90,10 +91,6 @@ class UnitsViewModel(
}
}
- fun stopUpdates() {
- unitsController.stopUpdates()
- }
-
fun selectUnit(unit: UnitInformation) {
Log.d("UnitsViewModel", "Selecting unit ${unit.device.name}")
_selectedUnit.postValue(unit)