Assorted updates

This commit is contained in:
Garth Vander Houwen 2023-01-26 16:19:51 -08:00
parent 8141a36e06
commit 090e414439
6 changed files with 35 additions and 20 deletions

View file

@ -162,12 +162,16 @@ struct MapViewSwiftUI: UIViewRepresentable {
}
@objc func longPressHandler(_ gesture: UILongPressGestureRecognizer) {
// Screen Position - CGPoint
let location = longPressRecognizer.location(in: self.parent.mapView)
// Map Coordinate - CLLocationCoordinate2D
let coordinate = self.parent.mapView.convert(location, toCoordinateFrom: self.parent.mapView)
// Add annotation:
if coordinate.longitude != LocationHelper.DefaultLocation.longitude && coordinate.latitude != LocationHelper.DefaultLocation.latitude {
if gesture.state != UIGestureRecognizer.State.ended {
return
} else if gesture.state != UIGestureRecognizer.State.began {
// Screen Position - CGPoint
let location = longPressRecognizer.location(in: self.parent.mapView)
// Map Coordinate - CLLocationCoordinate2D
let coordinate = self.parent.mapView.convert(location, toCoordinateFrom: self.parent.mapView)
let annotation = MKPointAnnotation()
annotation.title = "Dropped Pin"
annotation.coordinate = coordinate

View file

@ -25,6 +25,7 @@ struct WaypointFormView: View {
@State private var expires: Bool = false
@State private var expire: Date = Date() // = Date.now.addingTimeInterval(60 * 120) // 1 minute * 120 = 2 Hours
@State private var locked: Bool = false
@State private var lockedTo: Int64 = 0
var body: some View {
@ -108,15 +109,15 @@ struct WaypointFormView: View {
}
}
Toggle(isOn: $expires) {
Label("Expires", systemImage: "clock.badge.xmark")
}
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
if expires {
DatePicker("Expire", selection: $expire, in: Date.now...)
.datePickerStyle(.compact)
.font(.callout)
}
// Toggle(isOn: $expires) {
// Label("Expires", systemImage: "clock.badge.xmark")
// }
// .toggleStyle(SwitchToggleStyle(tint: .accentColor))
// if expires {
// DatePicker("Expire", selection: $expire, in: Date.now...)
// .datePickerStyle(.compact)
// .font(.callout)
// }
Toggle(isOn: $locked) {
Label("Locked", systemImage: "lock")
}
@ -143,7 +144,12 @@ struct WaypointFormView: View {
let unicode = unicodeScalers[unicodeScalers.startIndex].value
newWaypoint.icon = unicode
if locked {
newWaypoint.lockedTo = UInt32(bleManager.connectedPeripheral!.num)
if lockedTo == 0 {
newWaypoint.lockedTo = UInt32(bleManager.connectedPeripheral!.num)
} else {
newWaypoint.lockedTo = UInt32(lockedTo)
}
}
if expire.timeIntervalSince1970 > 0 {
newWaypoint.expire = UInt32(expire.timeIntervalSince1970)
@ -213,6 +219,10 @@ struct WaypointFormView: View {
} else {
expires = false
}
if waypoint.locked > 0 {
locked = true
lockedTo = waypoint.locked
}
} else {
name = ""
description = ""
@ -227,8 +237,7 @@ struct WaypointFormView: View {
if coordinate.distance(from: LocationHelper.DefaultLocation) == 0.0 {
// Too close to apple park, bail out
waypointId = 0
//dismiss()
//print(coordinate.distance(from: LocationHelper.DefaultLocation))
dismiss()
}
}
}

View file

@ -124,8 +124,7 @@ struct Settings: View {
Text("lora")
}
.tag(SettingsSidebar.loraConfig)
.disabled(selectedNode == 0)
//.disabled(selectedNode > 0 && selectedNode != connectedNodeNum)
.disabled(selectedNode > 0 && selectedNode != connectedNodeNum)
NavigationLink() {
Channels(node: nodes.first(where: { $0.num == connectedNodeNum }))

View file

@ -169,6 +169,7 @@
"mesh.log.traceroute.received.route %@"="Traceroute Ergebnis: %@";
"mesh.log.wantconfig %@"="Issuing Want Config to %@";
"mesh.log.waypoint.sent %@"="Sent a Waypoint Packet from: %@";
"mesh.log.waypoint.received %@"="Waypoint Packet received from node: %@";
"message"="Nachricht";
"message.details"="Nachrichtendetails";
"messages"="Nachrichten";

View file

@ -169,6 +169,7 @@
"mesh.log.traceroute.sent %@"="Sent a Trace Route Request to node: %@";
"mesh.log.wantconfig %@"="Issuing Want Config to %@";
"mesh.log.waypoint.sent %@"="Sent a Waypoint Packet from: %@";
"mesh.log.waypoint.received %@"="Waypoint Packet received from node: %@";
"message"="Message";
"message.details"="Message Details";
"messages"="Messages";

View file

@ -169,6 +169,7 @@
"mesh.log.traceroute.sent %@"="Sent a Trace Route Request to node: %@";
"mesh.log.wantconfig %@"="Issuing Want Config to %@";
"mesh.log.waypoint.sent %@"="Sent a Waypoint Packet from: %@";
"mesh.log.waypoint.received %@"="Waypoint Packet received from node: %@";
"message"="消息";
"message.details"="消息详情";
"messages"="消息";