mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Localize Telemetry Headers
This commit is contained in:
parent
6ee12efdb8
commit
ef3a6b89f1
9 changed files with 39 additions and 43 deletions
|
|
@ -13,7 +13,7 @@ func TelemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin
|
|||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma")
|
||||
if metricsType == 0 {
|
||||
// Create Device Metrics Header
|
||||
csvString = "Battery Level, Voltage, Channel Utilization, Airtime, Timestamp"
|
||||
csvString = "\(NSLocalizedString("battery.level", comment: "")), \(NSLocalizedString("voltage", comment: "")), \(NSLocalizedString("channel.utilization", comment: "")), \(NSLocalizedString("airtime", comment: "")), \(NSLocalizedString("timestamp", comment: ""))"
|
||||
for dm in telemetry{
|
||||
if dm.metricsType == 0 {
|
||||
csvString += "\n"
|
||||
|
|
@ -30,7 +30,7 @@ func TelemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin
|
|||
}
|
||||
} else if metricsType == 1 {
|
||||
// Create Environment Telemetry Header
|
||||
csvString = "Temperature, Relative Humidity, Barometric Pressure, Gas Resistance, Voltage, Current"
|
||||
csvString = "Temperature, Relative Humidity, Barometric Pressure, Gas Resistance, \(NSLocalizedString("voltage", comment: "")), \(NSLocalizedString("current", comment: "")), \(NSLocalizedString("timestamp", comment: ""))"
|
||||
for dm in telemetry{
|
||||
if dm.metricsType == 1 {
|
||||
csvString += "\n"
|
||||
|
|
@ -58,7 +58,7 @@ func PositionToCsvFile(positions: [PositionEntity]) -> String {
|
|||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma")
|
||||
// Create Position Header
|
||||
csvString = "SeqNo, Latitude, Longitude, Alt, Sats, Speed, Heading, SNR, Timestamp"
|
||||
csvString = "SeqNo, Latitude, Longitude, Altitude, Sats, Speed, Heading, SNR, \(NSLocalizedString("timestamp", comment: ""))"
|
||||
for pos in positions {
|
||||
csvString += "\n"
|
||||
csvString += String(pos.seqNo)
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ struct ChannelMessageList: View {
|
|||
}
|
||||
if message.ackSNR != 0 {
|
||||
VStack {
|
||||
Text("Ack SNR\(String(format: "%.2f", message.ackSNR)) dB")
|
||||
Text("Ack SNR: \(String(format: "%.2f", message.ackSNR)) dB")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ struct UserMessageList: View {
|
|||
}
|
||||
if message.ackSNR != 0 {
|
||||
VStack {
|
||||
Text("Ack SNR\(String(format: "%.2f", message.ackSNR)) dB")
|
||||
Text("Ack SNR: \(String(format: "%.2f", message.ackSNR)) dB")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
// Copyright(c) Garth Vander Houwen 7/7/22.
|
||||
//
|
||||
import SwiftUI
|
||||
#if canImport(Charts)
|
||||
import Charts
|
||||
#endif
|
||||
|
||||
struct DeviceMetricsLog: View {
|
||||
|
||||
|
|
@ -24,7 +22,7 @@ struct DeviceMetricsLog: View {
|
|||
let oneDayAgo = Calendar.current.date(byAdding: .day, value: -3, to: Date())
|
||||
let data = node.telemetries!.filtered(using: NSPredicate(format: "metricsType == 0 && time !=nil && time >= %@", oneDayAgo! as CVarArg))
|
||||
if data.count > 0 {
|
||||
GroupBox(label: Label("Battery Level Trend", systemImage: "battery.100")) {
|
||||
GroupBox(label: Label("battery.level.trend", systemImage: "battery.100")) {
|
||||
Chart(data.array as! [TelemetryEntity], id: \.self) {
|
||||
LineMark(
|
||||
x: .value("Hour", $0.time!.formattedDate(format: "ha")),
|
||||
|
|
@ -43,7 +41,8 @@ struct DeviceMetricsLog: View {
|
|||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
//Add a table for mac and ipad
|
||||
Table(node.telemetries!.reversed() as! [TelemetryEntity]) {
|
||||
TableColumn("Battery Level") { dm in
|
||||
|
||||
TableColumn("battery.level") { dm in
|
||||
if dm.metricsType == 0 {
|
||||
if dm.batteryLevel == 0 {
|
||||
Text("Powered")
|
||||
|
|
@ -53,22 +52,22 @@ struct DeviceMetricsLog: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
TableColumn("Voltage") { dm in
|
||||
TableColumn("voltage") { dm in
|
||||
if dm.metricsType == 0 {
|
||||
Text("\(String(format: "%.2f", dm.voltage))")
|
||||
}
|
||||
}
|
||||
TableColumn("Channel Utilization") { dm in
|
||||
TableColumn("channel.utilization") { dm in
|
||||
if dm.metricsType == 0 {
|
||||
Text(String(format: "%.2f", dm.channelUtilization))
|
||||
}
|
||||
}
|
||||
TableColumn("Airtime") { dm in
|
||||
TableColumn("airtime") { dm in
|
||||
if dm.metricsType == 0 {
|
||||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
}
|
||||
}
|
||||
TableColumn("Date & Time") { dm in
|
||||
TableColumn("timestamp") { dm in
|
||||
if dm.metricsType == 0 {
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
}
|
||||
|
|
@ -83,7 +82,7 @@ struct DeviceMetricsLog: View {
|
|||
GridItem(),
|
||||
GridItem(),
|
||||
GridItem(),
|
||||
GridItem(.fixed(135))
|
||||
GridItem(.fixed(130))
|
||||
]
|
||||
LazyVGrid(columns: columns, alignment: .leading, spacing: 1) {
|
||||
GridRow {
|
||||
|
|
@ -96,10 +95,10 @@ struct DeviceMetricsLog: View {
|
|||
Text("ChUtil")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
Text("AirTm")
|
||||
Text("airtime")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
Text("Date & Time")
|
||||
Text("timestamp")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,17 +46,17 @@ struct EnvironmentMetricsLog: View {
|
|||
Text("\(String(format: "%.2f", em.gasResistance))")
|
||||
}
|
||||
}
|
||||
TableColumn("Current") { em in
|
||||
TableColumn("current") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.current))")
|
||||
}
|
||||
}
|
||||
TableColumn("Voltage") { em in
|
||||
TableColumn("voltage") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text("\(String(format: "%.2f", em.voltage))")
|
||||
}
|
||||
}
|
||||
TableColumn("Date & Time") { em in
|
||||
TableColumn("timestamp") { em in
|
||||
if em.metricsType == 1 {
|
||||
Text(em.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ struct EnvironmentMetricsLog: View {
|
|||
GridItem(),
|
||||
GridItem(),
|
||||
GridItem(),
|
||||
GridItem(.fixed(125))
|
||||
GridItem(.fixed(130))
|
||||
]
|
||||
LazyVGrid(columns: columns, alignment: .leading, spacing: 1) {
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ struct EnvironmentMetricsLog: View {
|
|||
Text("Gas")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
Text("Date & Time")
|
||||
Text("timestamp")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
}
|
||||
|
|
@ -119,11 +119,8 @@ struct EnvironmentMetricsLog: View {
|
|||
HStack {
|
||||
|
||||
Button(role: .destructive) {
|
||||
|
||||
isPresentingClearLogConfirm = true
|
||||
|
||||
} label: {
|
||||
|
||||
Label("Clear Log", systemImage: "trash.fill")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
|
@ -136,22 +133,15 @@ struct EnvironmentMetricsLog: View {
|
|||
titleVisibility: .visible
|
||||
) {
|
||||
Button("Delete all environment metrics?", role: .destructive) {
|
||||
|
||||
if clearTelemetry(destNum: node.num, metricsType: 1, context: context) {
|
||||
|
||||
print("Clear Environment Metrics Log Failed")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
exportString = TelemetryToCsvFile(telemetry: node.telemetries!.array as! [TelemetryEntity], metricsType: 1)
|
||||
isExporting = true
|
||||
|
||||
} label: {
|
||||
|
||||
Label("save", systemImage: "square.and.arrow.down")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
|
@ -162,13 +152,10 @@ struct EnvironmentMetricsLog: View {
|
|||
.navigationTitle("Environment Metrics Log")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(trailing:
|
||||
|
||||
ZStack {
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "????")
|
||||
})
|
||||
.onAppear {
|
||||
|
||||
self.bleManager.context = context
|
||||
}
|
||||
.fileExporter(
|
||||
|
|
@ -177,15 +164,10 @@ struct EnvironmentMetricsLog: View {
|
|||
contentType: .commaSeparatedText,
|
||||
defaultFilename: String("\(node.user!.longName ?? "Node") Environment Metrics Log"),
|
||||
onCompletion: { result in
|
||||
|
||||
if case .success = result {
|
||||
|
||||
print("Environment metrics log download succeeded.")
|
||||
|
||||
self.isExporting = false
|
||||
|
||||
} else {
|
||||
|
||||
print("Environment metrics log download failed: \(result).")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ struct PositionLog: View {
|
|||
GridItem(.fixed(95)),
|
||||
GridItem(),
|
||||
GridItem(),
|
||||
GridItem(.fixed(115))
|
||||
GridItem(.fixed(130))
|
||||
]
|
||||
LazyVGrid(columns: columns, alignment: .leading, spacing: 1) {
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ struct PositionLog: View {
|
|||
Text("Alt")
|
||||
.font(.caption2)
|
||||
.fontWeight(.bold)
|
||||
Text("Timestamp")
|
||||
Text("timestamp")
|
||||
.font(.caption2)
|
||||
.fontWeight(.bold)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ struct PositionConfig: View {
|
|||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
|
||||
Toggle(isOn: $includeTimestamp) { //128
|
||||
Label("Timestamp", systemImage: "clock")
|
||||
Label("timestamp", systemImage: "clock")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@
|
|||
"admin"="admin";
|
||||
"admin.log"="Admin Message Log";
|
||||
"ago"="her";
|
||||
"airtime"="Airtime";
|
||||
"always.on"="Immer an";
|
||||
"app.settings"="App Einstellungen";
|
||||
"are.you.sure"="Bist Du sicher?";
|
||||
"ascii.capable"="ASCII fähig";
|
||||
"available.radios"="Geräte in der Nähe";
|
||||
"automatic.detection"="Automatische erkennung";
|
||||
"battery.level"="Battery Level";
|
||||
"battery.level.trend"="Battery Level Trend";
|
||||
"ble.name"="BLE Name";
|
||||
"%@ ble.errorcode.6"=" %@! The app will automatically reconnect to the preferred radio if it come back in range.";
|
||||
"%@ ble.errorcode.14"="%&!This error usually cannot be fixed without forgetting the device unders Settings > Bluetooth and re-connecting to the radio.";
|
||||
|
|
@ -37,6 +40,7 @@
|
|||
"channel.role.disabled"="Deaktiviert";
|
||||
"channel.role.primary"="Primär";
|
||||
"channel.role.secondary"="Sekundär";
|
||||
"channel.utilization"="Channel Utilization";
|
||||
"channels"="Kanäle";
|
||||
"clear.app.data"="App Daten löschen";
|
||||
"close"="Close";
|
||||
|
|
@ -47,6 +51,7 @@
|
|||
"connecting"="Verbinde...";
|
||||
"contacts"="Kontakte";
|
||||
"copy"="Kopieren";
|
||||
"current"="Current";
|
||||
"default"="Standard";
|
||||
"delete"="Löschen";
|
||||
"device"="Gerät";
|
||||
|
|
@ -197,6 +202,8 @@
|
|||
"telemetry"="Telemetrie (Sensoren)";
|
||||
"telemetry.config"="Telemetrie Einstellungen";
|
||||
"timeout"="Zeitlimit erreicht";
|
||||
"timeout"="Zeitlimit erreicht";
|
||||
"timestamp"="Timestamp";
|
||||
"twitter"="Twitter";
|
||||
"unknown"="Unknown";
|
||||
"unknown.age"="Unbekanntes alter";
|
||||
|
|
@ -205,4 +212,5 @@
|
|||
"update.interval"="Update intervall";
|
||||
"user"="Benutzer";
|
||||
"user.details"="Benutzer Details";
|
||||
"voltage"="Voltage";
|
||||
"waiting"="Warte...";
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@
|
|||
"admin"="Admin";
|
||||
"admin.log"="Admin Message Log";
|
||||
"ago"="ago";
|
||||
"airtime"="Airtime";
|
||||
"always.on"="Always On";
|
||||
"app.settings"="App Settings";
|
||||
"are.you.sure"="Are you sure?";
|
||||
"ascii.capable"="ASCII Capable";
|
||||
"available.radios"="Available Radios";
|
||||
"automatic.detection"="Automatic Detection";
|
||||
"battery.level"="Battery Level";
|
||||
"battery.level.trend"="Battery Level Trend";
|
||||
"ble.name"="BLE Name";
|
||||
"bluetooth"="Bluetooth";
|
||||
"bluetooth.config"="Bluetooth Config";
|
||||
|
|
@ -34,6 +37,7 @@
|
|||
"channel.role.disabled"="Disabled";
|
||||
"channel.role.primary"="Primary";
|
||||
"channel.role.secondary"="Secondary";
|
||||
"channel.utilization"="Channel Utilization";
|
||||
"channels"="Channels";
|
||||
"clear.app.data"="Clear App Data";
|
||||
"close"="Close";
|
||||
|
|
@ -44,6 +48,7 @@
|
|||
"connecting"="Connecting . .";
|
||||
"contacts"="Contacts";
|
||||
"copy"="Copy";
|
||||
"current"="Current";
|
||||
"default"="Default";
|
||||
"delete"="Delete";
|
||||
"device"="Device";
|
||||
|
|
@ -196,7 +201,8 @@
|
|||
"tapback.poop"="Poop";
|
||||
"telemetry"="Telemetry (Sensors)";
|
||||
"telemetry.config"="Telemetry Config";
|
||||
"timeout"="timeout";
|
||||
"timeout"="Timeout";
|
||||
"timestamp"="Timestamp";
|
||||
"twitter"="Twitter";
|
||||
"unknown"="Unknown";
|
||||
"unknown.age"="Unknown Age";
|
||||
|
|
@ -205,4 +211,5 @@
|
|||
"update.interval"="Update Interval";
|
||||
"user"="User";
|
||||
"user.details"="User Details";
|
||||
"voltage"="Voltage";
|
||||
"waiting"="Waiting. . .";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue