Remove extraneous vstack to fix swipe to disconnect and swipe to delete node

This commit is contained in:
Garth Vander Houwen 2021-10-07 21:36:42 -07:00
parent c023856d47
commit 669fb6de6b
4 changed files with 43 additions and 19 deletions

View file

@ -77,6 +77,9 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
if connectedPeripheral != nil && connectedPeripheral.peripheral.state == CBPeripheralState.connected {
self.centralManager?.cancelPeripheralConnection(connectedPeripheral.peripheral)
} else {
connectedNode = nil
connectedPeripheral = nil
}
}

View file

@ -56,9 +56,7 @@ struct Connect: View {
Button {
bleManager.disconnectDevice()
} label: {
VStack {
Label("Disconnect", systemImage: "antenna.radiowaves.left.and.right.slash")
}
Label("Disconnect", systemImage: "antenna.radiowaves.left.and.right.slash")
}
.tint(.red)
}

View file

@ -62,9 +62,7 @@ struct NodeList: View {
meshData.nodes.remove(at: nodeIndex!)
meshData.save()
} label: {
VStack {
Label("Delete from app", systemImage: "trash")
}
Label("Delete from app", systemImage: "trash")
}
.tint(.red)
}

View file

@ -10,23 +10,48 @@ struct NodeRow: View {
HStack() {
CircleText(text: node.user.shortName, color: Color.blue).offset(y: 1).padding(.trailing, 5)
Text(node.user.longName).font(.title2)
.offset(x: -15)
if UIDevice.current.userInterfaceIdiom == .pad {
Text(node.user.longName).font(.headline)
.offset(x: -15)
}
else {
Text(node.user.longName).font(.title)
.offset(x: -15)
}
}
.padding([.trailing])
.padding(.bottom, 10)
HStack (alignment: .bottom){
Image(systemName: "timer.square").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
if connected {
Text("Currently Connected").font(.subheadline).foregroundColor(Color.accentColor)
}
else if node.lastHeard > 0 {
let lastHeard = Date(timeIntervalSince1970: TimeInterval(node.lastHeard))
Text("Last Heard: \(lastHeard, style: .relative) ago").font(.subheadline).foregroundColor(.gray)
}
else {
Text("Last Heard: Unknown").font(.subheadline).foregroundColor(.gray)
Image(systemName: "clock.badge.checkmark.fill").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
if UIDevice.current.userInterfaceIdiom == .pad {
if connected {
Text("Currently Connected").font(.caption).foregroundColor(Color.accentColor)
}
else if node.lastHeard > 0 {
let lastHeard = Date(timeIntervalSince1970: TimeInterval(node.lastHeard))
Text("Last Heard: \(lastHeard, style: .relative) ago").font(.caption).foregroundColor(.gray)
}
else {
Text("Last Heard: Unknown").font(.caption).foregroundColor(.gray)
}
} else {
if connected {
Text("Currently Connected").font(.subheadline).foregroundColor(Color.accentColor)
}
else if node.lastHeard > 0 {
let lastHeard = Date(timeIntervalSince1970: TimeInterval(node.lastHeard))
Text("Last Heard: \(lastHeard, style: .relative) ago").font(.subheadline).foregroundColor(.gray)
}
else {
Text("Last Heard: Unknown").font(.subheadline).foregroundColor(.gray)
}
}
}
}.padding([.leading, .top, .bottom])