From 61263382d8bca4582ccb2b53959de4da8480aa4b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Thu, 25 Aug 2022 14:14:54 -0700 Subject: [PATCH 1/2] filter display on message details so it only shows acts for sent messages fix crash from empty last positions --- .../Views/Messages/UserMessageList.swift | 40 +++++++++++-------- Meshtastic/Views/Nodes/NodeList.swift | 25 +++++++----- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift index 33852544..45646651 100644 --- a/Meshtastic/Views/Messages/UserMessageList.swift +++ b/Meshtastic/Views/Messages/UserMessageList.swift @@ -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 { diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index 0828e7e8..58863a51 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -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) + } } } } From 1e4d39062e73d3ed9a7fddc501f0ff7701328b66 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 30 Aug 2022 08:16:56 -0700 Subject: [PATCH 2/2] Fix Fahrenheit / celsius display on telemetry log --- Meshtastic/Views/Nodes/TelemetryLog.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meshtastic/Views/Nodes/TelemetryLog.swift b/Meshtastic/Views/Nodes/TelemetryLog.swift index 43969616..b43cfc09 100644 --- a/Meshtastic/Views/Nodes/TelemetryLog.swift +++ b/Meshtastic/Views/Nodes/TelemetryLog.swift @@ -87,7 +87,7 @@ struct TelemetryLog: View { .font(.title) - let tempReadingType = (!(node.telemetryConfig?.environmentDisplayFahrenheit ?? true)) ? "°C" : "°F" + let tempReadingType = (!(node.telemetryConfig?.environmentDisplayFahrenheit ?? false)) ? "°C" : "°F" if tel.temperature > 0 {