5 seconds for all admin messages without responses

This commit is contained in:
Garth Vander Houwen 2023-02-02 08:54:56 -08:00
parent 37322a1fe5
commit 44d1942d20
2 changed files with 21 additions and 21 deletions

View file

@ -881,7 +881,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
public func sendFactoryReset(fromUser: UserEntity, toUser: UserEntity) -> Bool {
var adminPacket = AdminMessage()
adminPacket.factoryReset = 1
adminPacket.factoryReset = 5
var meshPacket: MeshPacket = MeshPacket()
meshPacket.to = UInt32(toUser.num)
@ -905,7 +905,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
public func sendNodeDBReset(fromUser: UserEntity, toUser: UserEntity) -> Bool {
var adminPacket = AdminMessage()
adminPacket.nodedbReset = 1
adminPacket.nodedbReset = 5
var meshPacket: MeshPacket = MeshPacket()
meshPacket.to = UInt32(toUser.num)

View file

@ -357,10 +357,11 @@ struct NodeDetail: View {
}
}
if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num && self.bleManager.connectedPeripheral.num == node.num && node.metadata != nil {
if (self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num)
|| (self.bleManager.connectedPeripheral != nil && node.metadata != nil) {
HStack {
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
if node.metadata?.canShutdown ?? false {
Button(action: {
@ -378,7 +379,7 @@ struct NodeDetail: View {
isPresented: $showingShutdownConfirm
) {
Button("Shutdown Node?", role: .destructive) {
if !bleManager.sendShutdown(fromUser: node.user!, toUser: node.user!) {
if !bleManager.sendShutdown(fromUser: connectedNode.user!, toUser: node.user!) {
print("Shutdown Failed")
}
}
@ -398,7 +399,7 @@ struct NodeDetail: View {
isPresented: $showingRebootConfirm
) {
Button("reboot.node", role: .destructive) {
if !bleManager.sendReboot(fromUser: node.user!, toUser: node.user!) {
if !bleManager.sendReboot(fromUser: connectedNode.user!, toUser: node.user!) {
print("Reboot Failed")
}
}
@ -407,21 +408,22 @@ struct NodeDetail: View {
.padding(5)
Divider()
}
VStack {
AsyncImage(url: attributionLogo) { image in
image
.resizable()
.scaledToFit()
} placeholder: {
ProgressView()
.controlSize(.mini)
if node.positions?.count ?? 0 > 0 {
VStack {
AsyncImage(url: attributionLogo) { image in
image
.resizable()
.scaledToFit()
} placeholder: {
ProgressView()
.controlSize(.mini)
}
.frame(height: 15)
Link("Other data sources", destination: attributionLink ?? URL(string: "https://weather-data.apple.com/legal-attribution.html")!)
}
.frame(height: 15)
Link("Other data sources", destination: attributionLink ?? URL(string: "https://weather-data.apple.com/legal-attribution.html")!)
.font(.footnote)
}
.font(.footnote)
}
}
.edgesIgnoringSafeArea([.leading, .trailing])
@ -463,9 +465,7 @@ struct NodeDetail: View {
let attribution = try await WeatherService.shared.attribution
attributionLink = attribution.legalPageURL
attributionLogo = colorScheme == .light ? attribution.combinedMarkLightURL : attribution.combinedMarkDarkURL
}
} catch {
print("Could not gather weather information...", error.localizedDescription)
condition = .clear