Update trace route list, only show traceroute icon if there are responses, temp layout test

This commit is contained in:
Garth Vander Houwen 2024-10-13 09:20:05 -07:00
parent a74e7bcd06
commit f0838eace9
4 changed files with 16 additions and 16 deletions

View file

@ -40,7 +40,8 @@ extension NodeInfoEntity {
}
var hasTraceRoutes: Bool {
return traceRoutes?.count ?? 0 > 0
let routes = traceRoutes?.filter { ($0 as AnyObject).response }
return routes?.count ?? 0 > 0
}
var hasPax: Bool {

View file

@ -897,6 +897,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
traceRoute?.hasPositions = true
}
hopNodes.append(destinationHop)
/// Add the destination node to the end of the route towards string and the beginning of teh route back string
routeString += "\(traceRoute?.node?.user?.longName ?? "unknown".localized) \((traceRoute?.node?.num ?? 0).toHex()) \(traceRoute?.node?.snr ?? 0 > 0 ? traceRoute?.node?.snr ?? 0 : 0.0)dB)"
var routeBackString = "\(traceRoute?.node?.user?.longName ?? "unknown".localized) \((traceRoute?.node?.num ?? 0).toHex()) \(traceRoute?.node?.snr ?? 0 > 0 ? traceRoute?.node?.snr ?? 0 : 0.0)dB) --> "
traceRoute?.hopsBack = Int32(routingMessage.routeBack.count)
@ -927,9 +928,6 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
}
hopNodes.append(traceRouteHop)
routeBackString += "\(hopNode?.user?.longName ?? (node == 4294967295 ? "Repeater" : String(hopNode?.num.toHex() ?? "unknown".localized))) \(hopNode?.viaMqtt ?? false ? "MQTT" : "") (\(traceRouteHop.snr > 0 ? hopNode?.snr ?? 0.0 : 0.0)dB) --> "
}
routeBackString += "\(connectedNode.user?.longName ?? String(connectedNode.num.toHex())) \(connectedNode.snr > 0 ? connectedNode.snr : 0.0)dB)"
traceRoute?.routeText = routeString

View file

@ -56,13 +56,13 @@ struct TraceRoute: Layout {
subview.place(at: point, anchor: .center, proposal: .unspecified)
DispatchQueue.main.async {
// DispatchQueue.main.async {
if index % 2 == 0 {
subview[Rotation.self]?.wrappedValue = .zero
} else {
subview[Rotation.self]?.wrappedValue = .radians(angle)
}
}
// }
}
}
}

View file

@ -37,7 +37,7 @@ struct TraceRouteLog: View {
VStack {
List(node.traceRoutes?.reversed() as? [TraceRouteEntity] ?? [], id: \.self, selection: $selectedRoute) { route in
Label {
if route.response && route.hops?.count == 0 {
if route.response && route.hopsTowards == 0 {
Text("\(route.time?.formatted() ?? "unknown".localized) - Direct")
.font(.caption)
} else if route.response && route.hopsTowards == 1 {
@ -76,7 +76,16 @@ struct TraceRouteLog: View {
Divider()
ScrollView {
if selectedRoute != nil {
if selectedRoute?.response ?? false && selectedRoute?.hopsTowards ?? 0 > 1 {
if selectedRoute?.response ?? false && selectedRoute?.hopsTowards ?? 0 == 0 {
Label {
Text("Trace route received directly by \(selectedRoute?.node?.user?.longName ?? "unknown".localized) with a SNR of \(String(format: "%.2f", selectedRoute?.node?.snr ?? 0.0)) dB")
} icon: {
Image(systemName: "signpost.right.and.left")
.symbolRenderingMode(.hierarchical)
}
.font(.title3)
} else if selectedRoute?.response ?? false && selectedRoute?.hopsTowards ?? 0 > 0 {
Label {
Text("Route: \(selectedRoute?.routeText ?? "unknown".localized)")
} icon: {
@ -91,14 +100,6 @@ struct TraceRouteLog: View {
.symbolRenderingMode(.hierarchical)
}
.font(.title3)
} else if selectedRoute?.response ?? false {
Label {
Text("Trace route received directly by \(selectedRoute?.node?.user?.longName ?? "unknown".localized) with a SNR of \(String(format: "%.2f", selectedRoute?.node?.snr ?? 0.0)) dB")
} icon: {
Image(systemName: "signpost.right.and.left")
.symbolRenderingMode(.hierarchical)
}
.font(.title3)
} else if !(selectedRoute?.sent ?? true) {
Label {
VStack {