mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Fully update position log in 3 column mode
This commit is contained in:
parent
d9a424388a
commit
2d339037ae
8 changed files with 77 additions and 68 deletions
|
|
@ -138,6 +138,7 @@
|
|||
DDDB26422AABF655003AFCB7 /* NodeListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26412AABF655003AFCB7 /* NodeListItem.swift */; };
|
||||
DDDB26442AAC0206003AFCB7 /* NodeDetailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26432AAC0206003AFCB7 /* NodeDetailItem.swift */; };
|
||||
DDDB26462AACC0B7003AFCB7 /* NodeInfoItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26452AACC0B7003AFCB7 /* NodeInfoItem.swift */; };
|
||||
DDDB26482AACD6D1003AFCB7 /* NodeMapControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26472AACD6D1003AFCB7 /* NodeMapControl.swift */; };
|
||||
DDDB443629F6287000EE2349 /* MapButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443529F6287000EE2349 /* MapButtons.swift */; };
|
||||
DDDB443D29F6592F00EE2349 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443C29F6592F00EE2349 /* NetworkManager.swift */; };
|
||||
DDDB444029F79AB000EE2349 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443F29F79AB000EE2349 /* UserDefaults.swift */; };
|
||||
|
|
@ -357,6 +358,7 @@
|
|||
DDDB26412AABF655003AFCB7 /* NodeListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeListItem.swift; sourceTree = "<group>"; };
|
||||
DDDB26432AAC0206003AFCB7 /* NodeDetailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetailItem.swift; sourceTree = "<group>"; };
|
||||
DDDB26452AACC0B7003AFCB7 /* NodeInfoItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeInfoItem.swift; sourceTree = "<group>"; };
|
||||
DDDB26472AACD6D1003AFCB7 /* NodeMapControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeMapControl.swift; sourceTree = "<group>"; };
|
||||
DDDB443529F6287000EE2349 /* MapButtons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapButtons.swift; sourceTree = "<group>"; };
|
||||
DDDB443C29F6592F00EE2349 /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
|
||||
DDDB443F29F79AB000EE2349 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -811,6 +813,7 @@
|
|||
DDDB26432AAC0206003AFCB7 /* NodeDetailItem.swift */,
|
||||
DDDB26452AACC0B7003AFCB7 /* NodeInfoItem.swift */,
|
||||
DDDB26412AABF655003AFCB7 /* NodeListItem.swift */,
|
||||
DDDB26472AACD6D1003AFCB7 /* NodeMapControl.swift */,
|
||||
);
|
||||
path = Helpers;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1101,6 +1104,7 @@
|
|||
DDDB263F2AABEE20003AFCB7 /* NodeListSplit.swift in Sources */,
|
||||
DDA0B6B2294CDC55001356EC /* Channels.swift in Sources */,
|
||||
DDB8F4102A9EE5B400230ECE /* Messages.swift in Sources */,
|
||||
DDDB26482AACD6D1003AFCB7 /* NodeMapControl.swift in Sources */,
|
||||
DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */,
|
||||
DD5E5209298EE33B00D21B61 /* module_config.pb.swift in Sources */,
|
||||
DD2160AF28C5552500C17253 /* MQTTConfig.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -13,14 +13,6 @@ struct NodeDetailItem: View {
|
|||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@Environment(\.colorScheme) var colorScheme: ColorScheme
|
||||
@AppStorage("meshMapType") private var meshMapType = 0
|
||||
@AppStorage("meshMapShowNodeHistory") private var meshMapShowNodeHistory = false
|
||||
@AppStorage("meshMapShowRouteLines") private var meshMapShowRouteLines = false
|
||||
@State private var selectedMapLayer: MapLayer = .standard
|
||||
@State var waypointCoordinate: WaypointCoordinate?
|
||||
@State var editingWaypoint: Int = 0
|
||||
@State private var loadedWeather: Bool = false
|
||||
@State private var showingDetailsPopover = false
|
||||
@State private var showingForecast = false
|
||||
@State private var showingShutdownConfirm: Bool = false
|
||||
@State private var showingRebootConfirm: Bool = false
|
||||
|
|
@ -29,21 +21,7 @@ struct NodeDetailItem: View {
|
|||
tileType: "png",
|
||||
canReplaceMapContent: true
|
||||
)
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
@FetchRequest(sortDescriptors: [NSSortDescriptor(key: "name", ascending: false)],
|
||||
predicate: NSPredicate(
|
||||
format: "expire == nil || expire >= %@", Date() as NSDate
|
||||
), animation: .none)
|
||||
private var waypoints: FetchedResults<WaypointEntity>
|
||||
|
||||
/// The current weather condition for the city.
|
||||
@State private var condition: WeatherCondition?
|
||||
@State private var temperature: Measurement<UnitTemperature>?
|
||||
@State private var humidity: Int?
|
||||
@State private var symbolName: String = "cloud.fill"
|
||||
|
||||
@State private var attributionLink: URL?
|
||||
@State private var attributionLogo: URL?
|
||||
var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -102,12 +80,12 @@ struct NodeDetailItem: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if self.bleManager.context == nil {
|
||||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
.edgesIgnoringSafeArea([.leading, .trailing])
|
||||
.sheet(item: $waypointCoordinate, content: { wpc in
|
||||
WaypointFormView(coordinate: wpc)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.automatic)
|
||||
})
|
||||
.navigationBarTitle(String(node.user?.longName ?? "unknown".localized), displayMode: .inline)
|
||||
.navigationBarItems(trailing:
|
||||
ZStack {
|
||||
|
|
|
|||
|
|
@ -12,14 +12,6 @@ import MapKit
|
|||
struct NodeInfoItem: View {
|
||||
|
||||
var node: NodeInfoEntity
|
||||
|
||||
enum SelectedDetail {
|
||||
case positionLog
|
||||
case nodeMap
|
||||
case deviceMetricsLog
|
||||
case environmentMetricsLog
|
||||
case detectionSensorLog
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -105,26 +97,7 @@ struct NodeInfoItem: View {
|
|||
|
||||
VStack {
|
||||
// List {
|
||||
if node.hasPositions {
|
||||
|
||||
NavigationLink {
|
||||
PositionLog(node: node)
|
||||
.onAppear {
|
||||
|
||||
}
|
||||
} label: {
|
||||
|
||||
Image(systemName: "building.columns")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Position Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Divider()
|
||||
}
|
||||
|
||||
if node.hasDeviceMetrics {
|
||||
|
||||
NavigationLink {
|
||||
|
|
@ -154,6 +127,25 @@ struct NodeInfoItem: View {
|
|||
}
|
||||
Divider()
|
||||
}
|
||||
if node.hasPositions {
|
||||
|
||||
NavigationLink {
|
||||
PositionLog(node: node)
|
||||
.onAppear {
|
||||
|
||||
}
|
||||
} label: {
|
||||
|
||||
Image(systemName: "building.columns")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Position Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Divider()
|
||||
}
|
||||
NavigationLink {
|
||||
DetectionSensorLog(node: node)
|
||||
} label: {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import CoreLocation
|
|||
|
||||
struct NodeListItem: View {
|
||||
|
||||
public var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
var connected: Bool
|
||||
var connectedNode: Int64
|
||||
var modemPreset: Int
|
||||
|
|
|
|||
8
Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift
Normal file
8
Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// NodeMapControl.swift
|
||||
// Meshtastic
|
||||
//
|
||||
// Created by Garth Vander Houwen on 9/9/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
|
@ -13,9 +13,6 @@ import CoreLocation
|
|||
|
||||
struct NodeList: View {
|
||||
|
||||
init () {
|
||||
//self.bleManager.context = context
|
||||
}
|
||||
@State private var searchText = ""
|
||||
var nodesQuery: Binding<String> {
|
||||
Binding {
|
||||
|
|
@ -123,7 +120,9 @@ struct NodeList: View {
|
|||
MeshtasticLogo()
|
||||
)
|
||||
.onAppear {
|
||||
// self.bleManager.context = context
|
||||
if self.bleManager.context == nil {
|
||||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
} detail: {
|
||||
if let node = selection {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,22 @@
|
|||
import SwiftUI
|
||||
import CoreLocation
|
||||
|
||||
enum SelectedDetail {
|
||||
case positionLog
|
||||
case nodeMap
|
||||
case deviceMetricsLog
|
||||
case environmentMetricsLog
|
||||
case detectionSensorLog
|
||||
}
|
||||
|
||||
struct NodeListSplit: View {
|
||||
|
||||
// Layout variables
|
||||
@State private var columnVisibility = NavigationSplitViewVisibility.all
|
||||
@State private var selectedNode: NodeInfoEntity?
|
||||
@State private var selectedDetail: SelectedDetail?
|
||||
|
||||
@SceneStorage("selectedDetailView") var selectedDetailView: String?
|
||||
|
||||
@State private var searchText = ""
|
||||
var nodesQuery: Binding<String> {
|
||||
|
|
@ -30,14 +43,14 @@ struct NodeListSplit: View {
|
|||
|
||||
private var nodes: FetchedResults<NodeInfoEntity>
|
||||
|
||||
@State private var selection: NodeInfoEntity? // Nothing selected by default.
|
||||
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView(columnVisibility: $columnVisibility) {
|
||||
|
||||
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
|
||||
List(nodes, id: \.self, selection: $selectedNode) { node in
|
||||
|
||||
NodeListItem(node: node, connected: bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral?.num ?? -1 == node.num, connectedNode: (bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral?.num ?? -1 : -1), modemPreset: Int(connectedNode?.loRaConfig?.modemPreset ?? 0))
|
||||
}
|
||||
|
|
@ -50,7 +63,7 @@ struct NodeListSplit: View {
|
|||
)
|
||||
} content: {
|
||||
|
||||
if let node = selection {
|
||||
if let node = selectedNode {
|
||||
NodeDetailItem(node: node)
|
||||
|
||||
} else {
|
||||
|
|
@ -61,6 +74,11 @@ struct NodeListSplit: View {
|
|||
Text("Content")
|
||||
}
|
||||
.navigationSplitViewStyle(.balanced)
|
||||
.onAppear {
|
||||
if self.bleManager.context == nil {
|
||||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
|
||||
// } detail: {
|
||||
// VStack {
|
||||
|
|
|
|||
|
|
@ -17,12 +17,19 @@ struct PositionLog: View {
|
|||
}
|
||||
@State var isExporting = false
|
||||
@State var exportString = ""
|
||||
var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
@State private var isPresentingClearLogConfirm = false
|
||||
@State private var sortOrder = [KeyPathComparator(\PositionEntity.time)]
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
|
||||
|
||||
if node.hasPositions {
|
||||
|
||||
} else {
|
||||
Text("Node has no positions.")
|
||||
}
|
||||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
if UIDevice.current.userInterfaceIdiom == .pad && !useGrid || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
|
@ -159,12 +166,15 @@ struct PositionLog: View {
|
|||
)
|
||||
}
|
||||
.navigationTitle("Position Log \(node.positions?.count ?? 0) Points")
|
||||
.navigationBarItems(trailing:
|
||||
ZStack {
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?")
|
||||
.navigationBarItems(
|
||||
trailing:
|
||||
ZStack {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue