blob: 3a52b84c95b2188241d300afa96c003ec4823672 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/**
* TrackerMap
* Copyright (C) 2021-2022 Iván Ávalos <avalos@disroot.org>, Henoch Ojeda <imhenoch@protonmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import SwiftUI
import shared
struct UnitInformationView: View {
var unit: UnitInformation
var body: some View {
List {
// MARK: - Contact
if let contact = unit.device.contact {
HStack {
Text("contact")
Spacer()
Text(contact).foregroundColor(.secondaryLabel)
}
}
// MARK: - Unique ID
if let uniqueId = unit.device.uniqueId {
HStack {
Text("unique-id")
Spacer()
Text(uniqueId).foregroundColor(.secondaryLabel)
}
}
// MARK: - Date time
if let datetime = unit.position?.fixTime {
HStack {
Text("datetime")
Spacer()
Text(Formatter.companion.formatDate(str: datetime))
.foregroundColor(.secondaryLabel)
}
}
// MARK: - Latitude
if let latitude = unit.position?.latitude {
HStack {
Text("latitude")
Spacer()
Text("\(latitude)").foregroundColor(.secondaryLabel)
}
}
// MARK: - Longitude
if let longitude = unit.position?.longitude {
HStack {
Text("longitude")
Spacer()
Text("\(longitude)").foregroundColor(.secondaryLabel)
}
}
// MARK: - Speed
if let speed = unit.position?.speed {
HStack {
Text("speed")
Spacer()
Text(Formatter.companion.formatSpeed(
speed: Double(truncating: speed), unit: .kmh))
.foregroundColor(.secondaryLabel)
}
}
// MARK: - Address
if let address = unit.position?.address {
HStack {
Text("address")
Spacer()
Text(address).foregroundColor(.secondaryLabel)
}
}
// MARK: - Hours
if let hours = unit.getHourmeter() {
HStack {
Text("hourmeter")
Spacer()
Text(Formatter.companion.formatHours(millis: Int64(truncating: hours)))
.foregroundColor(.secondaryLabel)
}
}
// MARK: - Protocol
if let protocol_ = unit.position?.protocol {
HStack {
Text("protocol")
Spacer()
Text(protocol_).foregroundColor(.secondaryLabel)
}
}
}
}
}
|