/** * TrackerMap * Copyright (C) 2021-2022 Iván Ávalos , Henoch Ojeda * * 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 . */ 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) } } } } }