mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Version 1.
This commit is contained in:
parent
5eee4272d7
commit
b1303832f7
8 changed files with 177 additions and 199 deletions
|
|
@ -45,7 +45,15 @@ struct NodeList: View {
|
|||
}
|
||||
ForEach(filteredDevices.sorted(by: { $0.lastHeard > $1.lastHeard })) { node in
|
||||
NavigationLink(destination: NodeDetail(node: node)) {
|
||||
NodeRow(node: node, index : 0)
|
||||
|
||||
if(bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.myInfo != nil) {
|
||||
|
||||
let connected: Bool = (bleManager.connectedPeripheral.myInfo!.id == node.id)
|
||||
NodeRow(node: node, connected: connected)
|
||||
}
|
||||
else {
|
||||
NodeRow(node: node, connected: false)
|
||||
}
|
||||
|
||||
}
|
||||
.swipeActions {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import SwiftUI
|
|||
|
||||
struct NodeRow: View {
|
||||
var node: NodeInfoModel
|
||||
var index: Int
|
||||
var connected: Bool
|
||||
|
||||
var body: some View {
|
||||
VStack (alignment: .leading) {
|
||||
|
|
@ -18,7 +18,10 @@ struct NodeRow: View {
|
|||
|
||||
Image(systemName: "timer").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
|
||||
|
||||
if node.lastHeard > 0 {
|
||||
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)
|
||||
}
|
||||
|
|
@ -35,7 +38,7 @@ struct NodeRow_Previews: PreviewProvider {
|
|||
|
||||
static var previews: some View {
|
||||
Group {
|
||||
NodeRow(node: nodes[0], index: 0)
|
||||
NodeRow(node: nodes[0], connected: true)
|
||||
}
|
||||
.previewLayout(.fixed(width: 300, height: 70))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue