aboutsummaryrefslogtreecommitdiff
path: root/iosApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-02-27 01:29:49 -0600
committerIván Ávalos <avalos@disroot.org>2022-02-27 01:29:49 -0600
commit596efb5f3b9d9e13407222f4672853363e81a0fc (patch)
treebb1a52cf634036e46c3507ab59e77a454290c5ee /iosApp
parent438c0a9cbb1bcb594028cc4c7fcedfe4a802ef6f (diff)
downloadetbsa-trackermap-mobile-596efb5f3b9d9e13407222f4672853363e81a0fc.tar.gz
etbsa-trackermap-mobile-596efb5f3b9d9e13407222f4672853363e81a0fc.tar.bz2
etbsa-trackermap-mobile-596efb5f3b9d9e13407222f4672853363e81a0fc.zip
Added report map icons and initial impl. of events table
Diffstat (limited to 'iosApp')
-rw-r--r--iosApp/iosApp.xcodeproj/project.pbxproj17
-rw-r--r--iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved9
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg11
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg11
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg11
-rw-r--r--iosApp/iosApp/Details/Reports/UnitReportsView.swift76
-rw-r--r--iosApp/iosApp/Map/MapViewController.swift10
-rw-r--r--iosApp/iosApp/Shared/MarkerTransformations.swift4
-rw-r--r--iosApp/iosApp/en.lproj/Localizable.strings24
-rw-r--r--iosApp/iosApp/es-419.lproj/Localizable.strings24
13 files changed, 251 insertions, 9 deletions
diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj
index abdf916..196675f 100644
--- a/iosApp/iosApp.xcodeproj/project.pbxproj
+++ b/iosApp/iosApp.xcodeproj/project.pbxproj
@@ -45,6 +45,7 @@
E39ABC4327A4E88C00965D05 /* UnitsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E39ABC4227A4E88C00965D05 /* UnitsViewModel.swift */; };
E39ABC4627A4EBD500965D05 /* DevicesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E39ABC4527A4EBD500965D05 /* DevicesView.swift */; };
E39ABC4827A4EDEC00965D05 /* DeviceRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E39ABC4727A4EDEC00965D05 /* DeviceRow.swift */; };
+ E3C651E727CB5426002F6F4C /* Tabler in Frameworks */ = {isa = PBXBuildFile; productRef = E3C651E627CB5426002F6F4C /* Tabler */; };
E3E77EE6279E6CE400150070 /* FlowCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3E77EE5279E6CE400150070 /* FlowCollector.swift */; };
/* End PBXBuildFile section */
@@ -110,6 +111,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ E3C651E727CB5426002F6F4C /* Tabler in Frameworks */,
E36A5A8627B4BFC40070DED5 /* FirebaseMessaging in Frameworks */,
E33A236A27A6898700DD647F /* SwiftUIX in Frameworks */,
E396281D27AF5723005D070E /* WhirlyGlobe.xcframework in Frameworks */,
@@ -289,6 +291,7 @@
packageProductDependencies = (
E33A236927A6898700DD647F /* SwiftUIX */,
E36A5A8527B4BFC40070DED5 /* FirebaseMessaging */,
+ E3C651E627CB5426002F6F4C /* Tabler */,
);
productName = iosApp;
productReference = 7555FF7B242A565900829871 /* iosApp.app */;
@@ -323,6 +326,7 @@
packageReferences = (
E33A236827A6898700DD647F /* XCRemoteSwiftPackageReference "SwiftUIX" */,
E36A5A8427B4BFC40070DED5 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
+ E3C651E527CB5425002F6F4C /* XCRemoteSwiftPackageReference "SwiftTabler" */,
);
productRefGroup = 7555FF7C242A565900829871 /* Products */;
projectDirPath = "";
@@ -648,6 +652,14 @@
minimumVersion = 8.0.0;
};
};
+ E3C651E527CB5425002F6F4C /* XCRemoteSwiftPackageReference "SwiftTabler" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/openalloc/SwiftTabler";
+ requirement = {
+ kind = upToNextMajorVersion;
+ minimumVersion = 0.6.0;
+ };
+ };
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@@ -661,6 +673,11 @@
package = E36A5A8427B4BFC40070DED5 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseMessaging;
};
+ E3C651E627CB5426002F6F4C /* Tabler */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = E3C651E527CB5425002F6F4C /* XCRemoteSwiftPackageReference "SwiftTabler" */;
+ productName = Tabler;
+ };
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7555FF73242A565900829871 /* Project object */;
diff --git a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 7032494..3c172cd 100644
--- a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -110,6 +110,15 @@
}
},
{
+ "package": "SwiftTabler",
+ "repositoryURL": "https://github.com/openalloc/SwiftTabler",
+ "state": {
+ "branch": null,
+ "revision": "3a6c0ba6c1e1e9bcd29c2fb628dc7f1037307ec5",
+ "version": "0.6.0"
+ }
+ },
+ {
"package": "SwiftUIX",
"repositoryURL": "https://github.com/ivan-avalos/SwiftUIX",
"state": {
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json
new file mode 100644
index 0000000..40c489c
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_end.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg
new file mode 100644
index 0000000..ec134ba
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12.36,6H7v6h7.24l0.4,2H18V8h-5.24z"/>
+ <path
+ fill="@android:color/black"
+ d="M14.4,6L14,4L5,4v17h2v-7h5.6l0.4,2h7L20,6h-5.6zM18,14h-3.36l-0.4,-2L7,12L7,6h5.36l0.4,2L18,8v6z"/>
+</svg>
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json
new file mode 100644
index 0000000..3a7979a
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_position.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg
new file mode 100644
index 0000000..c6d39ac
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12,18c3.31,0 6,-2.69 6,-6s-2.69,-6 -6,-6 -6,2.69 -6,6 2.69,6 6,6z"/>
+ <path
+ fill="@android:color/black"
+ d="M12,20c4.42,0 8,-3.58 8,-8s-3.58,-8 -8,-8 -8,3.58 -8,8 3.58,8 8,8zM12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6 2.69,-6 6,-6z"/>
+</svg>
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json
new file mode 100644
index 0000000..3a1438a
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_start.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg
new file mode 100644
index 0000000..59a6142
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12,20c4.41,0 8,-3.59 8,-8s-3.59,-8 -8,-8 -8,3.59 -8,8 3.59,8 8,8zM10,7.5l6,4.5 -6,4.5v-9z"/>
+ <path
+ fill="@android:color/black"
+ d="M12,22c5.52,0 10,-4.48 10,-10S17.52,2 12,2 2,6.48 2,12s4.48,10 10,10zM12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8 -8,-3.59 -8,-8 3.59,-8 8,-8zM10,7.5v9l6,-4.5z"/>
+</svg>
diff --git a/iosApp/iosApp/Details/Reports/UnitReportsView.swift b/iosApp/iosApp/Details/Reports/UnitReportsView.swift
index b73c9e7..1ca1a87 100644
--- a/iosApp/iosApp/Details/Reports/UnitReportsView.swift
+++ b/iosApp/iosApp/Details/Reports/UnitReportsView.swift
@@ -18,6 +18,9 @@
import SwiftUI
import shared
import SwiftUIX
+import Tabler
+
+extension EventInformation: Identifiable {}
struct UnitReportsView: View {
@StateObject var unitReportsViewModel: UnitReportsViewModel
@@ -30,12 +33,77 @@ struct UnitReportsView: View {
wrappedValue: UnitReportsViewModel(deviceId: unit.device.id))
}
+ private var eventsGridItems: [GridItem] = [
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ ]
+
+ @ViewBuilder
+ private func eventsHeader(_ ctx: TablerSortContext<EventInformation>) -> some View {
+ Text("events-table-datetime")
+ Text("events-table-event")
+ Text("events-table-geofence")
+ Text("events-table-address")
+ }
+
+ @ViewBuilder
+ private func eventsRow(_ element: EventInformation) -> some View {
+ if let eventTime = element.event.eventTime {
+ Text(Formatter.companion.formatDate(str: eventTime))
+ } else { Text("") }
+
+ if let eventType = element.event.type {
+ switch EventInformation.companion.stringToReportType(s: eventType) {
+ case .deviceOnline: Text("event-device-online")
+ case .deviceUnknown: Text("event-device-unknown")
+ case .deviceOffline: Text("event-device-offline")
+ case .deviceInactive: Text("event-device-inactive")
+ case .deviceMoving: Text("event-device-moving")
+ case .deviceStopped: Text("event-device-stopped")
+ case .deviceOverspeed: Text("event-device-overspeed")
+ case .deviceFuelDrop: Text("event-device-fuel-drop")
+ case .commandResult: Text("event-command-result")
+ case .geofenceEnter: Text("event-geofence-enter")
+ case .geofenceExit: Text("event-geofence-exit")
+ case .alarm: Text("event-alarm")
+ case .ignitionOn: Text("event-ignition-on")
+ case .ignitionOff: Text("event-ignition-off")
+ case .maintenance: Text("event-maintenance")
+ case .textMessage: Text("event-text-message")
+ case .driverChanged: Text("event-driver-changed")
+ default: Text("event-unknown")
+ }
+ } else { Text("") }
+
+ if let geofenceName = element.geofence?.name {
+ Text(geofenceName)
+ } else { Text("") }
+
+ if let positionAddress = element.position?.address {
+ Text(positionAddress)
+ } else { Text("") }
+ }
+
var body: some View {
VStack {
- MapView(layer: $unitReportsViewModel.layer,
- markers: $unitReportsViewModel.markers,
- selected: $unitReportsViewModel.selectedMarker,
- isReport: true)
+ if unitReportsViewModel.reportType == .events {
+ if let report = unitReportsViewModel.report as? ReportController.ReportEventsReport {
+ TablerList(TablerListConfig<EventInformation>(gridItems: eventsGridItems),
+ headerContent: eventsHeader,
+ rowContent: eventsRow,
+ results: report.events)
+ } else {
+ Spacer()
+ }
+ } else {
+ MapView(layer: $unitReportsViewModel.layer,
+ markers: $unitReportsViewModel.markers,
+ selected: $unitReportsViewModel.selectedMarker,
+ isReport: true)
+ }
+
VStack {
HStack {
Text("report-period")
diff --git a/iosApp/iosApp/Map/MapViewController.swift b/iosApp/iosApp/Map/MapViewController.swift
index 2b4c7d4..f068bf4 100644
--- a/iosApp/iosApp/Map/MapViewController.swift
+++ b/iosApp/iosApp/Map/MapViewController.swift
@@ -205,13 +205,13 @@ class OurMaplyViewController: MaplyViewController {
}
let fontSize = 11.0
- let colorReport = UIColor.green
+ let colorReport = UIColor(red: 0.0, green: 0.5, blue: 0.0, alpha: 1.0)
let colorLabel = UIColor.secondaryLabel
let colorLabelOutline = UIColor.systemBackground
let vectorDesc: [AnyHashable : Any] = [
kMaplyColor: colorReport,
- kMaplyVecWidth: 10.0,
+ kMaplyVecWidth: 15.0,
kMaplyWideVecImpl: kMaplyWideVecImplPerf
]
@@ -233,7 +233,7 @@ class OurMaplyViewController: MaplyViewController {
// For reports, position, start and end icons must be different
switch i {
case markers.startIndex: type = .reportStart
- case markers.endIndex: type = .reportEnd
+ case markers.endIndex - 1: type = .reportEnd
default: type = .reportPosition
}
} else {
@@ -246,8 +246,8 @@ class OurMaplyViewController: MaplyViewController {
// For reports, position, start and end sizes must be different
switch i {
case markers.startIndex: size = 50.0
- case markers.endIndex: size = 50.0
- default: size = 25.0
+ case markers.endIndex - 1: size = 50.0
+ default: size = 26.0
}
}
screenMarker.size = CGSize(width: size, height: size)
diff --git a/iosApp/iosApp/Shared/MarkerTransformations.swift b/iosApp/iosApp/Shared/MarkerTransformations.swift
index 2e71980..1e51907 100644
--- a/iosApp/iosApp/Shared/MarkerTransformations.swift
+++ b/iosApp/iosApp/Shared/MarkerTransformations.swift
@@ -42,6 +42,10 @@ class MarkerTransformations {
case .trolleybus: imageName = "MapTrolleybus"
case .truck: imageName = "MapTruck"
case .van: imageName = "MapVan"
+
+ case .reportStart: imageName = "MapReportStart"
+ case .reportPosition: imageName = "MapReportPosition"
+ case .reportEnd: imageName = "MapReportEnd"
default: break
}
return imageName
diff --git a/iosApp/iosApp/en.lproj/Localizable.strings b/iosApp/iosApp/en.lproj/Localizable.strings
index 56a934b..fee132b 100644
--- a/iosApp/iosApp/en.lproj/Localizable.strings
+++ b/iosApp/iosApp/en.lproj/Localizable.strings
@@ -68,6 +68,30 @@
"period-this-month" = "Month";
"period-last-30" = "Last 30d";
+"events-table-event" = "Event";
+"events-table-datetime" = "Datetime";
+"events-table-geofence" = "Geofence";
+"events-table-address" = "Address";
+
+"event-device-online" = "Status online";
+"event-device-unknown" = "Status unknown";
+"event-device-offline" = "Status offline";
+"event-device-inactive" = "Device inactive";
+"event-device-moving" = "Device moving";
+"event-device-stopped" = "Device stopped";
+"event-device-overspeed" = "Speed limit exceeded";
+"event-device-fuel-drop" = "Fuel drop";
+"event-command-result" = "Command result";
+"event-geofence-enter" = "Geofence entered";
+"event-geofence-exit" = "Geofence exited";
+"event-alarm" = "Alarm";
+"event-ignition-on" = "Ignition on";
+"event-ignition-off" = "Ignition off";
+"event-maintenance" = "Maintenance required";
+"event-text-message" = "Text message received";
+"event-driver-changed" = "Driver changed";
+"event-unknown" = "Unknown event";
+
"send-command" = "Send command";
"send-command-confirm" = "Are you sure you want to send the command?";
diff --git a/iosApp/iosApp/es-419.lproj/Localizable.strings b/iosApp/iosApp/es-419.lproj/Localizable.strings
index eae03df..0105e5d 100644
--- a/iosApp/iosApp/es-419.lproj/Localizable.strings
+++ b/iosApp/iosApp/es-419.lproj/Localizable.strings
@@ -68,6 +68,30 @@
"period-this-month" = "Mes";
"period-last-30" = "Últimos 30d";
+"events-table-event" = "Evento";
+"events-table-datetime" = "Fecha y hora";
+"events-table-geofence" = "Geocerca";
+"events-table-address" = "Dirección";
+
+"event-device-online" = "Unidad en línea";
+"event-device-unknown" = "Unidad en estado desconocido";
+"event-device-offline" = "Unidad fuera de línea";
+"event-device-inactive" = "Unidad inactiva";
+"event-device-moving" = "Unidad en movimiento";
+"event-device-stopped" = "Unidad detenida";
+"event-device-overspeed" = "Excedido el límite de velocidad";
+"event-device-fuel-drop" = "Pérdida de combustible";
+"event-command-result" = "Resultado del comando";
+"event-geofence-enter" = "Entrada en la geocerca";
+"event-geofence-exit" = "Salida de la geocerca";
+"event-alarm" = "Alarma";
+"event-ignition-on" = "Ignición encendida";
+"event-ignition-off" = "Ignición apagada";
+"event-maintenance" = "Se requiere mantenimiento";
+"event-text-message" = "Mensaje de texto recibido";
+"event-driver-changed" = "El conductor ha cambiado";
+"event-unknown" = "Evento desconocido";
+
"send-command" = "Enviar comando";
"send-command-confirm" = "¿Está seguro que desea enviar el comando?";