From 4f37f6a3167ff817436a9a6d3314c8724e04bde7 Mon Sep 17 00:00:00 2001 From: Jake-B Date: Mon, 15 Dec 2025 17:11:21 -0500 Subject: [PATCH] Fix for supported device batch in NodeInfo --- Localizable.xcstrings | 2 + .../Helpers/SupportedHardwareBadge.swift | 41 ++++++++----------- .../Views/Nodes/Helpers/NodeInfoItem.swift | 12 +----- 3 files changed, 22 insertions(+), 33 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 5261cb00..874f2e5a 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -8119,6 +8119,7 @@ } }, "Community Support" : { + "extractionState" : "stale", "localizations" : { "it" : { "stringUnit" : { @@ -16011,6 +16012,7 @@ } }, "Full Support" : { + "extractionState" : "stale", "localizations" : { "it" : { "stringUnit" : { diff --git a/Meshtastic/Views/Helpers/SupportedHardwareBadge.swift b/Meshtastic/Views/Helpers/SupportedHardwareBadge.swift index 15fe6893..9b343051 100644 --- a/Meshtastic/Views/Helpers/SupportedHardwareBadge.swift +++ b/Meshtastic/Views/Helpers/SupportedHardwareBadge.swift @@ -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) } } } diff --git a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift index 9cae9a5d..c8c9fa89 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift @@ -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()