mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
commit
feab65325e
15 changed files with 57 additions and 119 deletions
|
|
@ -140,16 +140,6 @@
|
|||
},
|
||||
"%@%%" : {
|
||||
|
||||
},
|
||||
"%@%% %@%%" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "%1$@%% %2$@%%"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"%@°F" : {
|
||||
|
||||
|
|
@ -1428,16 +1418,6 @@
|
|||
},
|
||||
"Bad" : {
|
||||
|
||||
},
|
||||
"Bad Packets: %d %@%%" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Bad Packets: %1$d %2$@%%"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Bandwidth" : {
|
||||
|
||||
|
|
@ -16085,16 +16065,6 @@
|
|||
},
|
||||
"Override automatic OLED screen detection." : {
|
||||
|
||||
},
|
||||
"Packets: Sent: %d Received: %d" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Packets: Sent: %1$d Received: %2$d"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"password" : {
|
||||
"localizations" : {
|
||||
|
|
@ -22325,9 +22295,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Uptime: %@" : {
|
||||
|
||||
},
|
||||
"Use a PWM output (like the RAK Buzzer) for tunes instead of an on/off output. This will ignore the output, output duration and active settings and use the device config buzzer GPIO option instead." : {
|
||||
|
||||
|
|
|
|||
|
|
@ -91,5 +91,4 @@ extension String {
|
|||
let end = index(start, offsetBy: range.upperBound - range.lowerBound)
|
||||
return String(self[start ..< end])
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ struct Connect: View {
|
|||
@State var invalidFirmwareVersion = false
|
||||
@State var liveActivityStarted = false
|
||||
@State var selectedPeripherialId = ""
|
||||
@State var localStats: TelemetryEntity?
|
||||
|
||||
init () {
|
||||
let notificationCenter = UNUserNotificationCenter.current()
|
||||
|
|
@ -91,45 +90,6 @@ struct Connect: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
VStack {
|
||||
if localStats != nil {
|
||||
Divider()
|
||||
if localStats?.numTotalNodes ?? 0 >= 100 {
|
||||
Text("\(String(format: "Connected: %d nodes online", localStats?.numOnlineNodes ?? 0))")
|
||||
.font(.callout)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize()
|
||||
} else {
|
||||
Text("\(String(format: "Connected: %d of %d nodes online", localStats?.numOnlineNodes ?? 0, localStats?.numTotalNodes ?? 0))")
|
||||
.font(.callout)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize()
|
||||
}
|
||||
Text("\(String(format: "Ch. Util: %.2f", localStats?.channelUtilization ?? 0))% \(String(format: "Airtime: %.2f", localStats?.airUtilTx ?? 0))%")
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
Text("Packets: Sent: \(localStats?.numPacketsTx ?? 0) Received: \(localStats?.numPacketsRx ?? 0)")
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
let errorRate = (Double(localStats?.numPacketsRxBad ?? -1) / Double(localStats?.numPacketsRx ?? -1)) * 100
|
||||
Text("Bad Packets: \(localStats?.numPacketsRxBad ?? 0) \(String(format: "Error Rate: %.2f", errorRate))%")
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize()
|
||||
let now = Date.now
|
||||
let later = now + TimeInterval(Double(localStats?.numPacketsRxBad ?? 0))
|
||||
let uptime = (now..<later).formatted(.components(style: .narrow))
|
||||
Text("Uptime: \(uptime)")
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.caption)
|
||||
.foregroundColor(Color.gray)
|
||||
|
|
@ -350,9 +310,6 @@ struct Connect: View {
|
|||
.onChange(of: (self.bleManager.invalidVersion)) { _ in
|
||||
invalidFirmwareVersion = self.bleManager.invalidVersion
|
||||
}
|
||||
.onChange(of: [node?.telemetries]) { _ in
|
||||
localStats = node?.telemetries?.filtered(using: NSPredicate(format: "metricsType == 4")).lastObject as? TelemetryEntity
|
||||
}
|
||||
.onChange(of: (self.bleManager.isSubscribed)) { sub in
|
||||
|
||||
if UserDefaults.preferredPeripheralId.count > 0 && sub {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,12 @@ struct WaypointFormMapKit: View {
|
|||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: name, perform: { _ in
|
||||
let totalBytes = name.utf8.count
|
||||
var totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
while totalBytes > 30 {
|
||||
name = String(name.dropLast())
|
||||
totalBytes = name.utf8.count
|
||||
}
|
||||
if totalBytes > 30 {
|
||||
name = String(name.dropLast())
|
||||
}
|
||||
|
|
@ -69,10 +73,11 @@ struct WaypointFormMapKit: View {
|
|||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: description, perform: { _ in
|
||||
let totalBytes = description.utf8.count
|
||||
var totalBytes = description.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 100 {
|
||||
while totalBytes > 100 {
|
||||
description = String(description.dropLast())
|
||||
totalBytes = description.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,9 @@ struct TextMessageField: View {
|
|||
.onChange(of: typingMessage, perform: { value in
|
||||
totalBytes = value.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > Self.maxbytes {
|
||||
while totalBytes > Self.maxbytes {
|
||||
typingMessage = String(typingMessage.dropLast())
|
||||
totalBytes = typingMessage.utf8.count
|
||||
}
|
||||
})
|
||||
.keyboardType(.default)
|
||||
|
|
|
|||
|
|
@ -66,10 +66,11 @@ struct WaypointForm: View {
|
|||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: name, perform: { _ in
|
||||
let totalBytes = name.utf8.count
|
||||
var totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 30 {
|
||||
while totalBytes > 30 {
|
||||
name = String(name.dropLast())
|
||||
totalBytes = name.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -83,10 +84,11 @@ struct WaypointForm: View {
|
|||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: description, perform: { _ in
|
||||
let totalBytes = description.utf8.count
|
||||
var totalBytes = description.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 100 {
|
||||
while totalBytes > 100 {
|
||||
description = String(description.dropLast())
|
||||
totalBytes = description.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,10 +43,11 @@ struct ChannelForm: View {
|
|||
.foregroundColor(Color.gray)
|
||||
.onChange(of: channelName, perform: { _ in
|
||||
channelName = channelName.replacing(" ", with: "")
|
||||
let totalBytes = channelName.utf8.count
|
||||
var totalBytes = channelName.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 11 {
|
||||
while totalBytes > 11 {
|
||||
channelName = String(channelName.dropLast())
|
||||
totalBytes = channelName.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -94,14 +94,14 @@ struct DeviceConfig: View {
|
|||
TextField("Time Zone", text: $tzdef, axis: .vertical)
|
||||
.foregroundColor(.gray)
|
||||
.onChange(of: tzdef, perform: { _ in
|
||||
let totalBytes = tzdef.utf8.count
|
||||
var totalBytes = tzdef.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 63 {
|
||||
while totalBytes > 63 {
|
||||
tzdef = String(tzdef.dropLast())
|
||||
totalBytes = tzdef.utf8.count
|
||||
}
|
||||
})
|
||||
.foregroundColor(.gray)
|
||||
|
||||
}
|
||||
.keyboardType(.default)
|
||||
.disableAutocorrection(true)
|
||||
|
|
|
|||
|
|
@ -73,10 +73,11 @@ struct CannedMessagesConfig: View {
|
|||
.disableAutocorrection(true)
|
||||
.onChange(of: messages, perform: { _ in
|
||||
|
||||
let totalBytes = messages.utf8.count
|
||||
var totalBytes = messages.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 198 {
|
||||
while totalBytes > 198 {
|
||||
messages = String(messages.dropLast())
|
||||
totalBytes = messages.utf8.count
|
||||
}
|
||||
hasMessagesChanges = true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -92,11 +92,11 @@ struct DetectionSensorConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: name, perform: { _ in
|
||||
|
||||
let totalBytes = name.utf8.count
|
||||
var totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 20 {
|
||||
while totalBytes > 20 {
|
||||
name = String(name.dropLast())
|
||||
totalBytes = name.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,11 @@ struct MQTTConfig: View {
|
|||
TextField("Root Topic", text: $root)
|
||||
.foregroundColor(.gray)
|
||||
.onChange(of: root, perform: { _ in
|
||||
let totalBytes = root.utf8.count
|
||||
var totalBytes = root.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 30 {
|
||||
while totalBytes > 30 {
|
||||
root = String(root.dropLast())
|
||||
totalBytes = root.utf8.count
|
||||
}
|
||||
})
|
||||
.foregroundColor(.gray)
|
||||
|
|
@ -162,10 +163,11 @@ struct MQTTConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: address, perform: { _ in
|
||||
let totalBytes = address.utf8.count
|
||||
var totalBytes = address.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 62 {
|
||||
while totalBytes > 62 {
|
||||
address = String(address.dropLast())
|
||||
totalBytes = address.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
@ -180,12 +182,11 @@ struct MQTTConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: username, perform: { _ in
|
||||
|
||||
let totalBytes = username.utf8.count
|
||||
|
||||
var totalBytes = username.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 62 {
|
||||
while totalBytes > 62 {
|
||||
username = String(username.dropLast())
|
||||
totalBytes = username.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
@ -200,11 +201,11 @@ struct MQTTConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: password, perform: { _ in
|
||||
|
||||
let totalBytes = password.utf8.count
|
||||
var totalBytes = password.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 62 {
|
||||
while totalBytes > 62 {
|
||||
password = String(password.dropLast())
|
||||
totalBytes = password.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ struct RtttlConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: ringtone, perform: { _ in
|
||||
|
||||
let totalBytes = ringtone.utf8.count
|
||||
var totalBytes = ringtone.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 228 {
|
||||
while totalBytes > 228 {
|
||||
ringtone = String(ringtone.dropLast())
|
||||
totalBytes = ringtone.utf8.count
|
||||
}
|
||||
})
|
||||
.foregroundColor(.gray)
|
||||
|
|
|
|||
|
|
@ -46,10 +46,11 @@ struct NetworkConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: wifiSsid, perform: { _ in
|
||||
let totalBytes = wifiSsid.utf8.count
|
||||
var totalBytes = wifiSsid.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 32 {
|
||||
while totalBytes > 32 {
|
||||
wifiSsid = String(wifiSsid.dropLast())
|
||||
totalBytes = wifiSsid.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
@ -63,10 +64,11 @@ struct NetworkConfig: View {
|
|||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.onChange(of: wifiPsk, perform: { _ in
|
||||
let totalBytes = wifiPsk.utf8.count
|
||||
var totalBytes = wifiPsk.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 63 {
|
||||
while totalBytes > 63 {
|
||||
wifiPsk = String(wifiPsk.dropLast())
|
||||
totalBytes = wifiPsk.utf8.count
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -177,11 +177,11 @@ struct Routes: View {
|
|||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: name, perform: { _ in
|
||||
let totalBytes = name.utf8.count
|
||||
var totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
|
||||
if totalBytes > 100 {
|
||||
while totalBytes > 100 {
|
||||
name = String(name.dropLast())
|
||||
totalBytes = name.utf8.count
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ struct UserConfig: View {
|
|||
|
||||
TextField("Long Name", text: $longName)
|
||||
.onChange(of: longName, perform: { _ in
|
||||
let totalBytes = longName.utf8.count
|
||||
var totalBytes = longName.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > (isLicensed ? 6 : 36) {
|
||||
while totalBytes > (isLicensed ? 6 : 36) {
|
||||
longName = String(longName.dropLast())
|
||||
totalBytes = longName.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -74,10 +75,11 @@ struct UserConfig: View {
|
|||
TextField("Short Name", text: $shortName)
|
||||
.foregroundColor(.gray)
|
||||
.onChange(of: shortName, perform: { _ in
|
||||
let totalBytes = shortName.utf8.count
|
||||
var totalBytes = shortName.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 4 {
|
||||
shortName = String(shortName.dropLast())
|
||||
totalBytes = shortName.utf8.count
|
||||
}
|
||||
})
|
||||
.foregroundColor(.gray)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue