aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-02-06 22:51:05 -0600
committerIván Ávalos <avalos@disroot.org>2022-02-06 22:51:05 -0600
commitb86898ed1ac5d06d3e3a39cc693cac0a1acc4ef6 (patch)
treea8e213a846b435dff3974792502634aad431bfc8
parenta2387a76bb3b343862baa57e3fe28ed893f6cbda (diff)
downloadetbsa-trackermap-mobile-b86898ed1ac5d06d3e3a39cc693cac0a1acc4ef6.tar.gz
etbsa-trackermap-mobile-b86898ed1ac5d06d3e3a39cc693cac0a1acc4ef6.tar.bz2
etbsa-trackermap-mobile-b86898ed1ac5d06d3e3a39cc693cac0a1acc4ef6.zip
Added CommandsController
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt2
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/CommandsController.kt12
2 files changed, 13 insertions, 1 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt
index 7b66bd3..9a9f85c 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt
@@ -148,7 +148,7 @@ class UnitRenderData {
}
/* Hourmeter */
- position.attributes["hours"]?.longOrNull?.let {
+ unit.getHourmeter()?.let {
if (it > 0) {
details.add(
Triple(
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/CommandsController.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/CommandsController.kt
new file mode 100644
index 0000000..bacdb40
--- /dev/null
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/CommandsController.kt
@@ -0,0 +1,12 @@
+package mx.trackermap.TrackerMap.controllers
+
+import mx.trackermap.TrackerMap.client.apis.CommandsApi
+import mx.trackermap.TrackerMap.client.models.Command
+
+class CommandsController(
+ private val commandsApi: CommandsApi
+) {
+ suspend fun fetchCommands(deviceId: Int): List<Command> {
+ return commandsApi.commandsGet(deviceId = deviceId).toList()
+ }
+} \ No newline at end of file