aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers
diff options
context:
space:
mode:
authorIsidro Henoch <imhenoch@protonmail.com>2021-12-16 02:08:57 -0600
committerIsidro Henoch <imhenoch@protonmail.com>2021-12-16 02:08:57 -0600
commit84c797ac104c0fff96ba6793cefaa5ba0b4887fc (patch)
tree96f30f5f6c939a4683a69ae47b65b720d1830dbb /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers
parent36b7d109fa1e8c5a7c5fc262a3b0d7b1286e07c8 (diff)
downloadetbsa-trackermap-mobile-84c797ac104c0fff96ba6793cefaa5ba0b4887fc.tar.gz
etbsa-trackermap-mobile-84c797ac104c0fff96ba6793cefaa5ba0b4887fc.tar.bz2
etbsa-trackermap-mobile-84c797ac104c0fff96ba6793cefaa5ba0b4887fc.zip
Updates unit details fragment to fetch the information for the given ID
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt4
1 files changed, 4 insertions, 0 deletions
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 29c84f4..db6d9b3 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt
@@ -51,6 +51,10 @@ class UnitsController(
queryFlow.value = query
}
+ fun getUnit(deviceId: Int): UnitInformation? {
+ return unitsFlow.value.firstOrNull { it.device.id == deviceId }
+ }
+
private suspend fun setupFlows() {
unitsFlow.combine(queryFlow) { units, query ->
units.filter { unit ->