From 0758aaea56c5c1b4577dee0796f77e5ab76a6872 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 14 Feb 2024 21:43:29 -0800 Subject: [PATCH] Clean up the node list --- .../Views/Helpers/LoRaSignalStrength.swift | 7 +- .../Views/Nodes/Helpers/NodeListItem.swift | 99 ++++++++++++------- .../Settings/Config/Module/MQTTConfig.swift | 2 +- 3 files changed, 70 insertions(+), 38 deletions(-) diff --git a/Meshtastic/Views/Helpers/LoRaSignalStrength.swift b/Meshtastic/Views/Helpers/LoRaSignalStrength.swift index d388cb93..9173d93d 100644 --- a/Meshtastic/Views/Helpers/LoRaSignalStrength.swift +++ b/Meshtastic/Views/Helpers/LoRaSignalStrength.swift @@ -28,15 +28,16 @@ struct LoRaSignalStrengthMeter: View { .foregroundColor(getRssiColor(rssi: rssi)) .font(.caption2) } - .padding(.bottom, 2) } else { Gauge(value: Double(signalStrength.rawValue), in: 0...3) { } currentValueLabel: { Image(systemName: "dot.radiowaves.left.and.right") - .font(.caption) + .font(.callout) + .frame(width: 30) Text("Signal \(signalStrength.description)") - .font(.caption) + .font(.callout) .foregroundColor(.gray) + .fixedSize() } .gaugeStyle(.accessoryLinear) .tint(gradient) diff --git a/Meshtastic/Views/Nodes/Helpers/NodeListItem.swift b/Meshtastic/Views/Nodes/Helpers/NodeListItem.swift index 9365cffa..615d54ce 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeListItem.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeListItem.swift @@ -21,7 +21,9 @@ struct NodeListItem: View { LazyVStack(alignment: .leading) { HStack { VStack(alignment: .leading) { - CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65) + CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 70) + .padding(.trailing, 5) + BatteryLevelCompact(node: node, font: .caption, iconFont: .callout, color: .accentColor) .padding(.trailing, 5) } VStack(alignment: .leading) { @@ -41,7 +43,10 @@ struct NodeListItem: View { .font(.callout) .symbolRenderingMode(.hierarchical) .foregroundColor(.green) - Text("connected").font(.callout) + .frame(width: 30, height: 15) + Text("connected") + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) + .foregroundColor(.gray) } } HStack { @@ -49,8 +54,9 @@ struct NodeListItem: View { .font(.callout) .symbolRenderingMode(.hierarchical) .foregroundColor(node.isOnline ? .green : .orange) + .frame(width: 30, height: 20) LastHeardText(lastHeard: node.lastHeard) - .font(.caption) + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) .foregroundColor(.gray) } HStack { @@ -58,8 +64,9 @@ struct NodeListItem: View { Image(systemName: role?.systemName ?? "figure") .font(.callout) .symbolRenderingMode(.hierarchical) + .frame(width: 30, height: 20) Text("Role: \(role?.name ?? "unknown".localized)") - .font(.caption) + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) .foregroundColor(.gray) } if node.isStoreForwardRouter { @@ -67,8 +74,9 @@ struct NodeListItem: View { Image(systemName: "envelope.arrow.triangle.branch") .font(.callout) .symbolRenderingMode(.hierarchical) + .frame(width: 30, height: 20) Text("storeforward".localized) - .font(.caption) + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) .foregroundColor(.gray) } } @@ -85,7 +93,9 @@ struct NodeListItem: View { Image(systemName: "lines.measurement.horizontal") .font(.callout) .symbolRenderingMode(.hierarchical) - DistanceText(meters: metersAway).font(.caption) + .frame(width: 30, height: 20) + DistanceText(meters: metersAway) + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) .foregroundColor(.gray) } } @@ -98,7 +108,9 @@ struct NodeListItem: View { Image(systemName: "lines.measurement.horizontal") .font(.callout) .symbolRenderingMode(.hierarchical) - DistanceText(meters: metersAway).font(.caption) + .frame(width: 30, height: 20) + DistanceText(meters: metersAway) + .font(UIDevice.current.userInterfaceIdiom == .phone ? .callout : .caption) .foregroundColor(.gray) } } @@ -109,6 +121,7 @@ struct NodeListItem: View { Image(systemName: "fibrechannel") .font(.callout) .symbolRenderingMode(.hierarchical) + .frame(width: 30, height: 20) Text("Channel: \(node.channel)") .foregroundColor(.gray) .font(.caption) @@ -117,44 +130,62 @@ struct NodeListItem: View { Image(systemName: "network") .symbolRenderingMode(.hierarchical) .font(.callout) + .frame(width: 30, height: 20) Text("Via MQTT") .foregroundColor(.gray) .font(.caption) } } + if node.hasPositions || node.hasEnvironmentMetrics || node.hasDetectionSensorMetrics || node.hasTraceRoutes { + HStack { + Image(systemName: "scroll") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + Text("Logs:") + .foregroundColor(.gray) + .font(.callout) + if node.hasDeviceMetrics { + Image(systemName: "flipphone") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + } + if node.hasPositions { + Image(systemName: "mappin.and.ellipse") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + } + if node.hasEnvironmentMetrics { + Image(systemName: "cloud.sun.rain") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + } + if node.hasDetectionSensorMetrics { + Image(systemName: "sensor") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + } + if node.hasTraceRoutes { + Image(systemName: "signpost.right.and.left") + .symbolRenderingMode(.hierarchical) + .font(.callout) + .frame(width: 30, height: 20) + } + } + .padding(.top) + } if !connected { HStack { let preset = ModemPresets(rawValue: Int(modemPreset)) LoRaSignalStrengthMeter(snr: node.snr, rssi: node.rssi, preset: preset ?? ModemPresets.longFast, compact: true) - .padding(.top, 2) + } + .padding(.top) } - HStack { - BatteryLevelCompact(node: node, font: .caption, iconFont: .callout, color: .accentColor) - - if node.hasPositions { - Image(systemName: "mappin.and.ellipse") - .symbolRenderingMode(.hierarchical) - .font(.callout) - - } - if node.hasEnvironmentMetrics { - Image(systemName: "cloud.sun.rain") - .symbolRenderingMode(.hierarchical) - .font(.callout) - } - if node.hasDetectionSensorMetrics { - Image(systemName: "sensor") - .symbolRenderingMode(.hierarchical) - .font(.callout) - } - if node.hasTraceRoutes { - Image(systemName: "signpost.right.and.left") - .symbolRenderingMode(.hierarchical) - .font(.callout) - } - } - .padding(.top, 3) } .frame(maxWidth: .infinity, alignment: .leading) } diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index f1ce1aa3..bfaaa031 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -33,7 +33,7 @@ struct MQTTConfig: View { if node != nil && node?.loRaConfig != nil { let rc = RegionCodes(rawValue: Int(node?.loRaConfig?.regionCode ?? 0)) if rc?.dutyCycle ?? 0 <= 10 { - Text("Your region has a \(rc?.dutyCycle ?? 0)% duty cycle. MQTT is not advised when you are duty cycle restricted, the extra traffice will quickly overwhelm your LoRa mesh.") + Text("Your region has a \(rc?.dutyCycle ?? 0)% duty cycle. MQTT is not advised when you are duty cycle restricted, the extra traffic will quickly overwhelm your LoRa mesh.") .font(.callout) .foregroundColor(.red) }