Remove local stats from bluetooth connect view as they don't update

This commit is contained in:
Garth Vander Houwen 2024-09-22 08:20:51 -07:00
parent 25143ddf75
commit 2f7b087ff2
2 changed files with 0 additions and 76 deletions

View file

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

View file

@ -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 {