mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Improved localization helper for strings
This commit is contained in:
parent
53ffeaa735
commit
3b76207247
44 changed files with 308 additions and 344 deletions
|
|
@ -8,31 +8,6 @@
|
|||
import Foundation
|
||||
import MapKit
|
||||
|
||||
enum KeyboardType: Int, CaseIterable, Identifiable {
|
||||
|
||||
case defaultKeyboard = 0
|
||||
case asciiCapable = 1
|
||||
case twitter = 9
|
||||
case emailAddress = 7
|
||||
case numbersAndPunctuation = 2
|
||||
|
||||
var id: Int { self.rawValue }
|
||||
var description: String {
|
||||
switch self {
|
||||
case .defaultKeyboard:
|
||||
return NSLocalizedString("default", comment: "Default Keyboard")
|
||||
case .asciiCapable:
|
||||
return NSLocalizedString("ascii.capable", comment: "ASCII Capable Keyboard")
|
||||
case .twitter:
|
||||
return NSLocalizedString("twitter", comment: "Twitter Keyboard")
|
||||
case .emailAddress:
|
||||
return NSLocalizedString("email.address", comment: "Email Address Keyboard")
|
||||
case .numbersAndPunctuation:
|
||||
return NSLocalizedString("numbers.punctuation", comment: "Numbers and Punctuation Keyboard")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum MeshMapTypes: Int, CaseIterable, Identifiable {
|
||||
|
||||
case standard = 0
|
||||
|
|
@ -47,17 +22,17 @@ enum MeshMapTypes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .standard:
|
||||
return NSLocalizedString("standard", comment: "Standard")
|
||||
return "standard".localized
|
||||
case .mutedStandard:
|
||||
return NSLocalizedString("standard.muted", comment: "Standard Muted")
|
||||
return "standard.muted".localized
|
||||
case .hybrid:
|
||||
return NSLocalizedString("hybrid", comment: "Hybrid")
|
||||
return "hybrid".localized
|
||||
case .hybridFlyover:
|
||||
return NSLocalizedString("hybrid.flyover", comment: "Hybrid Flyover")
|
||||
return "hybrid.flyover".localized
|
||||
case .satellite:
|
||||
return NSLocalizedString("satellite", comment: "Satellite")
|
||||
return "satellite".localized
|
||||
case .satelliteFlyover:
|
||||
return NSLocalizedString("satellite.flyover", comment: "Satellite Flyover")
|
||||
return "satellite.flyover".localized
|
||||
}
|
||||
}
|
||||
func MKMapTypeValue() -> MKMapType {
|
||||
|
|
@ -90,11 +65,11 @@ enum UserTrackingModes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .none:
|
||||
return NSLocalizedString("map.usertrackingmode.none", comment: "None")
|
||||
return "map.usertrackingmode.none".localized
|
||||
case .follow:
|
||||
return NSLocalizedString("map.usertrackingmode.follow", comment: "Follow")
|
||||
return "map.usertrackingmode.follow".localized
|
||||
case .followWithHeading:
|
||||
return NSLocalizedString("map.usertrackingmode.followwithheading", comment: "Follow with Heading")
|
||||
return "map.usertrackingmode.followwithheading".localized
|
||||
}
|
||||
}
|
||||
var icon: String {
|
||||
|
|
@ -123,6 +98,7 @@ enum LocationUpdateInterval: Int, CaseIterable, Identifiable {
|
|||
case tenSeconds = 10
|
||||
case fifteenSeconds = 15
|
||||
case thirtySeconds = 30
|
||||
case fortyFiveSeconds = 45
|
||||
case oneMinute = 60
|
||||
case fiveMinutes = 300
|
||||
case tenMinutes = 600
|
||||
|
|
@ -132,21 +108,23 @@ enum LocationUpdateInterval: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
return "interval.five.seconds".localized
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .fortyFiveSeconds:
|
||||
return "interval.fortyfive.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ enum BluetoothModes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .randomPin:
|
||||
return NSLocalizedString("bluetooth.mode.randompin", comment: "Random PIN")
|
||||
return "bluetooth.mode.randompin".localized
|
||||
case .fixedPin:
|
||||
return NSLocalizedString("bluetooth.mode.fixedpin", comment: "Fixed PIN")
|
||||
return "bluetooth.mode.fixedpin".localized
|
||||
case .noPin:
|
||||
return NSLocalizedString("bluetooth.mode.nopin", comment: "No PIN (Just Works)")
|
||||
return "bluetooth.mode.nopin".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> Config.BluetoothConfig.PairingMode {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ enum ConfigPresets: Int, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .unset:
|
||||
return NSLocalizedString("canned.messages.preset.manual", comment: "Manual Configuration")
|
||||
return "canned.messages.preset.manual".localized
|
||||
case .rakRotaryEncoder:
|
||||
return NSLocalizedString("canned.messages.preset.rakrotary", comment: "RAK Rotary Encoder Module")
|
||||
return "canned.messages.preset.rakrotary".localized
|
||||
case .cardKB:
|
||||
return NSLocalizedString("canned.messages.preset.cardkb", comment: "M5 Stack Card KB / RAK Keypad")
|
||||
return "canned.messages.preset.cardkb".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44,21 +44,21 @@ enum InputEventChars: Int, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .none:
|
||||
return NSLocalizedString("inputevent.none", comment: "None")
|
||||
return "inputevent.none".localized
|
||||
case .up:
|
||||
return NSLocalizedString("inputevent.up", comment: "Up")
|
||||
return "inputevent.up".localized
|
||||
case .down:
|
||||
return NSLocalizedString("inputevent.down", comment: "Down")
|
||||
return "inputevent.down".localized
|
||||
case .left:
|
||||
return NSLocalizedString("inputevent.left", comment: "Left")
|
||||
return "inputevent.left".localized
|
||||
case .right:
|
||||
return NSLocalizedString("inputevent.right", comment: "Right")
|
||||
return "inputevent.right".localized
|
||||
case .select:
|
||||
return NSLocalizedString("inputevent.select", comment: "Select")
|
||||
return "inputevent.select".localized
|
||||
case .back:
|
||||
return NSLocalizedString("inputevent.back", comment: "Back")
|
||||
return "inputevent.back".localized
|
||||
case .cancel:
|
||||
return NSLocalizedString("inputevent.cancel", comment: "Cancel")
|
||||
return "inputevent.cancel".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> ModuleConfig.CannedMessageConfig.InputEventChar {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ enum ChannelRoles: Int, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .disabled:
|
||||
return NSLocalizedString("channel.role.disabled", comment: "Disabled")
|
||||
return "channel.role.disabled".localized
|
||||
case .primary:
|
||||
return NSLocalizedString("channel.role.primary", comment: "Primary")
|
||||
return "channel.role.primary".localized
|
||||
case .secondary:
|
||||
return NSLocalizedString("channel.role.secondary", comment: "Secondary")
|
||||
return "channel.role.secondary".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> Channel.Role {
|
||||
|
|
|
|||
|
|
@ -40,19 +40,19 @@ enum DeviceRoles: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .client:
|
||||
return NSLocalizedString("device.role.client", comment: "Client (default) - App connected client.")
|
||||
return "device.role.client".localized
|
||||
case .clientMute:
|
||||
return NSLocalizedString("device.role.clientmute", comment: "Client Mute - Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh.")
|
||||
return "device.role.clientmute".localized
|
||||
case .router:
|
||||
return NSLocalizedString("device.role.router", comment: "Router - Mesh packets will prefer to be routed over this node. Assumes device will operate in a standalone manner while placed in a location with a coverage advantage. WARNING: The BLE/Wi-Fi radios and the OLED screen will be put to sleep.")
|
||||
return "device.role.router".localized
|
||||
case .routerClient:
|
||||
return NSLocalizedString("device.role.routerclient", comment: "Router Client - Hybrid of the Client and Router roles. Similar to Router, except the Router Client can be used as both a Router and an app connected Client. BLE/Wi-Fi and OLED screen will not be put to sleep.")
|
||||
return "device.role.routerclient".localized
|
||||
case .repeater:
|
||||
return NSLocalizedString("device.role.repeater", comment: "Repeater - Mesh packets will prefer to be routed over this node. This role eliminates unnecessary overhead such as NodeInfo, DeviceTelemetry, and any other mesh packet, resulting in the device not appearing as part of the network. Please see Rebroadcast Mode for additional settings specific to this role.")
|
||||
return "device.role.repeater".localized
|
||||
case .tracker:
|
||||
return NSLocalizedString("device.role.tracker", comment: "Tracker - For use with devices intended as a GPS tracker. Position packets sent from this device will be higher priority, with position broadcasting every two minutes. Smart Position Broadcast will default to off.")
|
||||
return "device.role.tracker".localized
|
||||
case .sensor:
|
||||
return NSLocalizedString("device.role.sensor", comment: "Sensor - For use with remote telemetry sensors. Setting this role will turn on environment telemetry. Telemetry packets sent from this device will be higher priority, with telemetry broadcasting every 7 minutes")
|
||||
return "device.role.sensor".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> Config.DeviceConfig.Role {
|
||||
|
|
|
|||
|
|
@ -48,23 +48,23 @@ enum ScreenOnIntervals: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
case .thirtyMinutes:
|
||||
return NSLocalizedString("interval.thirty.minutes", comment: "Thirty Minutes")
|
||||
return "interval.thirty.minutes".localized
|
||||
case .oneHour:
|
||||
return NSLocalizedString("interval.one.hour", comment: "One Hour")
|
||||
return "interval.one.hour".localized
|
||||
case .max:
|
||||
return NSLocalizedString("always.on", comment: "Always On")
|
||||
return "always.on".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -83,17 +83,17 @@ enum ScreenCarouselIntervals: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .off:
|
||||
return NSLocalizedString("off", comment: "Off")
|
||||
return "off".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ enum OledTypes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .auto:
|
||||
return NSLocalizedString("automatic.detection", comment: "Automatic Detection")
|
||||
return "automatic.detection".localized
|
||||
case .ssd1306:
|
||||
return "SSD 1306"
|
||||
case .sh1106:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ enum HardwareModels: String, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .UNSET:
|
||||
return NSLocalizedString("unset", comment: "UNSET")
|
||||
return "unset".localized
|
||||
case .TLORAV2:
|
||||
return "TLoRa V2"
|
||||
case .TLORAV1:
|
||||
|
|
|
|||
|
|
@ -25,25 +25,25 @@ enum OutputIntervals: Int, CaseIterable, Identifiable {
|
|||
|
||||
switch self {
|
||||
case .unset:
|
||||
return NSLocalizedString("unset", comment: "Unset")
|
||||
return "unset".localized
|
||||
case .oneSecond:
|
||||
return NSLocalizedString("interval.one.second", comment: "One Second")
|
||||
return "interval.one.second".localized
|
||||
case .twoSeconds:
|
||||
return NSLocalizedString("interval.two.seconds", comment: "Two Seconds")
|
||||
return "interval.two.seconds".localized
|
||||
case .threeSeconds:
|
||||
return NSLocalizedString("interval.three.seconds", comment: "Three Seconds")
|
||||
return "interval.three.seconds".localized
|
||||
case .fourSeconds:
|
||||
return NSLocalizedString("interval.four.seconds", comment: "Four Seconds")
|
||||
return "interval.four.seconds".localized
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
return "interval.five.seconds".localized
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,23 +65,23 @@ enum SenderIntervals: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .off:
|
||||
return NSLocalizedString("off", comment: "Off")
|
||||
return "off".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
case .thirtyMinutes:
|
||||
return NSLocalizedString("interval.thirty.minutes", comment: "Thirty Minutes")
|
||||
return "interval.thirty.minutes".localized
|
||||
case .oneHour:
|
||||
return NSLocalizedString("interval.one.hour", comment: "One Hour")
|
||||
return "interval.one.hour".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -115,47 +115,47 @@ enum UpdateIntervals: Int, CaseIterable, Identifiable {
|
|||
|
||||
switch self {
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .twoMinutes:
|
||||
return NSLocalizedString("interval.two.minutes", comment: "Two Minutes")
|
||||
return "interval.two.minutes".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
case .thirtyMinutes:
|
||||
return NSLocalizedString("interval.thirty.minutes", comment: "Thirty Minutes")
|
||||
return "interval.thirty.minutes".localized
|
||||
case .oneHour:
|
||||
return NSLocalizedString("interval.one.hour", comment: "One Hour")
|
||||
return "interval.one.hour".localized
|
||||
case .twoHours:
|
||||
return NSLocalizedString("interval.two.hours", comment: "Two Hours")
|
||||
return "interval.two.hours".localized
|
||||
case .threeHours:
|
||||
return NSLocalizedString("interval.three.hours", comment: "Three Hours")
|
||||
return "interval.three.hours".localized
|
||||
case .fourHours:
|
||||
return NSLocalizedString("interval.four.hours", comment: "Four Hours")
|
||||
return "interval.four.hours".localized
|
||||
case .fiveHours:
|
||||
return NSLocalizedString("interval.five.hours", comment: "Five Hours")
|
||||
return "interval.five.hours".localized
|
||||
case .sixHours:
|
||||
return NSLocalizedString("interval.six.hours", comment: "Six Hours")
|
||||
return "interval.six.hours".localized
|
||||
case .twelveHours:
|
||||
return NSLocalizedString("interval.twelve.hours", comment: "Twelve Hours")
|
||||
return "interval.twelve.hours".localized
|
||||
case .eighteenHours:
|
||||
return NSLocalizedString("interval.eighteen.hours", comment: "Eighteen Hours")
|
||||
return "interval.eighteen.hours".localized
|
||||
case .twentyFourHours:
|
||||
return NSLocalizedString("interval.twentyfour.hours", comment: "Twenty Four Hours")
|
||||
return "interval.twentyfour.hours".localized
|
||||
case .thirtySixHours:
|
||||
return NSLocalizedString("interval.thirtysix.hours", comment: "Thirty Six Hours")
|
||||
return "interval.thirtysix.hours".localized
|
||||
case .fortyeightHours:
|
||||
return NSLocalizedString("interval.fortyeight.hours", comment: "Forty Eight Hours")
|
||||
return "interval.fortyeight.hours".localized
|
||||
case .seventyTwoHours:
|
||||
return NSLocalizedString("interval.seventytwo.hours", comment: "Seventy Two Hours")
|
||||
return "interval.seventytwo.hours".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,19 +43,19 @@ enum Tapbacks: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .heart:
|
||||
return NSLocalizedString("tapback.heart", comment: "Heart")
|
||||
return "tapback.heart".localized
|
||||
case .thumbsUp:
|
||||
return NSLocalizedString("tapback.thumbsup", comment: "Thumbs Up")
|
||||
return "tapback.thumbsup".localized
|
||||
case .thumbsDown:
|
||||
return NSLocalizedString("tapback.thumbsdown", comment: "Thumbs Down")
|
||||
return "tapback.thumbsdown".localized
|
||||
case .haHa:
|
||||
return NSLocalizedString("tapback.haha", comment: "HaHa")
|
||||
return "tapback.haha".localized
|
||||
case .exclamation:
|
||||
return NSLocalizedString("tapback.exclamation", comment: "Exclamation Mark")
|
||||
return "tapback.exclamation".localized
|
||||
case .question:
|
||||
return NSLocalizedString("tapback.question", comment: "Question Mark")
|
||||
return "tapback.question".localized
|
||||
case .poop:
|
||||
return NSLocalizedString("tapback.poop", comment: "Poop")
|
||||
return "tapback.poop".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,17 +20,17 @@ enum GpsFormats: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .gpsFormatDec:
|
||||
return NSLocalizedString("gpsformat.dec", comment: "Decimal Degrees Format")
|
||||
return "gpsformat.dec".localized
|
||||
case .gpsFormatDms:
|
||||
return NSLocalizedString("gpsformat.dms", comment: "Degrees Minutes Seconds")
|
||||
return "gpsformat.dms".localized
|
||||
case .gpsFormatUtm:
|
||||
return NSLocalizedString("gpsformat.utm", comment: "Universal Transverse Mercator")
|
||||
return "gpsformat.utm".localized
|
||||
case .gpsFormatMgrs:
|
||||
return NSLocalizedString("gpsformat.mgrs", comment: "Military Grid Reference System")
|
||||
return "gpsformat.mgrs".localized
|
||||
case .gpsFormatOlc:
|
||||
return NSLocalizedString("gpsformat.olc", comment: "Open Location Code (aka Plus Codes)")
|
||||
return "gpsformat.olc".localized
|
||||
case .gpsFormatOsgr:
|
||||
return NSLocalizedString("gpsformat.osgr", comment: "Ordnance Survey Grid Reference")
|
||||
return "gpsformat.osgr".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> Config.DisplayConfig.GpsCoordinateFormat {
|
||||
|
|
@ -78,41 +78,41 @@ enum GpsUpdateIntervals: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
return "interval.five.seconds".localized
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .twentySeconds:
|
||||
return NSLocalizedString("interval.twenty.seconds", comment: "Twenty Seconds")
|
||||
return "interval.twenty.seconds".localized
|
||||
case .twentyFiveSeconds:
|
||||
return NSLocalizedString("interval.twentyfive.seconds", comment: "Twenty Five Seconds")
|
||||
return "interval.twentyfive.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .fortyFiveSeconds:
|
||||
return NSLocalizedString("interval.fortyfive.seconds", comment: "Forty Five Seconds")
|
||||
return "interval.fortyfive.seconds".localized
|
||||
case .oneMinute:
|
||||
return "interval.one.minute".localized
|
||||
case .twoMinutes:
|
||||
return NSLocalizedString("interval.two.minutes", comment: "Two Minutes")
|
||||
return "interval.two.minutes".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
case .thirtyMinutes:
|
||||
return NSLocalizedString("interval.thirty.minutes", comment: "Thirty Minutes")
|
||||
return "interval.thirty.minutes".localized
|
||||
case .oneHour:
|
||||
return NSLocalizedString("interval.one.hour", comment: "One Hour")
|
||||
return "interval.one.hour".localized
|
||||
case .sixHours:
|
||||
return NSLocalizedString("interval.six.hours", comment: "Six Hours")
|
||||
return "interval.six.hours".localized
|
||||
case .twelveHours:
|
||||
return NSLocalizedString("interval.twelve.hours", comment: "Twelve Hours")
|
||||
return "interval.twelve.hours".localized
|
||||
case .twentyFourHours:
|
||||
return NSLocalizedString("interval.twentyfour.hours", comment: "Twenty Four Hours")
|
||||
return "interval.twentyfour.hours".localized
|
||||
case .maxInt32:
|
||||
return NSLocalizedString("on.boot", comment: "On Boot Only")
|
||||
return "on.boot"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -137,31 +137,31 @@ enum GpsAttemptTimes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .twoSeconds:
|
||||
return NSLocalizedString("interval.two.seconds", comment: "Two Seconds")
|
||||
return "interval.two.seconds".localized
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
return "interval.five.seconds".localized
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .twentySeconds:
|
||||
return NSLocalizedString("interval.twenty.seconds", comment: "Twenty Seconds")
|
||||
return "interval.twenty.seconds".localized
|
||||
case .twentyFiveSeconds:
|
||||
return NSLocalizedString("interval.twentyfive.seconds", comment: "Twenty Five Seconds")
|
||||
return "interval.twentyfive.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .fortyFiveSeconds:
|
||||
return NSLocalizedString("interval.fortyfive.seconds", comment: "Forty Five Seconds")
|
||||
return "interval.fortyfive.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .twoMinutes:
|
||||
return NSLocalizedString("interval.two.minutes", comment: "Two Minutes")
|
||||
return "interval.two.minutes".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
case .tenMinutes:
|
||||
return NSLocalizedString("interval.ten.minutes", comment: "Ten Minutes")
|
||||
return "interval.ten.minutes".localized
|
||||
case .fifteenMinutes:
|
||||
return NSLocalizedString("interval.fifteen.minutes", comment: "Fifteen Minutes")
|
||||
return "interval.fifteen.minutes".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,29 +26,29 @@ enum RoutingError: Int, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .none:
|
||||
return NSLocalizedString("routing.acknowledged", comment: "Acknowledged")
|
||||
return "routing.acknowledged".localized
|
||||
case .noRoute:
|
||||
return NSLocalizedString("routing.noroute", comment: "No Route")
|
||||
return "routing.noroute".localized
|
||||
case .gotNak:
|
||||
return NSLocalizedString("routing.gotnak", comment: "Received a negative acknowledgment")
|
||||
return "routing.gotnak".localized
|
||||
case .timeout:
|
||||
return NSLocalizedString("routing.timeout", comment: "Timeout")
|
||||
return "routing.timeout".localized
|
||||
case .noInterface:
|
||||
return NSLocalizedString("routing.nointerface", comment: "No Interface")
|
||||
return "routing.nointerface".localized
|
||||
case .maxRetransmit:
|
||||
return NSLocalizedString("routing.maxretransmit", comment: "Max Retransmission Reached")
|
||||
return "routing.maxretransmit".localized
|
||||
case .noChannel:
|
||||
return NSLocalizedString("routing.nochannel", comment: "No Channel")
|
||||
return "routing.nochannel".localized
|
||||
case .tooLarge:
|
||||
return NSLocalizedString("routing.toolarge", comment: "The packet is too large")
|
||||
return "routing.toolarge".localized
|
||||
case .noResponse:
|
||||
return NSLocalizedString("routing.noresponse", comment: "No Response")
|
||||
return "routing.noresponse".localized
|
||||
case .dutyCycleLimit:
|
||||
return NSLocalizedString("routing.dutycyclelimit", comment: "Regional Duty Cycle Limit Reached")
|
||||
return "routing.dutycyclelimit".localized
|
||||
case .badRequest:
|
||||
return NSLocalizedString("routing.badRequest", comment: "Bad Request")
|
||||
return "routing.badRequest".localized
|
||||
case .notAuthorized:
|
||||
return NSLocalizedString("routing.notauthorized", comment: "Not Authorized")
|
||||
return "routing.notauthorized".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> Routing.Error {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ enum SerialBaudRates: Int, CaseIterable, Identifiable {
|
|||
switch self {
|
||||
|
||||
case .baudDefault:
|
||||
return NSLocalizedString("default", comment: "Default")
|
||||
return "default".localized
|
||||
case .baud110:
|
||||
return "110 Baud"
|
||||
case .baud300:
|
||||
|
|
@ -116,15 +116,15 @@ enum SerialModeTypes: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .default:
|
||||
return NSLocalizedString("serial.mode.default", comment: "Default")
|
||||
return "serial.mode.default".localized
|
||||
case .simple:
|
||||
return NSLocalizedString("serial.mode.simple", comment: "Simple")
|
||||
return "serial.mode.simple".localized
|
||||
case .proto:
|
||||
return NSLocalizedString("serial.mode.proto", comment: "Protobufs")
|
||||
return "serial.mode.proto".localized
|
||||
case .txtmsg:
|
||||
return NSLocalizedString("serial.mode.txtmsg", comment: "Text Message")
|
||||
return "serial.mode.txtmsg".localized
|
||||
case .nmea:
|
||||
return NSLocalizedString("serial.mode.nmea", comment: "NMEA Positions")
|
||||
return "serial.mode.nmea".localized
|
||||
}
|
||||
}
|
||||
func protoEnumValue() -> ModuleConfig.SerialConfig.Serial_Mode {
|
||||
|
|
@ -160,21 +160,21 @@ enum SerialTimeoutIntervals: Int, CaseIterable, Identifiable {
|
|||
var description: String {
|
||||
switch self {
|
||||
case .unset:
|
||||
return NSLocalizedString("unset", comment: "Unset")
|
||||
return "unset".localized
|
||||
case .oneSecond:
|
||||
return NSLocalizedString("interval.one.second", comment: "One Second")
|
||||
return "interval.one.second".localized
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
return "interval.five.seconds".localized
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
return "interval.ten.seconds".localized
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
return "interval.fifteen.seconds".localized
|
||||
case .thirtySeconds:
|
||||
return NSLocalizedString("interval.thirty.seconds", comment: "Thirty Seconds")
|
||||
return "interval.thirty.seconds".localized
|
||||
case .oneMinute:
|
||||
return NSLocalizedString("interval.one.minute", comment: "One Minute")
|
||||
return "interval.one.minute".localized
|
||||
case .fiveMinutes:
|
||||
return NSLocalizedString("interval.five.minutes", comment: "Five Minutes")
|
||||
return "interval.five.minutes".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin
|
|||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
if metricsType == 0 {
|
||||
// Create Device Metrics Header
|
||||
csvString = "\(NSLocalizedString("battery.level", comment: "")), \(NSLocalizedString("voltage", comment: "")), \(NSLocalizedString("channel.utilization", comment: "")), \(NSLocalizedString("airtime", comment: "")), \(NSLocalizedString("timestamp", comment: ""))"
|
||||
csvString = "\("battery.level".localized), \("voltage".localized), \("channel.utilization".localized), \("airtime".localized), \("timestamp".localized)"
|
||||
for dm in telemetry {
|
||||
if dm.metricsType == 0 {
|
||||
csvString += "\n"
|
||||
|
|
@ -25,12 +25,12 @@ func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin
|
|||
csvString += ", "
|
||||
csvString += String(dm.airUtilTx)
|
||||
csvString += ", "
|
||||
csvString += dm.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: "")
|
||||
csvString += dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized
|
||||
}
|
||||
}
|
||||
} else if metricsType == 1 {
|
||||
// Create Environment Telemetry Header
|
||||
csvString = "Temperature, Relative Humidity, Barometric Pressure, Gas Resistance, \(NSLocalizedString("voltage", comment: "")), \(NSLocalizedString("current", comment: "")), \(NSLocalizedString("timestamp", comment: ""))"
|
||||
csvString = "Temperature, Relative Humidity, Barometric Pressure, Gas Resistance, \("voltage".localized), \("current".localized), \("timestamp".localized)"
|
||||
for dm in telemetry {
|
||||
if dm.metricsType == 1 {
|
||||
csvString += "\n"
|
||||
|
|
@ -46,7 +46,7 @@ func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> Strin
|
|||
csvString += ", "
|
||||
csvString += String(dm.current)
|
||||
csvString += ", "
|
||||
csvString += dm.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: "")
|
||||
csvString += dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ func positionToCsvFile(positions: [PositionEntity]) -> String {
|
|||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
// Create Position Header
|
||||
csvString = "SeqNo, Latitude, Longitude, Altitude, Sats, Speed, Heading, SNR, \(NSLocalizedString("timestamp", comment: ""))"
|
||||
csvString = "SeqNo, Latitude, Longitude, Altitude, Sats, Speed, Heading, SNR, \("timestamp".localized)"
|
||||
for pos in positions {
|
||||
csvString += "\n"
|
||||
csvString += String(pos.seqNo)
|
||||
|
|
@ -77,7 +77,7 @@ func positionToCsvFile(positions: [PositionEntity]) -> String {
|
|||
csvString += ", "
|
||||
csvString += String(pos.snr)
|
||||
csvString += ", "
|
||||
csvString += pos.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: "")
|
||||
csvString += pos.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized
|
||||
}
|
||||
return csvString
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ extension String {
|
|||
return base64url
|
||||
}
|
||||
|
||||
var localized: String { NSLocalizedString(self, comment: self) }
|
||||
|
||||
func onlyEmojis() -> Bool {
|
||||
return count > 0 && !contains { !$0.isEmoji }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,10 +99,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
}
|
||||
self.isConnected = false
|
||||
self.isConnecting = false
|
||||
self.lastConnectionError = "🚨 " + String.localizedStringWithFormat(NSLocalizedString("ble.connection.timeout %d %@",
|
||||
comment: "Connection failed after %d attempts to connect to %@. You may need to forget your device under Settings > Bluetooth."),
|
||||
timeoutTimerCount, name)
|
||||
|
||||
self.lastConnectionError = "🚨 " + String.localizedStringWithFormat("ble.connection.timeout %d %@".localized, timeoutTimerCount, name)
|
||||
MeshLogger.log(lastConnectionError)
|
||||
self.timeoutTimerCount = 0
|
||||
self.startScanning()
|
||||
|
|
@ -198,9 +195,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
let errorCode = (e as NSError).code
|
||||
if errorCode == 6 { // CBError.Code.connectionTimeout The connection has timed out unexpectedly.
|
||||
// Happens when device is manually reset / powered off
|
||||
lastConnectionError = "🚨" + String.localizedStringWithFormat(NSLocalizedString("ble.errorcode.6 %@",
|
||||
comment: "The app will automatically reconnect to the preferred radio if it come back in range."),
|
||||
e.localizedDescription)
|
||||
lastConnectionError = "🚨" + String.localizedStringWithFormat("ble.errorcode.6 %@".localized, e.localizedDescription)
|
||||
print("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(e.localizedDescription)")
|
||||
} else if errorCode == 7 { // CBError.Code.peripheralDisconnected The specified device has disconnected from us.
|
||||
// Seems to be what is received when a tbeam sleeps, immediately recconnecting does not work.
|
||||
|
|
@ -208,9 +203,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
print("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(e.localizedDescription)")
|
||||
} else if errorCode == 14 { // Peer removed pairing information
|
||||
// Forgetting and reconnecting seems to be necessary so we need to show the user an error telling them to do that
|
||||
lastConnectionError = "🚨 " + String.localizedStringWithFormat(NSLocalizedString("ble.errorcode.14 %@",
|
||||
comment: "This error usually cannot be fixed without forgetting the device unders Settings > Bluetooth and re-connecting to the radio."),
|
||||
e.localizedDescription)
|
||||
lastConnectionError = "🚨 " + String.localizedStringWithFormat("ble.errorcode.14 %@".localized, e.localizedDescription)
|
||||
print("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(lastConnectionError)")
|
||||
} else {
|
||||
lastConnectionError = "🚨 \(e.localizedDescription)"
|
||||
|
|
@ -295,7 +288,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
dataMessage.wantResponse = true
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛎️ Requested Device Metadata for node \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown")) by \(fromUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛎️ Requested Device Metadata for node \(toUser.longName ?? "unknown".localized) by \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return Int64(meshPacket.id)
|
||||
}
|
||||
|
|
@ -328,8 +321,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
success = true
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.traceroute.sent %@",
|
||||
comment: "Sent a Trace Route Request to node: %@"), String(destNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.traceroute.sent %@".localized, String(destNum))
|
||||
MeshLogger.log("🪧 \(logString)")
|
||||
}
|
||||
return success
|
||||
|
|
@ -339,13 +331,13 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
guard connectedPeripheral!.peripheral.state == CBPeripheralState.connected else { return }
|
||||
|
||||
if FROMRADIO_characteristic == nil {
|
||||
MeshLogger.log("🚨 \(NSLocalizedString("firmware.version.unsupported", comment: "Unsupported Firmware Version Detected, unable to connect to device."))")
|
||||
MeshLogger.log("🚨 \("firmware.version.unsupported".localized)")
|
||||
invalidVersion = true
|
||||
return
|
||||
} else {
|
||||
|
||||
let nodeName = connectedPeripheral!.peripheral.name ?? NSLocalizedString("unknown", comment: NSLocalizedString("unknown", comment: "Unknown"))
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.wantconfig %@", comment: "Issuing Want Config to %@"), nodeName)
|
||||
let nodeName = connectedPeripheral?.peripheral.name ?? "unknown".localized
|
||||
let logString = String.localizedStringWithFormat("mesh.log.wantconfig %@".localized, nodeName)
|
||||
MeshLogger.log("🛎️ \(logString)")
|
||||
// BLE Characteristics discovered, issue wantConfig
|
||||
var toRadio: ToRadio = ToRadio()
|
||||
|
|
@ -377,9 +369,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
// BLE PIN connection errors
|
||||
// 5 CBATTErrorDomain Code=5 "Authentication is insufficient."
|
||||
// 15 CBATTErrorDomain Code=15 "Encryption is insufficient."
|
||||
lastConnectionError = "🚨" + String.localizedStringWithFormat(NSLocalizedString("ble.errorcode.pin %@",
|
||||
comment: "Please try connecting again and check the PIN carefully."),
|
||||
e.localizedDescription)
|
||||
lastConnectionError = "🚨" + String.localizedStringWithFormat("ble.errorcode.pin %@".localized, e.localizedDescription)
|
||||
print("🚨 \(e.localizedDescription) Please try connecting again and check the PIN carefully.")
|
||||
self.disconnectPeripheral(reconnect: false)
|
||||
}
|
||||
|
|
@ -424,7 +414,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
let supportedVersion = connectedVersion == "0.0.0" || self.minimumVersion.compare(connectedVersion, options: .numeric) == .orderedAscending || minimumVersion.compare(connectedVersion, options: .numeric) == .orderedSame
|
||||
if !supportedVersion {
|
||||
invalidVersion = true
|
||||
lastConnectionError = "🚨" + NSLocalizedString("update.firmware", comment: "Update Your Firmware")
|
||||
lastConnectionError = "🚨" + "update.firmware".localized
|
||||
return
|
||||
|
||||
} else {
|
||||
|
|
@ -433,9 +423,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
|
||||
if myInfo != nil {
|
||||
connectedPeripheral.num = myInfo!.myNodeNum
|
||||
connectedPeripheral.firmwareVersion = myInfo?.firmwareVersion ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
connectedPeripheral.name = myInfo?.bleName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
connectedPeripheral.longName = myInfo?.bleName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
connectedPeripheral.firmwareVersion = myInfo?.firmwareVersion ?? "unknown".localized
|
||||
connectedPeripheral.name = myInfo?.bleName ?? "unknown".localized
|
||||
connectedPeripheral.longName = myInfo?.bleName ?? "unknown".localized
|
||||
}
|
||||
}
|
||||
tryClearExistingChannels()
|
||||
|
|
@ -449,7 +439,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
if self.connectedPeripheral != nil && self.connectedPeripheral.num == nodeInfo!.num {
|
||||
if nodeInfo!.user != nil {
|
||||
connectedPeripheral.shortName = nodeInfo?.user?.shortName ?? "????"
|
||||
connectedPeripheral.longName = nodeInfo?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
connectedPeripheral.longName = nodeInfo?.user?.longName ?? "unknown".localized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -528,8 +518,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
if let routingMessage = try? RouteDiscovery(serializedData: decodedInfo.packet.decoded.payload) {
|
||||
|
||||
if routingMessage.route.count == 0 {
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.traceroute.received.direct %@",
|
||||
comment: "Trace Route request sent to node: %@ was recieived directly."), String(decodedInfo.packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.traceroute.received.direct %@".localized, String(decodedInfo.packet.from))
|
||||
MeshLogger.log("🪧 \(logString)")
|
||||
} else {
|
||||
|
||||
|
|
@ -538,8 +527,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
routeString += "\(node) --> "
|
||||
}
|
||||
routeString += "\(decodedInfo.packet.from)"
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.traceroute.received.route %@",
|
||||
comment: "Trace Route request returned: %@"), routeString)
|
||||
let logString = String.localizedStringWithFormat("mesh.log.traceroute.received.route %@".localized, routeString)
|
||||
MeshLogger.log("🪧 \(logString)")
|
||||
}
|
||||
}
|
||||
|
|
@ -614,9 +602,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
if preferredPeripheral != nil && preferredPeripheral?.peripheral != nil {
|
||||
connectTo(peripheral: preferredPeripheral!.peripheral)
|
||||
}
|
||||
let nodeName = connectedPeripheral?.peripheral.name ?? NSLocalizedString("unknown", comment: NSLocalizedString("unknown", comment: "Unknown"))
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.textmessage.send.failed %@",
|
||||
comment: "Message Send Failed, not properly connected to %@"), nodeName)
|
||||
let nodeName = connectedPeripheral?.peripheral.name ?? "unknown".localized
|
||||
let logString = String.localizedStringWithFormat("mesh.log.textmessage.send.failed %@".localized, nodeName)
|
||||
MeshLogger.log("🚫 \(logString)")
|
||||
|
||||
success = false
|
||||
|
|
@ -692,7 +679,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
let binaryData: Data = try! toRadio.serializedData()
|
||||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.textmessage.sent %@ %@ %@", comment: "Sent message %@ from %@ to %@"), String(newMessage.messageId), String(fromUserNum), String(toUserNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.textmessage.sent %@ %@ %@".localized, String(fromUserNum), String(toUserNum))
|
||||
MeshLogger.log("💬 \(logString)")
|
||||
do {
|
||||
try context!.save()
|
||||
|
|
@ -732,7 +719,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
toRadio = ToRadio()
|
||||
toRadio.packet = meshPacket
|
||||
let binaryData: Data = try! toRadio.serializedData()
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.waypoint.sent %@", comment: "Sent a Waypoint Packet from: %@"), String(fromNodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.waypoint.sent %@".localized, String(fromNodeNum))
|
||||
MeshLogger.log("📍 \(logString)")
|
||||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
|
|
@ -818,7 +805,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
success = true
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.sharelocation %@", comment: "Sent a Position Packet from the Apple device GPS to node: %@"), String(fromNodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.sharelocation %@".localized, String(fromNodeNum))
|
||||
MeshLogger.log("📍 \(logString)")
|
||||
}
|
||||
return success
|
||||
|
|
@ -847,7 +834,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🚀 Sent Shutdown Admin Message to: \(toUser.longName ?? NSLocalizedString("unknown", comment: "")) from: \(fromUser.longName ?? NSLocalizedString("unknown", comment: ""))"
|
||||
let messageDescription = "🚀 Sent Shutdown Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -868,7 +855,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🚀 Sent Reboot Admin Message to: \(toUser.longName ?? NSLocalizedString("unknown", comment: "")) from: \(fromUser.longName ?? NSLocalizedString("unknown", comment: ""))"
|
||||
let messageDescription = "🚀 Sent Reboot Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -889,7 +876,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🚀 Sent Reboot OTA Admin Message to: \(toUser.longName ?? NSLocalizedString("unknown", comment: "")) from: \(fromUser.longName ?? NSLocalizedString("unknown", comment: ""))"
|
||||
let messageDescription = "🚀 Sent Reboot OTA Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -910,7 +897,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🚀 Sent Factory Reset Admin Message to: \(toUser.longName ?? NSLocalizedString("unknown", comment: "")) from: \(fromUser.longName ?? NSLocalizedString("unknown", comment: ""))"
|
||||
let messageDescription = "🚀 Sent Factory Reset Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -931,7 +918,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🚀 Sent NodeDB Reset Admin Message to: \(toUser.longName ?? NSLocalizedString("unknown", comment: "")) from: \(fromUser.longName ?? NSLocalizedString("unknown", comment: ""))"
|
||||
let messageDescription = "🚀 Sent NodeDB Reset Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -971,7 +958,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.wantResponse = true
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🎛️ Requested Channel \(channel.index) for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🎛️ Requested Channel \(channel.index) for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return Int64(meshPacket.id)
|
||||
}
|
||||
|
|
@ -992,7 +979,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.wantResponse = true
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🛟 Saved Channel \(channel.index) for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Channel \(channel.index) for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return Int64(meshPacket.id)
|
||||
}
|
||||
|
|
@ -1040,7 +1027,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
let binaryData: Data = try! toRadio.serializedData()
|
||||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
self.connectedPeripheral.peripheral.writeValue(binaryData, for: self.TORADIO_characteristic, type: .withResponse)
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.channel.sent %@ %d", comment: "Sent a Channel for: %@ Channel Index %d"), String(connectedPeripheral.num), chan.index)
|
||||
let logString = String.localizedStringWithFormat("mesh.log.channel.sent %@ %d".localized, String(connectedPeripheral.num), chan.index)
|
||||
MeshLogger.log("🎛️ \(logString)")
|
||||
}
|
||||
}
|
||||
|
|
@ -1064,7 +1051,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
let binaryData: Data = try! toRadio.serializedData()
|
||||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
self.connectedPeripheral.peripheral.writeValue(binaryData, for: self.TORADIO_characteristic, type: .withResponse)
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.lora.config.sent %@", comment: "Sent a LoRaConfig for: %@"), String(connectedPeripheral.num))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.lora.config.sent %@".localized, String(connectedPeripheral.num))
|
||||
MeshLogger.log("📻 \(logString)")
|
||||
}
|
||||
return true
|
||||
|
|
@ -1090,7 +1077,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved User Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved User Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return Int64(meshPacket.id)
|
||||
}
|
||||
|
|
@ -1111,7 +1098,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved Ham Parameters for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Ham Parameters for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
return Int64(meshPacket.id)
|
||||
}
|
||||
|
|
@ -1131,7 +1118,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved Bluetooth Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Bluetooth Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertBluetoothConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1157,7 +1144,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved Device Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Device Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertDeviceConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1181,7 +1168,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved Display Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Display Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertDisplayConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1204,7 +1191,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.payload = try! adminPacket.serializedData()
|
||||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
let messageDescription = "🛟 Saved LoRa Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved LoRa Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertLoRaConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1232,7 +1219,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🛟 Saved Position Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Position Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertPositionConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1260,7 +1247,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🛟 Saved Network Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Network Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertNetworkConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1287,7 +1274,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🛟 Saved Canned Message Module Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Canned Message Module Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertCannedMessagesModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1315,7 +1302,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.wantResponse = true
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "🛟 Saved Canned Message Module Messages for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "🛟 Saved Canned Message Module Messages for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
|
||||
|
|
@ -1343,7 +1330,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved External Notification Module Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved External Notification Module Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertExternalNotificationModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1368,7 +1355,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved RTTTL Ringtone Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved RTTTL Ringtone Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertRtttlConfigPacket(ringtone: ringtone, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1397,7 +1384,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved WiFi Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved WiFi Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertMqttModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1422,7 +1409,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved Range Test Module Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved Range Test Module Config for \(toUser.longName ?? "unknown".localized)"
|
||||
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertRangeTestModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
|
|
@ -1450,7 +1437,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved Serial Module Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved Serial Module Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertSerialModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1476,7 +1463,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
dataMessage.portnum = PortNum.adminApp
|
||||
meshPacket.decoded = dataMessage
|
||||
|
||||
let messageDescription = "Saved Telemetry Module Config for \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))"
|
||||
let messageDescription = "Saved Telemetry Module Config for \(toUser.longName ?? "unknown".localized)"
|
||||
if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) {
|
||||
upsertTelemetryModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!)
|
||||
return Int64(meshPacket.id)
|
||||
|
|
@ -1541,7 +1528,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
|
||||
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
|
||||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.cannedmessages.messages.get %@", comment: "Requested Canned Messages Module Messages for node: %@"), String(connectedPeripheral.num))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.cannedmessages.messages.get %@".localized, String(connectedPeripheral.num))
|
||||
MeshLogger.log("🥫 \(logString)")
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ func moduleConfig (config: ModuleConfig, context: NSManagedObjectContext, nodeNu
|
|||
|
||||
func myInfoPacket (myInfo: MyNodeInfo, peripheralId: String, context: NSManagedObjectContext) -> MyInfoEntity? {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.myinfo %@", comment: "MyInfo received: %@"), String(myInfo.myNodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.myinfo %@".localized, String(myInfo.myNodeNum))
|
||||
MeshLogger.log("ℹ️ \(logString)")
|
||||
|
||||
let fetchMyInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "MyInfoEntity")
|
||||
|
|
@ -143,7 +143,7 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo
|
|||
|
||||
if channel.isInitialized && channel.hasSettings && channel.role != Channel.Role.disabled {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.channel.received %d %@", comment: "Channel %d received from: %@"), channel.index, String(fromNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.channel.received %d %@", channel.index, String(fromNum))
|
||||
MeshLogger.log("🎛️ \(logString)")
|
||||
|
||||
let fetchedMyInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "MyInfoEntity")
|
||||
|
|
@ -194,7 +194,7 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo
|
|||
func deviceMetadataPacket (metadata: DeviceMetadata, fromNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
if metadata.isInitialized {
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.device.metadata.received %@", comment: "Device Metadata admin message received from: %@"), String(fromNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.device.metadata.received %@".localized, String(fromNum))
|
||||
MeshLogger.log("🏷️ \(logString)")
|
||||
|
||||
let fetchedNodeRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -233,7 +233,7 @@ func deviceMetadataPacket (metadata: DeviceMetadata, fromNum: Int64, context: NS
|
|||
|
||||
func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObjectContext) -> NodeInfoEntity? {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.nodeinfo.received %@", comment: "Node info received for: %@"), String(nodeInfo.num))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.nodeinfo.received %@".localized, String(nodeInfo.num))
|
||||
MeshLogger.log("📟 \(logString)")
|
||||
|
||||
guard nodeInfo.num > 0 else { return nil }
|
||||
|
|
@ -404,7 +404,7 @@ func adminAppPacket (packet: MeshPacket, context: NSManagedObjectContext) {
|
|||
|
||||
if !cmmc.messages.isEmpty {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.cannedmessages.messages.received %@", comment: "Canned Messages Messages Received For: %@"), String(packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.cannedmessages.messages.received %@".localized, String(packet.from))
|
||||
MeshLogger.log("🥫 \(logString)")
|
||||
|
||||
let fetchNodeRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -533,8 +533,8 @@ func routingPacket (packet: MeshPacket, connectedNodeNum: Int64, context: NSMana
|
|||
|
||||
let routingError = RoutingError(rawValue: routingMessage.errorReason.rawValue)
|
||||
|
||||
let routingErrorString = routingError?.display ?? NSLocalizedString("unknown", comment: "")
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.routing.message %@ %@", comment: "Routing received for RequestID: %@ Ack Status: %@"), String(packet.decoded.requestID), routingErrorString)
|
||||
let routingErrorString = routingError?.display ?? "unknown".localized
|
||||
let logString = String.localizedStringWithFormat("mesh.log.routing.message %@ %@".localized, String(packet.decoded.requestID), routingErrorString)
|
||||
MeshLogger.log("🕸️ \(logString)")
|
||||
|
||||
let fetchMessageRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "MessageEntity")
|
||||
|
|
@ -599,7 +599,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage
|
|||
|
||||
// Only log telemetry from the mesh not the connected device
|
||||
if connectedNode != Int64(packet.from) {
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.telemetry.received %@", comment: "Telemetry received for: %@"), String(packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.telemetry.received %@".localized, String(packet.from))
|
||||
MeshLogger.log("📈 \(logString)")
|
||||
} else {
|
||||
// If it is the connected node
|
||||
|
|
@ -705,7 +705,7 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
|
|||
|
||||
if let messageText = String(bytes: packet.decoded.payload, encoding: .utf8) {
|
||||
|
||||
MeshLogger.log("💬 \(NSLocalizedString("mesh.log.textmessage.received", comment: "Message received from the text message app"))")
|
||||
MeshLogger.log("💬 \("mesh.log.textmessage.received".localized)")
|
||||
|
||||
let messageUsers: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "UserEntity")
|
||||
messageUsers.predicate = NSPredicate(format: "num IN %@", [packet.to, packet.from])
|
||||
|
|
@ -754,12 +754,12 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
|
|||
manager.notifications = [
|
||||
Notification(
|
||||
id: ("notification.id.\(newMessage.messageId)"),
|
||||
title: "\(newMessage.fromUser?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))",
|
||||
title: "\(newMessage.fromUser?.longName ?? "unknown".localized)",
|
||||
subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")",
|
||||
content: messageText)
|
||||
]
|
||||
manager.schedule()
|
||||
print("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
print("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? "unknown".localized)")
|
||||
} else if newMessage.fromUser != nil && newMessage.toUser == nil {
|
||||
|
||||
let fetchMyInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "MyInfoEntity")
|
||||
|
|
@ -781,12 +781,12 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
|
|||
manager.notifications = [
|
||||
Notification(
|
||||
id: ("notification.id.\(newMessage.messageId)"),
|
||||
title: "\(newMessage.fromUser?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))",
|
||||
title: "\(newMessage.fromUser?.longName ?? "unknown".localized)",
|
||||
subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")",
|
||||
content: messageText)
|
||||
]
|
||||
manager.schedule()
|
||||
print("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
print("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? "unknown".localized)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -808,7 +808,7 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
|
|||
|
||||
func waypointPacket (packet: MeshPacket, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.waypoint.received %@", comment: "Waypoint Packet received from node: %@"), String(packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.waypoint.received %@".localized, String(packet.from))
|
||||
MeshLogger.log("📍 \(logString)")
|
||||
|
||||
let fetchWaypointRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "WaypointEntity")
|
||||
|
|
|
|||
|
|
@ -59,6 +59,6 @@ extension PositionEntity {
|
|||
|
||||
extension PositionEntity: MKAnnotation {
|
||||
public var coordinate: CLLocationCoordinate2D { nodeCoordinate ?? LocationHelper.DefaultLocation }
|
||||
public var title: String? { nodePosition?.user?.shortName ?? NSLocalizedString("unknown", comment: "Unknown") }
|
||||
public var title: String? { nodePosition?.user?.shortName ?? "unknown".localized }
|
||||
public var subtitle: String? { time?.formatted() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public func clearCoreDataDatabase(context: NSManagedObjectContext) {
|
|||
|
||||
func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.nodeinfo.received %@", comment: "Node info received for: %@"), String(packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.nodeinfo.received %@".localized, String(packet.from))
|
||||
MeshLogger.log("📟 \(logString)")
|
||||
|
||||
guard packet.from > 0 else { return }
|
||||
|
|
@ -179,7 +179,7 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext)
|
|||
|
||||
func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.position.received %@", comment: "Position Packet received from node: %@"), String(packet.from))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.position.received %@".localized, String(packet.from))
|
||||
MeshLogger.log("📍 \(logString)")
|
||||
|
||||
let fetchNodePositionRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -262,7 +262,7 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext)
|
|||
|
||||
func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.bluetooth.config %@", comment: "Bluetooth config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.bluetooth.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("📶 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -304,7 +304,7 @@ func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, node
|
|||
|
||||
func upsertDeviceConfigPacket(config: Meshtastic.Config.DeviceConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.device.config %@", comment: "Device config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.device.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("📟 \(logString)")
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
fetchNodeInfoRequest.predicate = NSPredicate(format: "num == %lld", Int64(nodeNum))
|
||||
|
|
@ -353,7 +353,7 @@ func upsertDeviceConfigPacket(config: Meshtastic.Config.DeviceConfig, nodeNum: I
|
|||
|
||||
func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.display.config %@", comment: "Display config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.display.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🖥️ \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -417,7 +417,7 @@ func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum:
|
|||
|
||||
func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.lora.config %@", comment: "LoRa config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.lora.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("📻 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -482,7 +482,7 @@ func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64
|
|||
|
||||
func upsertNetworkConfigPacket(config: Meshtastic.Config.NetworkConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.network.config %@", comment: "Network config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.network.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🌐 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -529,7 +529,7 @@ func upsertNetworkConfigPacket(config: Meshtastic.Config.NetworkConfig, nodeNum:
|
|||
|
||||
func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.position.config %@", comment: "Positon config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.position.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🗺️ \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -588,7 +588,7 @@ func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNu
|
|||
|
||||
func upsertCannedMessagesModuleConfigPacket(config: Meshtastic.ModuleConfig.CannedMessageConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.cannedmessage.config %@", comment: "Canned Message module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.cannedmessage.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🥫 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -652,7 +652,7 @@ func upsertCannedMessagesModuleConfigPacket(config: Meshtastic.ModuleConfig.Cann
|
|||
|
||||
func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfig.ExternalNotificationConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.externalnotification.config %@", comment: "External Notifiation module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.externalnotification.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("📣 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -720,7 +720,7 @@ func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfi
|
|||
|
||||
func upsertRtttlConfigPacket(ringtone: String, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.ringtone.config %@", comment: "RTTTL Ringtone config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.ringtone.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("⛰️ \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -759,7 +759,7 @@ func upsertRtttlConfigPacket(ringtone: String, nodeNum: Int64, context: NSManage
|
|||
|
||||
func upsertMqttModuleConfigPacket(config: Meshtastic.ModuleConfig.MQTTConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.mqtt.config %@", comment: "MQTT module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.mqtt.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🌉 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -813,7 +813,7 @@ func upsertMqttModuleConfigPacket(config: Meshtastic.ModuleConfig.MQTTConfig, no
|
|||
|
||||
func upsertRangeTestModuleConfigPacket(config: Meshtastic.ModuleConfig.RangeTestConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.rangetest.config %@", comment: "Range Test module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.rangetest.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("⛰️ \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -856,7 +856,7 @@ func upsertRangeTestModuleConfigPacket(config: Meshtastic.ModuleConfig.RangeTest
|
|||
|
||||
func upsertSerialModuleConfigPacket(config: Meshtastic.ModuleConfig.SerialConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.serial.config %@", comment: "Serial module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.serial.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("🤖 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -919,7 +919,7 @@ func upsertSerialModuleConfigPacket(config: Meshtastic.ModuleConfig.SerialConfig
|
|||
|
||||
func upsertTelemetryModuleConfigPacket(config: Meshtastic.ModuleConfig.TelemetryConfig, nodeNum: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.telemetry.config %@", comment: "Telemetry module config received: %@"), String(nodeNum))
|
||||
let logString = String.localizedStringWithFormat("mesh.log.telemetry.config %@".localized, String(nodeNum))
|
||||
MeshLogger.log("📈 \(logString)")
|
||||
|
||||
let fetchNodeInfoRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "NodeInfoEntity")
|
||||
|
|
@ -936,17 +936,14 @@ func upsertTelemetryModuleConfigPacket(config: Meshtastic.ModuleConfig.Telemetry
|
|||
if fetchedNode[0].telemetryConfig == nil {
|
||||
|
||||
let newTelemetryConfig = TelemetryConfigEntity(context: context)
|
||||
|
||||
newTelemetryConfig.deviceUpdateInterval = Int32(config.deviceUpdateInterval)
|
||||
newTelemetryConfig.environmentUpdateInterval = Int32(config.environmentUpdateInterval)
|
||||
newTelemetryConfig.environmentMeasurementEnabled = config.environmentMeasurementEnabled
|
||||
newTelemetryConfig.environmentScreenEnabled = config.environmentScreenEnabled
|
||||
newTelemetryConfig.environmentDisplayFahrenheit = config.environmentDisplayFahrenheit
|
||||
|
||||
fetchedNode[0].telemetryConfig = newTelemetryConfig
|
||||
|
||||
} else {
|
||||
|
||||
fetchedNode[0].telemetryConfig?.deviceUpdateInterval = Int32(config.deviceUpdateInterval)
|
||||
fetchedNode[0].telemetryConfig?.environmentUpdateInterval = Int32(config.environmentUpdateInterval)
|
||||
fetchedNode[0].telemetryConfig?.environmentMeasurementEnabled = config.environmentMeasurementEnabled
|
||||
|
|
|
|||
|
|
@ -59,10 +59,10 @@ struct Connect: View {
|
|||
if node != nil {
|
||||
Text(bleManager.connectedPeripheral.longName).font(.title2)
|
||||
}
|
||||
Text("ble.name").font(.callout)+Text(": \(bleManager.connectedPeripheral.peripheral.name ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("ble.name").font(.callout)+Text(": \(bleManager.connectedPeripheral.peripheral.name ?? "unknown".localized)")
|
||||
.font(.callout).foregroundColor(Color.gray)
|
||||
if node != nil {
|
||||
Text("firmware.version").font(.callout)+Text(": \(node?.myInfo?.firmwareVersion ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("firmware.version").font(.callout)+Text(": \(node?.myInfo?.firmwareVersion ?? "unknown".localized)")
|
||||
.font(.callout).foregroundColor(Color.gray)
|
||||
}
|
||||
if bleManager.isSubscribed {
|
||||
|
|
@ -110,7 +110,7 @@ struct Connect: View {
|
|||
#endif
|
||||
Text("Num: \(String(node!.num))")
|
||||
Text("Short Name: \(node?.user?.shortName ?? "????")")
|
||||
Text("Long Name: \(node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("Long Name: \(node?.user?.longName ?? "unknown".localized)")
|
||||
Text("Max Channels: \(String(node?.myInfo?.maxChannels ?? 0))")
|
||||
Text("Bitrate: \(String(format: "%.2f", node?.myInfo?.bitrate ?? 0.00))")
|
||||
Text("BLE RSSI: \(bleManager.connectedPeripheral.rssi)")
|
||||
|
|
|
|||
|
|
@ -147,11 +147,11 @@ struct NodeInfoView: View {
|
|||
Divider()
|
||||
VStack {
|
||||
if node.user != nil {
|
||||
Image(node.user!.hwModel ?? NSLocalizedString("unset", comment: "Unset"))
|
||||
Image(node.user!.hwModel ?? "unset".localized)
|
||||
.resizable()
|
||||
.frame(width: 75, height: 75)
|
||||
.cornerRadius(5)
|
||||
Text(String(node.user!.hwModel ?? NSLocalizedString("unset", comment: "Unset")))
|
||||
Text(String(node.user!.hwModel ?? "unset".localized))
|
||||
.font(.callout).fixedSize()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
}
|
||||
if LocationHelper.currentLocation.distance(from: LocationHelper.DefaultLocation) > 0.0 {
|
||||
let metersAway = positionAnnotation.coordinate.distance(from: LocationHelper.currentLocation)
|
||||
subtitle.text! += NSLocalizedString("distance", comment: "") + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
subtitle.text! += "distance".localized + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
}
|
||||
subtitle.text! += positionAnnotation.time?.formatted() ?? "Unknown \n"
|
||||
subtitle.numberOfLines = 0
|
||||
|
|
@ -343,7 +343,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
if LocationHelper.currentLocation.distance(from: LocationHelper.DefaultLocation) > 0.0 {
|
||||
let metersAway = waypointAnnotation.coordinate.distance(from: LocationHelper.currentLocation)
|
||||
let distanceFormatter = MKDistanceFormatter()
|
||||
subtitle.text! += NSLocalizedString("distance", comment: "") + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
subtitle.text! += "distance".localized + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n"
|
||||
}
|
||||
if waypointAnnotation.created != nil {
|
||||
subtitle.text! += "Created: \(waypointAnnotation.created?.formatted() ?? "Unknown") \n"
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ struct ChannelMessageList: View {
|
|||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.large).foregroundColor(.accentColor)
|
||||
}
|
||||
ProgressView("\(NSLocalizedString("bytes", comment: "")): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
ProgressView("\("bytes".localized): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
.frame(width: 130)
|
||||
.padding(5)
|
||||
.font(.subheadline)
|
||||
|
|
@ -325,7 +325,7 @@ struct ChannelMessageList: View {
|
|||
.imageScale(.large).foregroundColor(.accentColor)
|
||||
}
|
||||
|
||||
ProgressView("\(NSLocalizedString("bytes", comment: "")): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
ProgressView("\("bytes".localized): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
.frame(width: 130)
|
||||
.padding(5)
|
||||
.font(.subheadline)
|
||||
|
|
@ -377,7 +377,7 @@ struct ChannelMessageList: View {
|
|||
ToolbarItem(placement: .principal) {
|
||||
HStack {
|
||||
CircleText(text: String(channel.index), color: .accentColor, circleSize: 44, fontSize: 30).fixedSize()
|
||||
Text(String(channel.name ?? NSLocalizedString("unknown", comment: "Unknown")).camelCaseToWords()).font(.headline)
|
||||
Text(String(channel.name ?? "unknown".localized).camelCaseToWords()).font(.headline)
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ struct Contacts: View {
|
|||
.padding(.trailing, 5)
|
||||
VStack {
|
||||
HStack {
|
||||
Text(user.longName ?? NSLocalizedString("unknown", comment: "Unknown")).font(.headline)
|
||||
Text(user.longName ?? "unknown".localized).font(.headline)
|
||||
Spacer()
|
||||
if user.messageList.count > 0 {
|
||||
VStack(alignment: .trailing) {
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ struct UserMessageList: View {
|
|||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.large).foregroundColor(.accentColor)
|
||||
}
|
||||
ProgressView("\(NSLocalizedString("bytes", comment: "")): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
ProgressView("\("bytes".localized): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
.frame(width: 130)
|
||||
.padding(5)
|
||||
.font(.subheadline)
|
||||
|
|
@ -302,7 +302,7 @@ struct UserMessageList: View {
|
|||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.large).foregroundColor(.accentColor)
|
||||
}
|
||||
ProgressView("\(NSLocalizedString("bytes", comment: "")): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
ProgressView("\("bytes".localized): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
|
||||
.frame(width: 130)
|
||||
.padding(5)
|
||||
.font(.subheadline)
|
||||
|
|
@ -354,7 +354,7 @@ struct UserMessageList: View {
|
|||
ToolbarItem(placement: .principal) {
|
||||
HStack {
|
||||
CircleText(text: user.shortName ?? "???", color: Color(UIColor(hex: UInt32(user.num))), circleSize: 44, fontSize: 14, textColor: UIColor(hex: UInt32(user.num)).isLight() ? .black : .white ).fixedSize()
|
||||
Text(user.longName ?? NSLocalizedString("unknown", comment: "Unknown")).font(.headline)
|
||||
Text(user.longName ?? "unknown".localized).font(.headline)
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ struct DeviceMetricsLog: View {
|
|||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
}
|
||||
TableColumn("timestamp") { dm in
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
}
|
||||
.width(min: 180)
|
||||
}
|
||||
|
|
@ -215,7 +215,7 @@ struct DeviceMetricsLog: View {
|
|||
isPresented: $isExporting,
|
||||
document: CsvDocument(emptyCsv: exportString),
|
||||
contentType: .commaSeparatedText,
|
||||
defaultFilename: String("\(node.user?.longName ?? "Node") \(NSLocalizedString("device.metrics.log", comment: "Device Metrics Log"))"),
|
||||
defaultFilename: String("\(node.user?.longName ?? "Node") \("device.metrics.log".localized)"),
|
||||
onCompletion: { result in
|
||||
if case .success = result {
|
||||
print("Device metrics log download succeeded.")
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ struct EnvironmentMetricsLog: View {
|
|||
Text("\(String(format: "%.2f", em.voltage))")
|
||||
}
|
||||
TableColumn("timestamp") { em in
|
||||
Text(em.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
Text(em.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
}
|
||||
.width(min: 180)
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ struct EnvironmentMetricsLog: View {
|
|||
.font(.caption)
|
||||
Text("\(String(format: "%.2f", em.gasResistance))")
|
||||
.font(.caption)
|
||||
Text(em.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
Text(em.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
.font(.caption2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ struct NodeDetail: View {
|
|||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
})
|
||||
.navigationBarTitle(String(node.user?.longName ?? NSLocalizedString("unknown", comment: "")), displayMode: .inline)
|
||||
.navigationBarTitle(String(node.user?.longName ?? "unknown".localized), displayMode: .inline)
|
||||
.navigationBarItems(trailing:
|
||||
ZStack {
|
||||
ConnectedDevice(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct NodeList: View {
|
|||
CircleText(text: node.user?.shortName ?? "???", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65, fontSize: 20, brightness: 0.0, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white)
|
||||
.padding(.trailing, 5)
|
||||
VStack(alignment: .leading) {
|
||||
Text(node.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")).font(.headline)
|
||||
Text(node.user?.longName ?? "unknown".localized).font(.headline)
|
||||
if connected {
|
||||
HStack(alignment: .bottom) {
|
||||
Image(systemName: "repeat.circle.fill")
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct PositionLog: View {
|
|||
Text("\(String(format: "%.2f", position.snr)) dB")
|
||||
}
|
||||
TableColumn("Time Stamp") { position in
|
||||
Text(position.time?.formattedDate(format: dateFormatString) ?? NSLocalizedString("unknown.age", comment: ""))
|
||||
Text(position.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
}
|
||||
.width(min: 180)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct AdminMessageList: View {
|
|||
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
Text("\(am.adminDescription ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("\(am.adminDescription ?? "unknown".localized)")
|
||||
.font(.caption)
|
||||
|
||||
Text("Sent \(Date(timeIntervalSince1970: TimeInterval(am.messageTimestamp)).formattedDate(format: dateFormatString))")
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ struct BluetoothConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ struct DeviceConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ struct DisplayConfig: View {
|
|||
"are.you.sure",
|
||||
isPresented: $isPresentingSaveConfirm
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -189,8 +189,8 @@ struct LoRaConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? 0, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -207,8 +207,8 @@ struct CannedMessagesConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
|
||||
if hasChanges {
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ struct ExternalNotificationConfig: View {
|
|||
) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
|
||||
if connectedNode != nil {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
var enc = ModuleConfig.ExternalNotificationConfig()
|
||||
enc.enabled = enabled
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ struct MQTTConfig: View {
|
|||
) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
|
||||
if connectedNode != nil {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
var mqtt = ModuleConfig.MQTTConfig()
|
||||
mqtt.enabled = self.enabled
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ struct RangeTestConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ struct RtttlConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ struct SerialConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ struct TelemetryConfig: View {
|
|||
) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
|
||||
if connectedNode != nil {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
var tc = ModuleConfig.TelemetryConfig()
|
||||
tc.deviceUpdateInterval = UInt32(deviceUpdateInterval)
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ struct NetworkConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
|
||||
if connectedNode != nil {
|
||||
|
|
|
|||
|
|
@ -283,8 +283,8 @@ struct PositionConfig: View {
|
|||
isPresented: $isPresentingSaveConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
|
||||
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)
|
||||
let nodeName = node?.user?.longName ?? "unknown".localized
|
||||
let buttonText = String.localizedStringWithFormat("save.config %@".localized, nodeName)
|
||||
Button(buttonText) {
|
||||
|
||||
if fixedPosition {
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ struct Settings: View {
|
|||
}
|
||||
ForEach(nodes) { node in
|
||||
if node.num == bleManager.connectedPeripheral?.num ?? 0 {
|
||||
Text("BLE Config: \(node.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("BLE Config: \(node.user?.longName ?? "unknown".localized)")
|
||||
.tag(Int(node.num))
|
||||
} else if node.metadata != nil {
|
||||
Text("Remote Config: \(node.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("Remote Config: \(node.user?.longName ?? "unknown".localized)")
|
||||
.tag(Int(node.num))
|
||||
} else {
|
||||
Text("Request Admin: \(node.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
|
||||
Text("Request Admin: \(node.user?.longName ?? "unknown".localized)")
|
||||
.tag(Int(node.num))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue