From e0db485458397b5a53c700067b8a65111e8d287d Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 8 Apr 2026 14:19:45 -0700 Subject: [PATCH] Channel display fix --- Localizable.xcstrings | 242 ++++++++++------------- Meshtastic/Views/Settings/Channels.swift | 18 +- Meshtastic/Views/Settings/Settings.swift | 6 +- 3 files changed, 119 insertions(+), 147 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 30e6245e..8b574191 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -2,7 +2,6 @@ "sourceLanguage" : "en", "strings" : { "" : { - "shouldTranslate" : false, "localizations" : { "da" : { "stringUnit" : { @@ -10,7 +9,8 @@ "value" : "" } } - } + }, + "shouldTranslate" : false }, "\t%@" : { "localizations" : { @@ -225,95 +225,83 @@ }, "shouldTranslate" : false }, - " : %@" : { + ": %@" : { "localizations" : { - "da" : { - "stringUnit" : { - "state" : "translated", - "value" : " : %@" - } - }, "es" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } }, "it" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } }, "ja" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } }, "sr" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } }, "zh-Hant-TW" : { "stringUnit" : { "state" : "translated", - "value" : " : %@" + "value" : ": %@" } } }, "shouldTranslate" : false }, - " : %d" : { + ": %d" : { "localizations" : { - "da" : { - "stringUnit" : { - "state" : "translated", - "value" : " : %d" - } - }, "es" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } }, "it" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } }, "ja" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } }, "sr" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } }, "zh-Hant-TW" : { "stringUnit" : { "state" : "translated", - "value" : " : %d" + "value" : ": %d" } } }, @@ -3018,7 +3006,9 @@ } } }, - "A default self-signed certificate is included for localhost connections. Import a custom .p12 if needed. Client CA (.pem) validates connecting TAK clients." : {}, + "A default self-signed certificate is included for localhost connections. Import a custom .p12 if needed. Client CA (.pem) validates connecting TAK clients." : { + + }, "A green lock means the channel is securely encrypted with either a 128 or 256 bit AES key." : { "localizations" : { "es" : { @@ -3863,7 +3853,9 @@ } } }, - "Add CA" : {}, + "Add CA" : { + + }, "Add Channel" : { "localizations" : { "da" : { @@ -11484,8 +11476,12 @@ } } }, - "Client CA Certificate" : {}, - "Client Configuration" : {}, + "Client CA Certificate" : { + + }, + "Client Configuration" : { + + }, "Client Hidden" : { "extractionState" : "stale", "localizations" : { @@ -12186,7 +12182,9 @@ } } }, - "Configuration" : {}, + "Configuration" : { + + }, "Configuration for: %@" : { "localizations" : { "da" : { @@ -14570,7 +14568,9 @@ } } }, - "Delete All" : {}, + "Delete All" : { + + }, "Delete all config, keys and BLE bonds? " : { "localizations" : { "es" : { @@ -18174,7 +18174,9 @@ } } }, - "Download TAK Server Data Package" : {}, + "Download TAK Server Data Package" : { + + }, "Drag & Drop Firmware Update" : { "localizations" : { "da" : { @@ -18961,7 +18963,9 @@ } } }, - "Enable TAK Server" : {}, + "Enable TAK Server" : { + + }, "Enable this device as a Store and Forward server. Requires an ESP32 device with PSRAM." : { "localizations" : { "da" : { @@ -19728,8 +19732,12 @@ } } }, - "Enter P12 Password" : {}, - "Enter the password for the PKCS#12 file" : {}, + "Enter P12 Password" : { + + }, + "Enter the password for the PKCS#12 file" : { + + }, "environment" : { "extractionState" : "stale", "localizations" : { @@ -23771,7 +23779,9 @@ } } }, - "Generate a data package (.zip) to configure TAK clients to connect to this server." : {}, + "Generate a data package (.zip) to configure TAK clients to connect to this server." : { + + }, "Generate a new private key to replace the one currently in use. The public key will automatically be regenerated from your private key." : { "localizations" : { "es" : { @@ -27266,10 +27276,18 @@ } } }, - "Import" : {}, - "Import .pem" : {}, - "Import Custom .p12" : {}, - "Import Error" : {}, + "Import" : { + + }, + "Import .pem" : { + + }, + "Import Custom .p12" : { + + }, + "Import Error" : { + + }, "Import Route" : { "localizations" : { "da" : { @@ -28983,6 +29001,9 @@ } } } + }, + "Loading..." : { + }, "Local Network Access" : { "comment" : "A label displayed above the options for local network access.", @@ -32997,7 +33018,9 @@ } } }, - "mTLS" : {}, + "mTLS" : { + + }, "Multiplier" : { "localizations" : { "da" : { @@ -39159,7 +39182,9 @@ } } }, - "Port" : {}, + "Port" : { + + }, "Position" : { "localizations" : { "da" : { @@ -42816,7 +42841,9 @@ } } }, - "Reload Bundled Certificates" : {}, + "Reload Bundled Certificates" : { + + }, "Remote administration for: %@" : { "localizations" : { "da" : { @@ -43623,7 +43650,9 @@ } } }, - "Reset to Default" : {}, + "Reset to Default" : { + + }, "Restart" : { "localizations" : { "da" : { @@ -43676,7 +43705,9 @@ } } }, - "Restart Server" : {}, + "Restart Server" : { + + }, "Restart to the node you are connected to" : { "localizations" : { "da" : { @@ -46448,8 +46479,6 @@ } } }, - "Secure mTLS connection on port 8089. Both server and client certificates are required." : {}, - "Secure mTLS connection on port 8089. Both server and client certificates are required. TAK Channel Index selects the channel index where TAK messages will be sent." : { "comment" : "A footer for the TAK Server configuration section.", "isCommentAutoGenerated" : true @@ -49143,7 +49172,9 @@ } } }, - "Server Certificate" : {}, + "Server Certificate" : { + + }, "Server Option" : { "localizations" : { "da" : { @@ -49190,7 +49221,9 @@ } } }, - "Server Status" : {}, + "Server Status" : { + + }, "Set" : { "localizations" : { "da" : { @@ -49236,6 +49269,9 @@ } } } + }, + "Set a channel name" : { + }, "Set LoRa Region" : { "localizations" : { @@ -49855,6 +49891,9 @@ } } } + }, + "Share with TAK Buddies" : { + }, "Share your location in real-time and keep your group coordinated with integrated GPS features." : { "localizations" : { @@ -52018,7 +52057,9 @@ } } }, - "Status" : {}, + "Status" : { + + }, "Stay Connected Anywhere" : { "localizations" : { "de" : { @@ -52656,9 +52697,16 @@ } } } + }, + "TAK Cannot Be Used on Public Channel" : { + + }, + "TAK Channel Index" : { + + }, + "TAK Server" : { }, - "TAK Server" : {}, "TAK Tracker" : { "extractionState" : "stale", "localizations" : { @@ -55989,7 +56037,9 @@ } } }, - "TLS Certificates" : {}, + "TLS Certificates" : { + + }, "TLS Enabled" : { "localizations" : { "da" : { @@ -62889,88 +62939,6 @@ } } } - }, - ": %@" : { - "localizations" : { - "es" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - }, - "it" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - }, - "ja" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - }, - "sr" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - }, - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - }, - "zh-Hant-TW" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %@" - } - } - }, - "shouldTranslate" : false - }, - ": %d" : { - "localizations" : { - "es" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - }, - "it" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - }, - "ja" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - }, - "sr" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - }, - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - }, - "zh-Hant-TW" : { - "stringUnit" : { - "state" : "translated", - "value" : ": %d" - } - } - }, - "shouldTranslate" : false } }, "version" : "1.1" diff --git a/Meshtastic/Views/Settings/Channels.swift b/Meshtastic/Views/Settings/Channels.swift index f5c89071..ef3cead4 100644 --- a/Meshtastic/Views/Settings/Channels.swift +++ b/Meshtastic/Views/Settings/Channels.swift @@ -28,7 +28,7 @@ struct Channels: View { @Environment(\.sizeCategory) var sizeCategory @Environment(\.colorScheme) private var colorScheme - var node: NodeInfoEntity? + @ObservedObject var node: NodeInfoEntity @State var hasChanges = false @State var hasValidKey = true @@ -65,8 +65,8 @@ struct Channels: View { TipView(CreateChannelsTip(), arrowEdge: .bottom) .tipBackground(colorScheme == .dark ? Color(.systemBackground) : Color(.secondarySystemBackground)) .listRowSeparator(.hidden) - if node != nil && node?.myInfo != nil { - ForEach(node?.myInfo?.channels?.array as? [ChannelEntity] ?? [], id: \.self) { (channel: ChannelEntity) in + if node.myInfo != nil { + ForEach(node.myInfo?.channels?.array as? [ChannelEntity] ?? [], id: \.self) { (channel: ChannelEntity) in Button(action: { channelIndex = channel.index channelRole = Int(channel.role) @@ -177,7 +177,7 @@ struct Channels: View { selectedChannel!.downlinkEnabled = downlink selectedChannel!.positionPrecision = Int32(positionPrecision) - guard let mutableChannels = node?.myInfo?.channels?.mutableCopy() as? NSMutableOrderedSet else { + guard let mutableChannels = node.myInfo?.channels?.mutableCopy() as? NSMutableOrderedSet else { return } if mutableChannels.contains(selectedChannel as Any) { @@ -186,7 +186,7 @@ struct Channels: View { } else { mutableChannels.add(selectedChannel as Any) } - node?.myInfo?.channels = mutableChannels.copy() as? NSOrderedSet + node.myInfo?.channels = mutableChannels.copy() as? NSOrderedSet context.refresh(selectedChannel!, mergeChanges: true) if channel.role != Channel.Role.disabled { do { @@ -216,14 +216,14 @@ struct Channels: View { } } Task { - _ = try await accessoryManager.saveChannel(channel: channel, fromUser: node!.user!, toUser: node!.user!) + _ = try await accessoryManager.saveChannel(channel: channel, fromUser: node.user!, toUser: node.user!) Task { @MainActor in selectedChannel = nil channelName = "" channelRole = 2 hasChanges = false } - accessoryManager.mqttManager.connectFromConfigSettings(node: node!) + accessoryManager.mqttManager.connectFromConfigSettings(node: node) } } label: { Label("Save", systemImage: "square.and.arrow.down") @@ -246,10 +246,10 @@ struct Channels: View { #endif } } - if node?.myInfo?.channels?.array.count ?? 0 < 8 && node != nil { + if node.myInfo?.channels?.array.count ?? 0 < 8 { Button { - let channelIndexes = node?.myInfo?.channels?.compactMap({(ch) -> Int in + let channelIndexes = node.myInfo?.channels?.compactMap({(ch) -> Int in return (ch as AnyObject).index }) let firstChannelIndex = firstMissingChannelIndex(channelIndexes ?? []) diff --git a/Meshtastic/Views/Settings/Settings.swift b/Meshtastic/Views/Settings/Settings.swift index 449efc6c..6e478a40 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -487,7 +487,11 @@ struct Settings: View { case .lora: LoRaConfig(node: nodes.first(where: { $0.num == selectedNode })) case .channels: - Channels(node: node) + if let node = node { + Channels(node: node) + } else { + Text("Loading...") + } case .shareQRCode: ShareChannels(node: node) case .user: