Fix for supported device batch in NodeInfo

This commit is contained in:
Jake-B 2025-12-15 17:11:21 -05:00
parent 6dd250232c
commit 4f37f6a316
3 changed files with 22 additions and 33 deletions

View file

@ -8119,6 +8119,7 @@
}
},
"Community Support" : {
"extractionState" : "stale",
"localizations" : {
"it" : {
"stringUnit" : {
@ -16011,6 +16012,7 @@
}
},
"Full Support" : {
"extractionState" : "stale",
"localizations" : {
"it" : {
"stringUnit" : {

View file

@ -34,9 +34,7 @@ struct SupportedHardwareBadge: View {
}
var body: some View {
switch hardware.count {
case 1:
let device = hardware[0]
if let device = hardware.first {
VStack {
Image(systemName: device.activelySupported ? "checkmark.seal.fill" : "x.circle")
.font(.largeTitle)
@ -45,26 +43,23 @@ struct SupportedHardwareBadge: View {
.foregroundStyle(.gray)
.font(.caption2)
}
default:
if meshtasticAPI.isLoadingDeviceList {
// Still loading the database from the API
VStack {
ProgressView()
Text("Loading")
.foregroundStyle(.gray)
.font(.caption2)
}
} else {
// Can't find this hardware in the database
VStack {
Image(systemName: "questionmark.circle.fill")
.font(.largeTitle)
.foregroundStyle(.gray)
Text("Unknown")
.foregroundStyle(.gray)
.font(.caption2)
}
} else if meshtasticAPI.isLoadingDeviceList {
// Still loading the database from the API
VStack {
ProgressView()
Text("Loading")
.foregroundStyle(.gray)
.font(.caption2)
}
} else {
// Can't find this hardware in the database
VStack {
Image(systemName: "questionmark.circle.fill")
.font(.largeTitle)
.foregroundStyle(.gray)
Text("Unknown")
.foregroundStyle(.gray)
.font(.caption2)
}
}
}

View file

@ -12,7 +12,6 @@ import MapKit
struct NodeInfoItem: View {
@ObservedObject var node: NodeInfoEntity
@State private var currentDevice: DeviceHardware?
@EnvironmentObject var meshtasticAPI: MeshtasticAPI
var body: some View {
@ -20,17 +19,10 @@ struct NodeInfoItem: View {
ViewThatFits(in: .horizontal) {
HStack {
Spacer()
if user.hwModel != "UNSET" {
if let hwModelId = node.user?.hwModelId {
VStack(alignment: .center) {
Spacer()
Image(systemName: currentDevice?.activelySupported ?? false ? "checkmark.seal.fill" : "seal.fill")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 75, height: 75)
.foregroundStyle(currentDevice?.activelySupported ?? false ? .green : .red)
Text( currentDevice?.activelySupported ?? false ? "Full Support" : "Community Support")
.foregroundStyle(.gray)
.font(.callout)
SupportedHardwareBadge(hwModelId: hwModelId)
}
.accessibilityElement(children: .combine)
Spacer()