This commit is contained in:
Garth Vander Houwen 2023-09-10 18:50:11 -07:00
parent b613d0427e
commit a2a4c65c30
7 changed files with 14 additions and 146 deletions

View file

@ -37,7 +37,6 @@
DD41582A28585C32009B0E59 /* RangeTestConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582928585C32009B0E59 /* RangeTestConfig.swift */; };
DD41A61529AB0035003C5A37 /* NodeWeatherForecast.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41A61429AB0035003C5A37 /* NodeWeatherForecast.swift */; };
DD457188293C7E63000C49FB /* BLESignalStrengthIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD457187293C7E63000C49FB /* BLESignalStrengthIndicator.swift */; };
DD47E3CE26F103C600029299 /* NodeListOld.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeListOld.swift */; };
DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; };
DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911D2708C65400501B7E /* AppSettings.swift */; };
DD4F23CD28779A3C001D37CB /* EnvironmentMetricsLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */; };
@ -241,7 +240,6 @@
DD41A61E29AE7E8F003C5A37 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
DD457187293C7E63000C49FB /* BLESignalStrengthIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLESignalStrengthIndicator.swift; sourceTree = "<group>"; };
DD457BC4295D5E35004BCE4D /* MeshtasticDataModelV5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV5.xcdatamodel; sourceTree = "<group>"; };
DD47E3CD26F103C600029299 /* NodeListOld.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeListOld.swift; sourceTree = "<group>"; };
DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = "<group>"; };
DD4A911D2708C65400501B7E /* AppSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettings.swift; sourceTree = "<group>"; };
DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentMetricsLog.swift; sourceTree = "<group>"; };
@ -473,7 +471,6 @@
DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */,
6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */,
DD2E65252767A01F00E45FC5 /* NodeDetailOld.swift */,
DD47E3CD26F103C600029299 /* NodeListOld.swift */,
);
path = Nodes;
sourceTree = "<group>";
@ -1125,7 +1122,6 @@
DD5E520D298EE33B00D21B61 /* storeforward.pb.swift in Sources */,
DD964FC2297272AE007C176F /* WaypointEntityExtension.swift in Sources */,
6DA39D8E2A92DC52007E311C /* MeshtasticAppDelegate.swift in Sources */,
DD47E3CE26F103C600029299 /* NodeListOld.swift in Sources */,
DD5E520A298EE33B00D21B61 /* channel.pb.swift in Sources */,
DD8EBF43285058FA00426DCA /* DisplayConfig.swift in Sources */,
DD964FC42974767D007C176F /* MapViewFitExtension.swift in Sources */,

View file

@ -124,7 +124,9 @@ struct DetectionSensorLog: View {
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?")
})
.onAppear {
self.bleManager.context = context
if self.bleManager.context == nil {
self.bleManager.context = context
}
}
.fileExporter(
isPresented: $isExporting,

View file

@ -211,7 +211,9 @@ struct DeviceMetricsLog: View {
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?")
})
.onAppear {
self.bleManager.context = context
if self.bleManager.context == nil {
self.bleManager.context = context
}
}
.fileExporter(
isPresented: $isExporting,

View file

@ -193,7 +193,9 @@ struct EnvironmentMetricsLog: View {
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?")
})
.onAppear {
self.bleManager.context = context
if self.bleManager.context == nil {
self.bleManager.context = context
}
}
.fileExporter(
isPresented: $isExporting,

View file

@ -22,7 +22,7 @@ struct NodeDetail: View {
var body: some View {
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
// NavigationStack {
NavigationStack {
GeometryReader { bounds in
VStack {
ScrollView {
@ -147,6 +147,6 @@ struct NodeDetail: View {
}
}
.padding(.bottom, 2)
// }
}
}
}

View file

@ -1,136 +0,0 @@
////
//// NodeList.swift
//// Meshtastic
////
//// Copyright(c) Garth Vander Houwen 8/7/21.
////
//
//// Abstract:
//// A view showing a list of devices that have been seen on the mesh network from the perspective of the connected device.
//
//import SwiftUI
//import CoreLocation
//
//struct NodeList: View {
//
// @State private var searchText = ""
// var nodesQuery: Binding<String> {
// Binding {
// searchText
// } set: { newValue in
// searchText = newValue
// nodes.nsPredicate = newValue.isEmpty ? nil : NSPredicate(format: "user.longName CONTAINS[c] %@ OR user.shortName CONTAINS[c] %@", newValue, newValue)
// }
// }
//
// @Environment(\.managedObjectContext) var context
// @EnvironmentObject var bleManager: BLEManager
//
// @FetchRequest(
// sortDescriptors: [NSSortDescriptor(key: "lastHeard", ascending: false)],
// animation: .default)
//
// private var nodes: FetchedResults<NodeInfoEntity>
//
// @State private var selection: NodeInfoEntity? // Nothing selected by default.
//
// var body: some View {
//
// NavigationSplitView {
// let connectedNodeNum = Int(bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral?.num ?? 0 : 0)
// let connectedNode = nodes.first(where: { $0.num == connectedNodeNum })
// List(nodes, id: \.self, selection: $selection) { node in
// if nodes.count == 0 {
// Text("no.nodes").font(.title)
// } else {
// NavigationLink(value: node) {
// let connected: Bool = (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral?.num ?? -1 == node.num)
// LazyVStack(alignment: .leading) {
// HStack {
// VStack(alignment: .leading) {
// CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65)
// .padding(.trailing, 5)
// let deviceMetrics = node.telemetries?.filtered(using: NSPredicate(format: "metricsType == 0"))
// if deviceMetrics?.count ?? 0 >= 1 {
// let mostRecent = deviceMetrics?.lastObject as? TelemetryEntity
// BatteryLevelCompact(batteryLevel: mostRecent?.batteryLevel, font: .caption2, iconFont: .callout, color: .accentColor)
// }
// }
// VStack(alignment: .leading) {
// Text(node.user?.longName ?? "unknown".localized)
// .fontWeight(.medium)
// .font(.callout)
// if connected {
// HStack(alignment: .bottom) {
// Image(systemName: "antenna.radiowaves.left.and.right.circle.fill")
// .font(.footnote)
// .symbolRenderingMode(.hierarchical)
// .foregroundColor(.green)
// Text("connected").font(.caption)
// }
// }
// HStack(alignment: .bottom) {
// Image(systemName: node.isOnline ? "checkmark.circle.fill" : "moon.circle.fill")
// .font(.footnote)
// .symbolRenderingMode(.hierarchical)
// .foregroundColor(node.isOnline ? .green : .orange)
// LastHeardText(lastHeard: node.lastHeard)
// .font(.caption)
// }
// if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral?.num ?? -1 != node.num) {
// HStack(alignment: .bottom) {
// let lastPostion = node.positions!.reversed()[0] as! PositionEntity
// let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
// if lastPostion.nodeCoordinate != nil && myCoord.coordinate.longitude != LocationHelper.DefaultLocation.longitude && myCoord.coordinate.latitude != LocationHelper.DefaultLocation.latitude {
// let nodeCoord = CLLocation(latitude: lastPostion.nodeCoordinate!.latitude, longitude: lastPostion.nodeCoordinate!.longitude)
// let metersAway = nodeCoord.distance(from: myCoord)
// Image(systemName: "lines.measurement.horizontal")
// .font(.footnote)
// .symbolRenderingMode(.hierarchical)
// DistanceText(meters: metersAway).font(.caption)
// }
// }
// }
// if node.channel > 0 {
// HStack(alignment: .bottom) {
// Image(systemName: "fibrechannel")
// .font(.footnote)
// .symbolRenderingMode(.hierarchical)
// Text("Channel: \(node.channel)")
// .font(.footnote)
// }
// }
// if !connected {
// HStack(alignment: .bottom) { let preset = ModemPresets(rawValue: Int(connectedNode?.loRaConfig?.modemPreset ?? 0))
// LoRaSignalStrengthMeter(snr: node.snr, rssi: node.rssi, preset: preset ?? ModemPresets.longFast, compact: true)
// }
// }
// }
// .frame(maxWidth: .infinity, alignment: .leading)
// }
// }
// }
// .padding([.top, .bottom])
// }
// }
// .listStyle(.plain)
// .navigationSplitViewColumnWidth(300)
// .navigationTitle(String.localizedStringWithFormat("nodes %@".localized, String(nodes.count)))
// .navigationBarItems(leading:
// MeshtasticLogo()
// )
// .onAppear {
// if self.bleManager.context == nil {
// self.bleManager.context = context
// }
// }
// } detail: {
// if let node = selection {
// NodeDetail(node: node)
// } else {
// Text("select.node")
// }
// }
// .searchable(text: nodesQuery, prompt: "Find a node")
// }
//}

View file

@ -238,7 +238,9 @@ struct NodeMap: View {
})
.onAppear(perform: {
UIApplication.shared.isIdleTimerDisabled = true
self.bleManager.context = context
if self.bleManager.context == nil {
self.bleManager.context = context
}
})
.onDisappear(perform: {
UIApplication.shared.isIdleTimerDisabled = false