mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Improved layout for phone single table cell
This commit is contained in:
parent
b32272bcaf
commit
069bc1f11b
5 changed files with 92 additions and 75 deletions
|
|
@ -679,7 +679,7 @@
|
|||
"Airtime" : {
|
||||
|
||||
},
|
||||
"AirTm %@%%" : {
|
||||
"Airtime %@%%" : {
|
||||
|
||||
},
|
||||
"Alert" : {
|
||||
|
|
@ -1427,9 +1427,6 @@
|
|||
},
|
||||
"Barometric Pressure" : {
|
||||
|
||||
},
|
||||
"Batt %@%%" : {
|
||||
|
||||
},
|
||||
"Battery Level %" : {
|
||||
|
||||
|
|
@ -2791,6 +2788,9 @@
|
|||
},
|
||||
"Channel Role" : {
|
||||
|
||||
},
|
||||
"Channel Utilization %@%% " : {
|
||||
|
||||
},
|
||||
"channel.role.disabled" : {
|
||||
"extractionState" : "migrated",
|
||||
|
|
@ -3090,9 +3090,6 @@
|
|||
},
|
||||
"CHG" : {
|
||||
|
||||
},
|
||||
"ChUtil %@%% " : {
|
||||
|
||||
},
|
||||
"Clear" : {
|
||||
|
||||
|
|
@ -22291,9 +22288,6 @@
|
|||
},
|
||||
"Via Mqtt" : {
|
||||
|
||||
},
|
||||
"Volt %@ " : {
|
||||
|
||||
},
|
||||
"voltage" : {
|
||||
"localizations" : {
|
||||
|
|
@ -22352,6 +22346,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Voltage %@ " : {
|
||||
|
||||
},
|
||||
"waiting" : {
|
||||
"localizations" : {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
DD3501892852FC3B000FC853 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3501882852FC3B000FC853 /* Settings.swift */; };
|
||||
DD354FD92BD96A0B0061A25F /* IAQScale.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD354FD82BD96A0B0061A25F /* IAQScale.swift */; };
|
||||
DD3619152B1EF9F900C41C8C /* LocationsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3619142B1EF9F900C41C8C /* LocationsHandler.swift */; };
|
||||
DD3CC24C2C498D6C001BD3A2 /* BatteryCompact.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3CC24B2C498D6C001BD3A2 /* BatteryCompact.swift */; };
|
||||
DD3CC6B528E33FD100FA9159 /* ShareChannels.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3CC6B428E33FD100FA9159 /* ShareChannels.swift */; };
|
||||
DD3CC6BC28E366DF00FA9159 /* Meshtastic.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DD3CC6BA28E366DF00FA9159 /* Meshtastic.xcdatamodeld */; };
|
||||
DD3CC6BE28E4CD9800FA9159 /* BatteryGauge.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3CC6BD28E4CD9800FA9159 /* BatteryGauge.swift */; };
|
||||
|
|
@ -248,12 +249,12 @@
|
|||
2519268F2C3CB44900249DF5 /* ClientHistoryButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientHistoryButton.swift; sourceTree = "<group>"; };
|
||||
251926912C3CB52300249DF5 /* DeleteNodeButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteNodeButton.swift; sourceTree = "<group>"; };
|
||||
25AECD4E2C2F723200862C8E /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
|
||||
25C49D8F2C471AEA0024FBD1 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
|
||||
25F5D5BD2C3F6D87008036E3 /* NavigationState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationState.swift; sourceTree = "<group>"; };
|
||||
25F5D5BF2C3F6DA6008036E3 /* Router.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = "<group>"; };
|
||||
25F5D5C12C3F6E4B008036E3 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
|
||||
25F5D5C72C4375A8008036E3 /* MeshtasticTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MeshtasticTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
25F5D5D02C4375DF008036E3 /* RouterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterTests.swift; sourceTree = "<group>"; };
|
||||
25C49D8F2C471AEA0024FBD1 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
|
||||
6D825E612C34786C008DBEE4 /* CommonRegex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonRegex.swift; sourceTree = "<group>"; };
|
||||
6DA39D8D2A92DC52007E311C /* MeshtasticAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshtasticAppDelegate.swift; sourceTree = "<group>"; };
|
||||
6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectionSensorLog.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -307,6 +308,7 @@
|
|||
DD3619132B1EE20700C41C8C /* MeshtasticDataModelV21.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV21.xcdatamodel; sourceTree = "<group>"; };
|
||||
DD3619142B1EF9F900C41C8C /* LocationsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationsHandler.swift; sourceTree = "<group>"; };
|
||||
DD398EBD2B93F640002B4C51 /* MeshtasticDataModelV 29.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 29.xcdatamodel"; sourceTree = "<group>"; };
|
||||
DD3CC24B2C498D6C001BD3A2 /* BatteryCompact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryCompact.swift; sourceTree = "<group>"; };
|
||||
DD3CC6B428E33FD100FA9159 /* ShareChannels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareChannels.swift; sourceTree = "<group>"; };
|
||||
DD3CC6BB28E366DF00FA9159 /* MeshtasticDataModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModel.xcdatamodel; sourceTree = "<group>"; };
|
||||
DD3CC6BD28E4CD9800FA9159 /* BatteryGauge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryGauge.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -882,6 +884,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DD3CC6BD28E4CD9800FA9159 /* BatteryGauge.swift */,
|
||||
DD3CC24B2C498D6C001BD3A2 /* BatteryCompact.swift */,
|
||||
DDB75A222A13CDA9006ED576 /* BatteryLevelCompact.swift */,
|
||||
DD457187293C7E63000C49FB /* BLESignalStrengthIndicator.swift */,
|
||||
DD47E3D526F17ED900029299 /* CircleText.swift */,
|
||||
|
|
@ -1320,6 +1323,7 @@
|
|||
DDB75A112A059258006ED576 /* Url.swift in Sources */,
|
||||
DDAD49ED2AFB39DC00B4425D /* MeshMap.swift in Sources */,
|
||||
DD8169FB271F1F3A00F4AB02 /* MeshLog.swift in Sources */,
|
||||
DD3CC24C2C498D6C001BD3A2 /* BatteryCompact.swift in Sources */,
|
||||
DD1B8F402B35E2F10022AABC /* GPSStatus.swift in Sources */,
|
||||
DD8ED9C52898D51F00B3B0AB /* NetworkConfig.swift in Sources */,
|
||||
DDC3B274283F411B00AC321C /* LastHeardText.swift in Sources */,
|
||||
|
|
|
|||
68
Meshtastic/Views/Helpers/BatteryCompact.swift
Normal file
68
Meshtastic/Views/Helpers/BatteryCompact.swift
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// BatteryCompact.swift
|
||||
// Meshtastic
|
||||
//
|
||||
// Created by Garth Vander Houwen on 7/18/24.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
struct BatteryCompact: View {
|
||||
@State var batteryLevel: Int32
|
||||
var font: Font
|
||||
var iconFont: Font
|
||||
var color: Color
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
if batteryLevel == 100 {
|
||||
Image(systemName: "battery.100.bolt")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 100 && batteryLevel > 74 {
|
||||
Image(systemName: "battery.75")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 75 && batteryLevel > 49 {
|
||||
Image(systemName: "battery.50")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 50 && batteryLevel > 14 {
|
||||
Image(systemName: "battery.25")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 15 && batteryLevel > 0 {
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel == 0 {
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(.red)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel > 100 {
|
||||
Image(systemName: "powerplug")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
}
|
||||
if batteryLevel > 100 {
|
||||
Text("PWD")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
} else if batteryLevel == 100 {
|
||||
Text("CHG")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
} else {
|
||||
Text("\(batteryLevel)%")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,61 +19,7 @@ struct BatteryLevelCompact: View {
|
|||
let mostRecent = deviceMetrics?.lastObject as? TelemetryEntity
|
||||
let batteryLevel = mostRecent?.batteryLevel ?? 0
|
||||
if deviceMetrics?.count ?? 0 > 0 {
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
if batteryLevel == 100 {
|
||||
Image(systemName: "battery.100.bolt")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 100 && batteryLevel > 74 {
|
||||
|
||||
Image(systemName: "battery.75")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 75 && batteryLevel > 49 {
|
||||
|
||||
Image(systemName: "battery.50")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 50 && batteryLevel > 14 {
|
||||
|
||||
Image(systemName: "battery.25")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel < 15 && batteryLevel > 0 {
|
||||
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel == 0 {
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(.red)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
} else if batteryLevel > 100 {
|
||||
Image(systemName: "powerplug")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
}
|
||||
if batteryLevel > 100 {
|
||||
Text("PWD")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
} else if batteryLevel == 100 {
|
||||
Text("CHG")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
} else {
|
||||
Text("\(batteryLevel)%")
|
||||
.foregroundStyle(.gray)
|
||||
.font(font)
|
||||
}
|
||||
}
|
||||
BatteryCompact(batteryLevel: batteryLevel, font: font, iconFont: iconFont, color: color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ struct DeviceMetricsLog: View {
|
|||
.sorted { $0.time! < $1.time! }
|
||||
if chartData.count > 0 {
|
||||
GroupBox(label: Label("\(deviceMetrics.count) Readings Total", systemImage: "chart.xyaxis.line")) {
|
||||
|
||||
Chart {
|
||||
ForEach(chartData, id: \.self) { point in
|
||||
Plot {
|
||||
|
|
@ -104,18 +103,21 @@ struct DeviceMetricsLog: View {
|
|||
TableColumn("battery.level") { dm in
|
||||
HStack {
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
.fontWeight(.semibold)
|
||||
Spacer()
|
||||
Image(systemName: "bolt")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
.foregroundStyle(.yellow)
|
||||
Text("Voltage \(String(format: "%.2f", dm.voltage)) ")
|
||||
.foregroundStyle(.gray)
|
||||
BatteryCompact(batteryLevel: dm.batteryLevel, font: .caption, iconFont: .callout, color: .accentColor)
|
||||
}
|
||||
.font(.caption)
|
||||
HStack {
|
||||
if dm.batteryLevel > 100 {
|
||||
Text("PWD")
|
||||
} else {
|
||||
Text("Batt \(String(dm.batteryLevel))%")
|
||||
}
|
||||
Text("Volt \(String(format: "%.2f", dm.voltage)) ")
|
||||
Text("ChUtil \(String(format: "%.2f", dm.channelUtilization))% ")
|
||||
Text("AirTm \(String(format: "%.2f", dm.airUtilTx))%")
|
||||
Text("Channel Utilization \(String(format: "%.2f", dm.channelUtilization))% ")
|
||||
.foregroundColor(dm.channelUtilization < 25 ? .gray : (dm.channelUtilization > 50 ? .red : .orange))
|
||||
Text("Airtime \(String(format: "%.2f", dm.airUtilTx))%")
|
||||
.foregroundColor(.gray)
|
||||
Spacer()
|
||||
}
|
||||
.font(.caption)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue