From 84c797ac104c0fff96ba6793cefaa5ba0b4887fc Mon Sep 17 00:00:00 2001 From: Isidro Henoch Date: Thu, 16 Dec 2021 02:08:57 -0600 Subject: Updates unit details fragment to fetch the information for the given ID --- .../kotlin/mx/trackermap/TrackerMap/controllers/UnitsController.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared/src/commonMain/kotlin/mx/trackermap') 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 -> -- cgit v1.2.3