mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Hook up updates to all node list details views
This commit is contained in:
parent
2d339037ae
commit
dad6654374
8 changed files with 88 additions and 91 deletions
|
|
@ -467,11 +467,11 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DDDB26402AABEF7B003AFCB7 /* Helpers */,
|
||||
DD769E0228D18BF0001A3F05 /* DeviceMetricsLog.swift */,
|
||||
DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */,
|
||||
DD2E65252767A01F00E45FC5 /* NodeDetail.swift */,
|
||||
DD47E3CD26F103C600029299 /* NodeList.swift */,
|
||||
DD90860D26F69BAE00DC5189 /* NodeMap.swift */,
|
||||
DD769E0228D18BF0001A3F05 /* DeviceMetricsLog.swift */,
|
||||
DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */,
|
||||
DD73FD1028750779000852D6 /* PositionLog.swift */,
|
||||
6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */,
|
||||
DDDB263E2AABEE20003AFCB7 /* NodeListSplit.swift */,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct DetectionSensorLog: View {
|
|||
@State private var isPresentingClearLogConfirm: Bool = false
|
||||
@State var isExporting = false
|
||||
@State var exportString = ""
|
||||
var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
let oneDayAgo = Calendar.current.date(byAdding: .day, value: -1, to: Date())
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct DeviceMetricsLog: View {
|
|||
@State private var batteryChartColor: Color = .blue
|
||||
@State private var airtimeChartColor: Color = .orange
|
||||
@State private var channelUtilizationChartColor: Color = .green
|
||||
var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ struct EnvironmentMetricsLog: View {
|
|||
@State var isExporting = false
|
||||
@State var exportString = ""
|
||||
|
||||
var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
let oneWeekAgo = Calendar.current.date(byAdding: .day, value: -7, to: Date())
|
||||
|
|
|
|||
|
|
@ -13,15 +13,10 @@ struct NodeDetailItem: View {
|
|||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@Environment(\.colorScheme) var colorScheme: ColorScheme
|
||||
@State private var showingForecast = false
|
||||
@State private var showingShutdownConfirm: Bool = false
|
||||
@State private var showingRebootConfirm: Bool = false
|
||||
@State private var customMapOverlay: MapViewSwiftUI.CustomMapOverlay? = MapViewSwiftUI.CustomMapOverlay(
|
||||
mapName: "offlinemap",
|
||||
tileType: "png",
|
||||
canReplaceMapContent: true
|
||||
)
|
||||
var node: NodeInfoEntity
|
||||
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -31,6 +26,69 @@ struct NodeDetailItem: View {
|
|||
VStack {
|
||||
ScrollView {
|
||||
NodeInfoItem(node: node)
|
||||
VStack {
|
||||
NavigationLink {
|
||||
DeviceMetricsLog(node: node)
|
||||
} label: {
|
||||
Image(systemName: "flipphone")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Device Metrics Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.disabled(!node.hasDeviceMetrics)
|
||||
Divider()
|
||||
NavigationLink {
|
||||
EnvironmentMetricsLog(node: node)
|
||||
} label: {
|
||||
Image(systemName: "chart.xyaxis.line")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Environment Metrics Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.disabled(!node.hasEnvironmentMetrics)
|
||||
Divider()
|
||||
NavigationLink {
|
||||
NodeMapControl(node: node)
|
||||
} label: {
|
||||
Image(systemName: "map")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Node Map")
|
||||
.font(.title3)
|
||||
}
|
||||
.disabled(!node.hasPositions)
|
||||
Divider()
|
||||
NavigationLink {
|
||||
PositionLog(node: node)
|
||||
} label: {
|
||||
Image(systemName: "building.columns")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Position Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.disabled(!node.hasPositions)
|
||||
Divider()
|
||||
NavigationLink {
|
||||
DetectionSensorLog(node: node)
|
||||
} label: {
|
||||
Image(systemName: "sensor")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Detection Sensor Log")
|
||||
.font(.title3)
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
|
||||
|
||||
if self.bleManager.connectedPeripheral != nil && node.metadata != nil {
|
||||
HStack {
|
||||
if node.metadata?.canShutdown ?? false {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,11 @@ import MapKit
|
|||
|
||||
struct NodeInfoItem: View {
|
||||
|
||||
var node: NodeInfoEntity
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
|
||||
Divider()
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
HStack {
|
||||
|
||||
|
|
@ -70,7 +65,7 @@ struct NodeInfoItem: View {
|
|||
}
|
||||
}
|
||||
Divider()
|
||||
VStack(alignment: .center) {
|
||||
HStack(alignment: .center) {
|
||||
VStack {
|
||||
HStack {
|
||||
Image(systemName: "number")
|
||||
|
|
@ -92,75 +87,7 @@ struct NodeInfoItem: View {
|
|||
}
|
||||
Text(node.user?.userId ?? "?").font(.title3).foregroundColor(.gray)
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
|
||||
VStack {
|
||||
// List {
|
||||
|
||||
if node.hasDeviceMetrics {
|
||||
|
||||
NavigationLink {
|
||||
DeviceMetricsLog(node: node)
|
||||
} label: {
|
||||
|
||||
Image(systemName: "flipphone")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Device Metrics Log")
|
||||
.font(.title3)
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
if node.hasEnvironmentMetrics {
|
||||
NavigationLink {
|
||||
EnvironmentMetricsLog(node: node)
|
||||
} label: {
|
||||
|
||||
Image(systemName: "chart.xyaxis.line")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Environment Metrics Log")
|
||||
.font(.title3)
|
||||
}
|
||||
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: {
|
||||
|
||||
Image(systemName: "sensor")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
|
||||
Text("Detection Sensor Log")
|
||||
.font(.title3)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Divider()
|
||||
// }
|
||||
// .listStyle(.plain)
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,15 @@
|
|||
//
|
||||
// Created by Garth Vander Houwen on 9/9/23.
|
||||
//
|
||||
import SwiftUI
|
||||
import CoreLocation
|
||||
import MapKit
|
||||
|
||||
import Foundation
|
||||
struct NodeMapControl: View {
|
||||
|
||||
@ObservedObject var node: NodeInfoEntity
|
||||
|
||||
var body: some View {
|
||||
Text("I am a map")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ enum SelectedDetail {
|
|||
|
||||
struct NodeListSplit: View {
|
||||
|
||||
// Layout variables
|
||||
@State private var columnVisibility = NavigationSplitViewVisibility.all
|
||||
@State private var selectedNode: NodeInfoEntity?
|
||||
@State private var selectedDetail: SelectedDetail?
|
||||
|
|
@ -71,9 +70,12 @@ struct NodeListSplit: View {
|
|||
}
|
||||
|
||||
} detail: {
|
||||
Text("Content")
|
||||
Text("Select something to view")
|
||||
}
|
||||
.navigationSplitViewStyle(.balanced)
|
||||
.onChange(of: selectedNode) { _ in
|
||||
selectedDetail = nil
|
||||
}
|
||||
.onAppear {
|
||||
if self.bleManager.context == nil {
|
||||
self.bleManager.context = context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue