mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
adding first heard date too
This commit is contained in:
parent
3bf443884c
commit
e4851769a1
4 changed files with 24 additions and 4 deletions
|
|
@ -7365,6 +7365,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"First heard" : {
|
||||
|
||||
},
|
||||
"Five Minutes" : {
|
||||
|
||||
|
|
|
|||
|
|
@ -145,8 +145,10 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext)
|
|||
let newNode = NodeInfoEntity(context: context)
|
||||
newNode.id = Int64(packet.from)
|
||||
newNode.num = Int64(packet.from)
|
||||
newNode.firstHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
|
||||
newNode.lastHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
|
||||
if packet.rxTime != 0 {
|
||||
newNode.firstHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
|
||||
newNode.lastHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
|
||||
}
|
||||
newNode.snr = packet.rxSnr
|
||||
newNode.rssi = packet.rxRssi
|
||||
newNode.viaMqtt = packet.viaMqtt
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ struct LastHeardText: View {
|
|||
}()
|
||||
|
||||
var body: some View {
|
||||
if let lastHeard, lastHeard.timeIntervalSince1970 > 0 {
|
||||
Text(lastHeard.formatted())
|
||||
if let lastHeard, lastHeard.timeIntervalSince1970 > 0, let text = Self.formatter.string(for: lastHeard) {
|
||||
Text(text)
|
||||
} else {
|
||||
Text("unknown")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,6 +129,21 @@ struct NodeDetail: View {
|
|||
}
|
||||
}
|
||||
|
||||
if let firstHeard = node.firstHeard {
|
||||
HStack {
|
||||
Label {
|
||||
Text("First heard")
|
||||
} icon: {
|
||||
Image(systemName: "clock")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
Spacer()
|
||||
|
||||
LastHeardText(lastHeard: firstHeard)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
}
|
||||
|
||||
if let lastHeard = node.lastHeard {
|
||||
HStack {
|
||||
Label {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue