mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Show firmware view again
This commit is contained in:
parent
7302dc3e35
commit
8f9c2e44f1
6 changed files with 36 additions and 26 deletions
|
|
@ -532,7 +532,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
tryClearExistingChannels()
|
||||
}
|
||||
// NodeInfo
|
||||
if decodedInfo.nodeInfo.num > 0 && !invalidVersion {
|
||||
if decodedInfo.nodeInfo.num > 0 {// && !invalidVersion {
|
||||
nowKnown = true
|
||||
let nodeInfo = nodeInfoPacket(nodeInfo: decodedInfo.nodeInfo, channel: decodedInfo.packet.channel, context: context!)
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import CoreLocation
|
|||
if !self.updatesStarted { break } // End location updates by breaking out of the loop.
|
||||
if let loc = update.location {
|
||||
self.isStationary = update.isStationary
|
||||
self.count += 1
|
||||
|
||||
var locationAdded: Bool
|
||||
if enableSmartPosition {
|
||||
locationAdded = addLocation(loc)
|
||||
|
|
@ -67,8 +67,8 @@ import CoreLocation
|
|||
locationsArray.append(loc)
|
||||
locationAdded = true
|
||||
}
|
||||
if !locationAdded {
|
||||
//print("Bad Location \(self.count): \(loc)")
|
||||
if locationAdded {
|
||||
self.count += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,6 @@ func deviceMetadataPacket (metadata: DeviceMetadata, fromNum: Int64, context: NS
|
|||
}
|
||||
if fetchedNode.count > 0 {
|
||||
let newMetadata = DeviceMetadataEntity(context: context)
|
||||
newMetadata.firmwareVersion = metadata.firmwareVersion
|
||||
newMetadata.deviceStateVersion = Int32(metadata.deviceStateVersion)
|
||||
newMetadata.canShutdown = metadata.canShutdown
|
||||
newMetadata.hasWifi = metadata.hasWifi_p
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ struct RouteRecorder: View {
|
|||
@Namespace var namespace
|
||||
@Namespace var routerecorderscope
|
||||
@State var recording: RouteEntity?
|
||||
@State var color: Color = .blue
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
|
|
@ -33,8 +34,9 @@ struct RouteRecorder: View {
|
|||
let lineCoords = locationsHandler.locationsArray.compactMap({(position) -> CLLocationCoordinate2D in
|
||||
return position.coordinate
|
||||
})
|
||||
|
||||
let gradient = LinearGradient(
|
||||
colors: [.blue],
|
||||
colors: [color],
|
||||
startPoint: .leading, endPoint: .trailing
|
||||
)
|
||||
let dashed = StrokeStyle(
|
||||
|
|
@ -49,13 +51,6 @@ struct RouteRecorder: View {
|
|||
}
|
||||
.ignoresSafeArea(.all, edges: [.top, .leading, .trailing])
|
||||
.mapScope(routerecorderscope)
|
||||
// .mapControls {
|
||||
// MapScaleView(scope: routerecorderscope)
|
||||
// MapUserLocationButton(scope: routerecorderscope)
|
||||
// MapPitchToggle(scope: routerecorderscope)
|
||||
// MapCompass(scope: routerecorderscope)
|
||||
// }
|
||||
.transition(.slide)
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
ZStack {
|
||||
VStack {
|
||||
|
|
@ -164,11 +159,12 @@ struct RouteRecorder: View {
|
|||
locationsHandler.locationsArray.removeAll()
|
||||
locationsHandler.recordingStarted = Date()
|
||||
let newRoute = RouteEntity(context: context)
|
||||
newRoute.name = String("Route Recording - \(Date().formatted())")
|
||||
newRoute.name = String("Route Recording")
|
||||
newRoute.id = Int32.random(in: Int32(Int8.max) ... Int32.max)
|
||||
newRoute.color = Int64(UIColor.random.hex)
|
||||
newRoute.date = Date()
|
||||
newRoute.enabled = true
|
||||
newRoute.enabled = false
|
||||
color = Color(UIColor(hex: UInt32(newRoute.color)))
|
||||
self.recording = newRoute
|
||||
do {
|
||||
try context.save()
|
||||
|
|
@ -221,6 +217,19 @@ struct RouteRecorder: View {
|
|||
locationsHandler.elevationGain = 0.0
|
||||
locationsHandler.locationsArray.removeAll()
|
||||
locationsHandler.recordingStarted = nil
|
||||
if let rec = recording {
|
||||
rec.enabled = true
|
||||
context.refresh(rec, mergeChanges:true)
|
||||
}
|
||||
|
||||
do {
|
||||
try context.save()
|
||||
print("💾 Saved a route finish")
|
||||
} catch {
|
||||
context.rollback()
|
||||
let nsError = error as NSError
|
||||
print("💥 Error Saving RouteEntity from the Route Recorder \(nsError)")
|
||||
}
|
||||
} label: {
|
||||
Label("finish", systemImage: "flag.checkered")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ struct Routes: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.badge(route.locations?.count ?? 0)
|
||||
.swipeActions {
|
||||
Button(role: .destructive) {
|
||||
context.delete(route)
|
||||
|
|
@ -147,6 +148,7 @@ struct Routes: View {
|
|||
Label("delete", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.listStyle(.plain)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,17 +299,17 @@ struct Settings: View {
|
|||
}
|
||||
.tag(SettingsSidebar.adminMessageLog)
|
||||
}
|
||||
// Section(header: Text("Firmware")) {
|
||||
// NavigationLink {
|
||||
// Firmware(node: nodes.first(where: { $0.num == preferredNodeNum }))
|
||||
// } label: {
|
||||
// Image(systemName: "arrow.up.arrow.down.square")
|
||||
// .symbolRenderingMode(.hierarchical)
|
||||
// Text("Firmware Updates")
|
||||
// }
|
||||
// .tag(SettingsSidebar.about)
|
||||
// .disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
// }
|
||||
Section(header: Text("Firmware")) {
|
||||
NavigationLink {
|
||||
Firmware(node: nodes.first(where: { $0.num == preferredNodeNum }))
|
||||
} label: {
|
||||
Image(systemName: "arrow.up.arrow.down.square")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
Text("Firmware Updates")
|
||||
}
|
||||
.tag(SettingsSidebar.about)
|
||||
.disabled(selectedNode > 0 && selectedNode != preferredNodeNum)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue