mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
filter display on message details so it only shows acts for sent messages
fix crash from empty last positions
This commit is contained in:
parent
cf8877fc39
commit
61263382d8
2 changed files with 38 additions and 27 deletions
|
|
@ -213,37 +213,45 @@ struct UserMessageList: View {
|
|||
|
||||
let messageDate = Date(timeIntervalSince1970: TimeInterval(message.messageTimestamp))
|
||||
|
||||
Text("Sent \(messageDate, style: .date) \(messageDate.formattedDate(format: "h:mm:ss a"))").font(.caption2).foregroundColor(.gray)
|
||||
Text("Date \(messageDate, style: .date) \(messageDate.formattedDate(format: "h:mm:ss a"))").font(.caption2).foregroundColor(.gray)
|
||||
}
|
||||
|
||||
|
||||
if message.receivedACK {
|
||||
if currentUser && message.receivedACK {
|
||||
|
||||
VStack {
|
||||
|
||||
Text("Received Ack \(message.receivedACK ? "✔️" : "")")
|
||||
}
|
||||
}
|
||||
if message.ackError > 0 {
|
||||
|
||||
|
||||
} else if currentUser && message.ackError == 0 {
|
||||
|
||||
// Empty Error
|
||||
Text("Waiting. . .")
|
||||
|
||||
} else if currentUser && message.ackError > 0 {
|
||||
|
||||
let ackErrorVal = RoutingError(rawValue: Int(message.ackError))
|
||||
Text("\(ackErrorVal?.display ?? "No Error" )").fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
VStack {
|
||||
|
||||
if currentUser {
|
||||
|
||||
let ackDate = Date(timeIntervalSince1970: TimeInterval(message.ackTimestamp))
|
||||
|
||||
let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date())
|
||||
if ackDate >= sixMonthsAgo! {
|
||||
VStack {
|
||||
|
||||
Text((ackDate.formattedDate(format: "h:mm:ss a"))).font(.caption2).foregroundColor(.gray)
|
||||
let ackDate = Date(timeIntervalSince1970: TimeInterval(message.ackTimestamp))
|
||||
|
||||
} else {
|
||||
|
||||
Text("Unknown Age").font(.caption2).foregroundColor(.gray)
|
||||
let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date())
|
||||
if ackDate >= sixMonthsAgo! {
|
||||
|
||||
Text((ackDate.formattedDate(format: "h:mm:ss a"))).font(.caption2).foregroundColor(.gray)
|
||||
|
||||
} else {
|
||||
|
||||
Text("Unknown Age").font(.caption2).foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if message.ackSNR != 0 {
|
||||
VStack {
|
||||
|
||||
|
|
|
|||
|
|
@ -107,20 +107,23 @@ struct NodeList: View {
|
|||
|
||||
let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
|
||||
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude)
|
||||
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
|
||||
Image(systemName: "lines.measurement.horizontal").font(.title3)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
if lastPostion.coordinate != nil {
|
||||
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude)
|
||||
|
||||
DistanceText(meters: metersAway).font(.subheadline).foregroundColor(.gray)
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
|
||||
} else {
|
||||
Image(systemName: "lines.measurement.horizontal").font(.title3)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
DistanceText(meters: metersAway).font(.title3).foregroundColor(.gray)
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
DistanceText(meters: metersAway).font(.subheadline).foregroundColor(.gray)
|
||||
|
||||
} else {
|
||||
|
||||
DistanceText(meters: metersAway).font(.title3).foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue