Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.5.6 #942

Merged
merged 3 commits into from
Sep 22, 2024
Merged

2.5.6 #942

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,6 @@
},
"%@%%" : {

},
"%@%% %@%%" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@%% %2$@%%"
}
}
}
},
"%@°F" : {

Expand Down Expand Up @@ -1428,16 +1418,6 @@
},
"Bad" : {

},
"Bad Packets: %d %@%%" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Bad Packets: %1$d %2$@%%"
}
}
}
},
"Bandwidth" : {

Expand Down Expand Up @@ -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" : {
Expand Down Expand Up @@ -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." : {

Expand Down
1 change: 0 additions & 1 deletion Meshtastic/Extensions/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@ extension String {
let end = index(start, offsetBy: range.upperBound - range.lowerBound)
return String(self[start ..< end])
}

}
43 changes: 0 additions & 43 deletions Meshtastic/Views/Bluetooth/Connect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 8 additions & 3 deletions Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand All @@ -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
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
Expand All @@ -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
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions Meshtastic/Views/Settings/Channels/ChannelForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic/Views/Settings/Config/DeviceConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
Expand Down
23 changes: 12 additions & 11 deletions Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
})
Expand All @@ -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
})
Expand All @@ -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
})
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions Meshtastic/Views/Settings/Config/NetworkConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand All @@ -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
})
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic/Views/Settings/Routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})

Expand Down
Loading
Loading