aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt8
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/ReportController.kt12
2 files changed, 10 insertions, 10 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
index 22c75f4..60ad531 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
@@ -149,16 +149,16 @@ class UnitReportsFragment : Fragment() {
when (report) {
is ReportController.Report.PositionsReport -> {
mapFragment.display(unitReportsViewModel.geofences.value!!)
- mapFragment.display(report.positions, isReport = true, center = true)
+ mapFragment.display(report.positions.toTypedArray(), isReport = true, center = true)
showMap(true)
}
is ReportController.Report.EventsReport -> {
- display(report.events)
+ display(report.events.toTypedArray())
showMap(false)
}
is ReportController.Report.StopsReport -> {
mapFragment.display(unitReportsViewModel.geofences.value!!)
- mapFragment.display(report.stops)
+ mapFragment.display(report.stops.toTypedArray())
showMap(true)
}
is ReportController.Report.XlsxReport -> {
@@ -232,7 +232,7 @@ class UnitReportsFragment : Fragment() {
binding.reportsMapContainer.visibility = View.GONE
binding.eventsTable.removeViews(1, max(0, binding.eventsTable.childCount - 1))
- val context = context!!
+ val context = requireContext()
events.forEach { event ->
val layoutParams = TableRow.LayoutParams()
layoutParams.setMargins(
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/ReportController.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/ReportController.kt
index 46bc445..b2e97e6 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/ReportController.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/ReportController.kt
@@ -36,9 +36,9 @@ class ReportController(
): Injectable {
sealed class Report {
- class PositionsReport(val positions: Array<Position>) : Report()
- class EventsReport(val events: Array<EventInformation>) : Report()
- class StopsReport(val stops: Array<Stop>) : Report()
+ class PositionsReport(val positions: List<Position>) : Report()
+ class EventsReport(val events: List<EventInformation>) : Report()
+ class StopsReport(val stops: List<Stop>) : Report()
class XlsxReport(val data: ByteArray) : Report()
object LoadingReport: Report()
}
@@ -82,7 +82,7 @@ class ReportController(
) {
if (!xlsx) {
val result = reportsApi.reportsRouteGet(from, to, deviceId)
- reportFlow.value = Report.PositionsReport(result)
+ reportFlow.value = Report.PositionsReport(result.toList())
} else {
val result = reportsApi.reportsRouteGetXlsx(from, to, deviceId)
reportFlow.value = Report.XlsxReport(result)
@@ -114,7 +114,7 @@ class ReportController(
))
}
- reportFlow.value = Report.EventsReport(result.toTypedArray())
+ reportFlow.value = Report.EventsReport(result)
} else {
val result = reportsApi.reportsEventsGetXlsx(
from, to, EventInformation.reportTypesToStrings(types), deviceId
@@ -132,7 +132,7 @@ class ReportController(
) {
if (!xlsx) {
val result = reportsApi.reportsStopsGet(from, to, deviceId)
- reportFlow.value = Report.StopsReport(result)
+ reportFlow.value = Report.StopsReport(result.toList())
} else {
val result = reportsApi.reportsStopsGetXlsx(from, to, deviceId)
reportFlow.value = Report.XlsxReport(result)