mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #305 from meshtastic/working_changes_2.0.12
Working changes 2.0.12
This commit is contained in:
commit
e259fcd943
6 changed files with 76 additions and 24 deletions
|
|
@ -759,6 +759,16 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
|
|||
wayPointEntity.icon = Int64(waypoint.icon)
|
||||
wayPointEntity.latitudeI = waypoint.latitudeI
|
||||
wayPointEntity.longitudeI = waypoint.longitudeI
|
||||
if waypoint.expire > 0 {
|
||||
wayPointEntity.expire = Date.init(timeIntervalSince1970: Double(waypoint.expire))
|
||||
} else {
|
||||
wayPointEntity.expire = nil
|
||||
}
|
||||
if waypoint.lockedTo > 0 {
|
||||
wayPointEntity.locked = Int64(waypoint.lockedTo)
|
||||
} else {
|
||||
wayPointEntity.locked = 0
|
||||
}
|
||||
do {
|
||||
try context!.save()
|
||||
print("💾 Updated Waypoint from Waypoint App Packet From: \(fromNodeNum)")
|
||||
|
|
|
|||
|
|
@ -109,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")
|
||||
}
|
||||
|
|
@ -182,17 +182,56 @@ struct WaypointFormView: View {
|
|||
.padding(.bottom)
|
||||
|
||||
if waypointId > 0 {
|
||||
Button(role: .destructive) {
|
||||
|
||||
Menu {
|
||||
Button("For me", action: {
|
||||
let waypoint = getWaypoint(id: Int64(waypointId), context: bleManager.context!)
|
||||
bleManager.context!.delete(waypoint)
|
||||
do {
|
||||
try bleManager.context!.save()
|
||||
} catch {
|
||||
bleManager.context!.rollback()
|
||||
}
|
||||
dismiss()
|
||||
} label: {
|
||||
bleManager.context!.delete(waypoint)
|
||||
do {
|
||||
try bleManager.context!.save()
|
||||
} catch {
|
||||
bleManager.context!.rollback()
|
||||
}
|
||||
dismiss() })
|
||||
Button("For everyone", action: {
|
||||
var newWaypoint = Waypoint()
|
||||
|
||||
if waypointId > 0 {
|
||||
newWaypoint.id = UInt32(waypointId)
|
||||
} else {
|
||||
newWaypoint.id = UInt32.random(in: UInt32(UInt8.max)..<UInt32.max)
|
||||
}
|
||||
newWaypoint.name = name.count > 0 ? name : "Dropped Pin"
|
||||
newWaypoint.description_p = description
|
||||
newWaypoint.latitudeI = Int32(coordinate.latitude * 1e7)
|
||||
newWaypoint.longitudeI = Int32(coordinate.longitude * 1e7)
|
||||
// Unicode scalar value for the icon emoji string
|
||||
let unicodeScalers = icon.unicodeScalars
|
||||
// First element as an UInt32
|
||||
let unicode = unicodeScalers[unicodeScalers.startIndex].value
|
||||
newWaypoint.icon = unicode
|
||||
if locked {
|
||||
|
||||
if lockedTo == 0 {
|
||||
newWaypoint.lockedTo = UInt32(bleManager.connectedPeripheral!.num)
|
||||
} else {
|
||||
newWaypoint.lockedTo = UInt32(lockedTo)
|
||||
}
|
||||
}
|
||||
newWaypoint.expire = 1
|
||||
if bleManager.sendWaypoint(waypoint: newWaypoint) {
|
||||
waypointId = 0
|
||||
dismiss()
|
||||
} else {
|
||||
waypointId = 0
|
||||
dismiss()
|
||||
print("Send waypoint failed")
|
||||
}
|
||||
})
|
||||
}
|
||||
label: {
|
||||
Label("delete", systemImage: "trash")
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
|
|
@ -234,11 +273,11 @@ struct WaypointFormView: View {
|
|||
longitude = coordinate.longitude
|
||||
}
|
||||
|
||||
if coordinate.distance(from: LocationHelper.DefaultLocation) == 0.0 {
|
||||
// Too close to apple park, bail out
|
||||
waypointId = 0
|
||||
dismiss()
|
||||
}
|
||||
// if coordinate.distance(from: LocationHelper.DefaultLocation) == 0.0 {
|
||||
// // Too close to apple park, bail out
|
||||
// waypointId = 0
|
||||
// dismiss()
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ struct ShareChannels: View {
|
|||
loRaConfig.usePreset = node?.loRaConfig?.usePreset ?? true
|
||||
loRaConfig.channelNum = UInt32(node?.loRaConfig?.channelNum ?? 0)
|
||||
channelSet.loraConfig = loRaConfig
|
||||
if node != nil {
|
||||
if node != nil && node?.myInfo != nil {
|
||||
for ch in node!.myInfo!.channels!.array as! [ChannelEntity] {
|
||||
if ch.role > 0 {
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@
|
|||
"mesh.log.device.config %@"="Geräte Konfiguration empfangen: %@";
|
||||
"mesh.log.display.config %@"="Display Konfiguration empfangen: %@";
|
||||
"mesh.log.devicemetadata %@"="Anforderung der Geräte Metadaten für %@";
|
||||
"mesh.log.device.metadata.received %@"="Device Metadata received from: %@";
|
||||
"mesh.log.externalnotification.config %@"="External Notifiation module config received: %@";
|
||||
"mesh.log.lora.config %@"="LoRa config received: %@";
|
||||
"mesh.log.lora.config.sent %@"="Sent a LoRa.Config for: %@";
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@
|
|||
"mesh.log.device.config %@"="Device config received: %@";
|
||||
"mesh.log.display.config %@"="Display config received: %@";
|
||||
"mesh.log.devicemetadata %@"="Requesting Device Metadata for %@";
|
||||
"mesh.log.device.metadata.received %@"="Device Metadata received from: %@";
|
||||
"mesh.log.externalnotification.config %@"="External Notifiation module config received: %@";
|
||||
"mesh.log.lora.config %@"="LoRa config received: %@";
|
||||
"mesh.log.lora.config.sent %@"="Sent a LoRa.Config for: %@";
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@
|
|||
"mesh.log.device.config %@"="Device config received: %@";
|
||||
"mesh.log.display.config %@"="Display config received: %@";
|
||||
"mesh.log.devicemetadata %@"="Requesting Device Metadata for %@";
|
||||
"mesh.log.device.metadata.received %@"="Device Metadata admin message received from: %@";
|
||||
"mesh.log.externalnotification.config %@"="External Notifiation module config received: %@";
|
||||
"mesh.log.lora.config %@"="LoRa config received: %@";
|
||||
"mesh.log.lora.config.sent %@"="Sent a LoRa.Config for: %@";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue