Hook up the position precision channel settings

This commit is contained in:
Garth Vander Houwen 2024-02-24 22:33:11 -08:00
parent 02009bcf56
commit 85c2a9e938
3 changed files with 39 additions and 3 deletions

View file

@ -532,7 +532,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
connectedPeripheral.name = myInfo?.bleName ?? "unknown".localized
connectedPeripheral.longName = myInfo?.bleName ?? "unknown".localized
}
//tryClearExistingChannels()
tryClearExistingChannels()
}
// NodeInfo
if decodedInfo.nodeInfo.num > 0 {// && !invalidVersion {

View file

@ -106,7 +106,7 @@ struct NodeMapSwiftUI: View {
let radius : CLLocationDistance = pp?.precisionMeters ?? 0
if radius > 0.0 {
MapCircle(center: position.coordinate, radius: radius)
.foregroundStyle(Color(nodeColor).opacity(0.60))
.foregroundStyle(Color(nodeColor).opacity(0.60))
}
}
Annotation(position.latest ? node.user?.shortName ?? "?": "", coordinate: position.coordinate) {

View file

@ -88,6 +88,20 @@ struct Channels: View {
positionPrecision = 0
preciseLocation = false
positionsEnabled = false
} else {
positionPrecision = Double(channel.positionPrecision)
if positionPrecision == 32 {
preciseLocation = true
positionsEnabled = true
} else {
preciseLocation = false
}
if positionPrecision == 0 {
positionsEnabled = false
} else {
positionsEnabled = true
}
}
isPresentingEditView = true
}) {
@ -314,6 +328,28 @@ struct Channels: View {
.onChange(of: channelRole) { _ in
hasChanges = true
}
.onChange(of: preciseLocation) { loc in
if loc {
positionPrecision = 32
} else {
positionPrecision = 14
}
hasChanges = true
}
.onChange(of: positionPrecision) { _ in
hasChanges = true
}
.onChange(of: positionsEnabled) { pe in
if pe {
if positionPrecision == 0 {
positionPrecision = 32
}
} else {
positionPrecision = 0
}
hasChanges = true
}
.onChange(of: uplink) { _ in
hasChanges = true
}
@ -385,7 +421,7 @@ struct Channels: View {
channelName = ""
channelRole = 2
hasChanges = false
_ = bleManager.getChannel(channel: channel, fromUser: node!.user!, toUser: node!.user!)
//_ = bleManager.getChannel(channel: channel, fromUser: node!.user!, toUser: node!.user!)
}
} label: {
Label("save", systemImage: "square.and.arrow.down")