Clean up node list and details views

This commit is contained in:
Garth Vander Houwen 2022-09-13 09:56:03 -07:00
parent f5463e3633
commit 9a17b65abe
3 changed files with 26 additions and 24 deletions

View file

@ -114,7 +114,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
if centralManager.isScanning {
self.centralManager.stopScan()
// self.isScanning = self.centralManager.isScanning
isScanning = self.centralManager.isScanning
print("🛑 Stopped Scanning")
}
}
@ -170,7 +170,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
self.disconnectPeripheral()
}
//self.connectedVersion = "0.0.0"
self.connectedVersion = "0.0.0"
self.centralManager?.connect(peripheral)
// Invalidate any existing timer
@ -223,7 +223,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
}
let today = Date()
let visibleDuration = Calendar.current.date(byAdding: .second, value: -4, to: today)!
let visibleDuration = Calendar.current.date(byAdding: .second, value: -2, to: today)!
peripherals.removeAll(where: { $0.lastUpdate <= visibleDuration})
}

View file

@ -18,8 +18,8 @@ struct LocationHistory: View {
var body: some View {
VStack {
NavigationStack {
List {
ForEach(node.positions!.reversed() as! [PositionEntity], id: \.self) { (mappin: PositionEntity) in

View file

@ -63,8 +63,8 @@ struct NodeDetail: View {
}
)
}
.ignoresSafeArea(.all, edges: [.leading, .trailing])
.frame(idealWidth: bounds.size.width, minHeight: bounds.size.height / 2)
.ignoresSafeArea(.all, edges: [.leading, .trailing])
.frame(idealWidth: bounds.size.width, minHeight: bounds.size.height / 1.70)
}
}
Text("Sats: \(mostRecent.satsInView)").offset( y:-40)
@ -440,28 +440,30 @@ struct NodeDetail: View {
}
}
.offset( y:-40)
.padding(.bottom, -40)
}
.edgesIgnoringSafeArea([.leading, .trailing])
}
}
.navigationTitle((node.user != nil) ? String(node.user!.longName ?? "Unknown") : "Unknown")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing:
.navigationTitle((node.user != nil) ? String(node.user!.longName ?? "Unknown") : "Unknown")
.navigationBarTitleDisplayMode(.inline)
.padding(.bottom, 10)
.navigationBarItems(trailing:
ZStack {
ZStack {
ConnectedDevice(
bluetoothOn: bleManager.isSwitchedOn,
deviceConnected: bleManager.connectedPeripheral != nil,
name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "????")
}
)
.onAppear {
ConnectedDevice(
bluetoothOn: bleManager.isSwitchedOn,
deviceConnected: bleManager.connectedPeripheral != nil,
name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "????")
}
)
.onAppear {
if self.initialLoad{
self.bleManager.context = context
self.initialLoad = false
if self.initialLoad{
self.bleManager.context = context
self.initialLoad = false
}
}
}
}
}