2023-12-08 11:41:29 -08:00
|
|
|
//
|
|
|
|
|
// TraceRouteLog.swift
|
|
|
|
|
// Meshtastic
|
|
|
|
|
//
|
|
|
|
|
// Copyright(c) Garth Vander Houwen 12/7/23.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
2024-09-25 11:19:39 -07:00
|
|
|
import CoreData
|
2024-10-04 18:28:42 -07:00
|
|
|
import OSLog
|
2023-12-08 11:41:29 -08:00
|
|
|
import MapKit
|
|
|
|
|
|
|
|
|
|
struct TraceRouteLog: View {
|
2024-09-24 16:04:14 -07:00
|
|
|
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
2023-12-09 15:01:01 -08:00
|
|
|
@ObservedObject var locationsHandler = LocationsHandler.shared
|
2023-12-08 11:41:29 -08:00
|
|
|
@Environment(\.managedObjectContext) var context
|
Transports Interface to Support TCP for all Platforms and Serial on Mac (#1341)
* Initial implementation of transports
* Initial LogRadio implementation
* Fixes for Settings view (caused by debug commenting)
* Refinement of the object and actor model
* Connect view text and tab updates
* Fix mac catalyst and tests
* Warning and logging clean-up
* In progress commit
* Serial Transport and Reconnect draft work
* Serial transport and reconnection draft work
* Quick fix for BLE - still more work to do
* interim commit
* More in progress changes
* Minor improvements
* Pretty good initial implementation
* Bump version beyond the app store
* Fix for disconnection swipeAction
* Tweaks to TCPConnection implementation
* Retry for NONCE_ONLY_DB
* Revert json string change
* Simplified some of the API + "Anti-discovery"
* Tweaks for devices leaving the discovery process
* Bump version
* iOS26 Tweaks
* Tweaks and bug fixes
* Add link with slash sf symbol
* update symbol image on connect view
* BLE disconnect handling
* Log privacy attributes
* Onboarding and minor fixes.
* change database to nodes, add emoji to tcp logs
* Error handling improvements
* More logging emojis
* Suppressed unnecessary errors on disconnect
* Heartbeat emoji
* Add bluetooth symbol
* add privacy attributes to [TCP] logs, add custom bluetooth logo
* Improve routing logs
* Emoji for connect logs
* Heartbeat emoji
* Add CBCentralManagerScanOptionAllowDuplicatesKey options to central for bluetooth
* fix nav errors by switching from observableobject to state
* Update connection indicator icon
* fix for BLE disconnects
* Connection process fixes
* More fixes/tweaks to connection process
* Strict concurrency
* Fix some warnings, remove wifi warning
* delete stale keys
* interim commit
* Update privacy for log, fix wrong space
* fix a couple of linting items
* Switch to targeted
* interim commit
* BLE Signal strenth on connect view
* Remove BLE RSSI from long press menu
* Modem lights
* minor spacing tweak
* Additional BLE logging and a scanning fix.
* Discovery and BLE RSSI improvements
* Background suspension
* Update isConnected to enable UI during db load
* update protobufs
* Replace config if statements with switches, Fix unknown module config logging, make dark mode modem circle stroke color white so they are visible
* Additional logging cleanup
* hast
* Set unmessagable to true if the longname has the unmessagable emoji
* Connect error handling improvements
* Admin popup list icon and activity lights updates
* Revert use of .toolbar back to .navigationBarItems
* More public logging
* Better BLE error handling
* Node DB progress meter
* minor tweak to activity light interaction timing
* Fix comment linting, remove stale keys
* Remove stale keys
* Easy linting fixes
* Two more simple linting fixes
* clean up meshtasticapp
* More public logging
* Replay config
* Logging
* Fix for unselected node on Settings
* Tweak to progress meter based on device idiom
* Update protos
* Session replay redaction of messages
* Serial fix for old devices, and a let statement
* Mask text too
* Fix typo
* BLE poweredOff is now an auto-reconnectable error
* Update logging
* Fix for peerRemovedPairingInformation
* Logging for BLE peripheral:didUpdateValueFor errors.
* Fix for inconsistent swipe disconnect behavior
* periperal:didUpdateValueFor error handling
* Fix for BLEConnection continuation guarding
* BLEConnection actor deadlock on disconnect
* Heartbeat nonce
* Fix for swipe disconnect and task cancellation
* Fix for swipe actions not honoring .disabled()
* Tell BLETransport when BLEConnection is cancelled
* Update navigation logging
* Logging updates
* Bump version to 2.7.0
* Organize into folders and heartbeat stuff
* Minor improvements to manual TCP connection
* Auto-connect toggle
* Possible BLE bug, still waiting to see in logs
* Concurrency tweaks
* Concurrency improvements
* requestDeviceMetadata fix. fixes remote admin
* Minor typo fixes
* "All" button for log filters: category and level
* More robust continuation handling for BLE
* @FetchRequest based ChannelMessageList
* Update info.plist and device hardware file
* Move auto connect toggle to app settings and debug mode, tint properly with the accent color
* Add label to auto connect toggle
* Update log for node info received from ourselves over the mesh
* Remove unused scrollViewProxy
* Update Meshtastic/Views/Onboarding/DeviceOnboarding.swift
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update target for connect view
* Properly Set datadog environment
* Comment out ble manager
* Adjust cyclomatic complexity thresholds in .swiftlint.yml
* Linting fixes, delete ble manager
* Make session replay debug only
---------
Co-authored-by: jake-b <jake-b@users.noreply.github.com>
Co-authored-by: jake <jake@jakes-Mac-mini.local>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-27 08:09:02 -07:00
|
|
|
@EnvironmentObject var accessoryManager: AccessoryManager
|
2023-12-08 11:41:29 -08:00
|
|
|
@State private var isPresentingClearLogConfirm: Bool = false
|
|
|
|
|
@State var isExporting = false
|
|
|
|
|
@State var exportString = ""
|
|
|
|
|
@ObservedObject var node: NodeInfoEntity
|
|
|
|
|
@State private var selectedRoute: TraceRouteEntity?
|
2023-12-09 15:01:01 -08:00
|
|
|
// Map Configuration
|
|
|
|
|
@Namespace var mapScope
|
2024-05-29 16:40:07 -05:00
|
|
|
@State var mapStyle: MapStyle = MapStyle.standard(elevation: .realistic, emphasis: MapStyle.StandardEmphasis.muted, pointsOfInterest: .all, showsTraffic: true)
|
2023-12-09 15:01:01 -08:00
|
|
|
@State var position = MapCameraPosition.automatic
|
|
|
|
|
let distanceFormatter = MKDistanceFormatter()
|
2024-09-22 23:31:26 -07:00
|
|
|
/// State for the circle of routes
|
2024-09-24 17:17:42 -07:00
|
|
|
var modemPreset: ModemPresets = ModemPresets(rawValue: UserDefaults.modemPreset) ?? ModemPresets.longFast
|
|
|
|
|
@State private var indexes: Int = 0
|
2024-09-22 23:31:26 -07:00
|
|
|
@State var angle: Angle = .zero
|
|
|
|
|
@State var animation: Animation?
|
2024-05-29 16:40:07 -05:00
|
|
|
|
2023-12-08 11:41:29 -08:00
|
|
|
var body: some View {
|
2024-05-29 16:40:07 -05:00
|
|
|
HStack(alignment: .top) {
|
2023-12-08 11:41:29 -08:00
|
|
|
VStack {
|
2023-12-09 15:01:01 -08:00
|
|
|
VStack {
|
|
|
|
|
List(node.traceRoutes?.reversed() as? [TraceRouteEntity] ?? [], id: \.self, selection: $selectedRoute) { route in
|
|
|
|
|
Label {
|
2025-04-27 16:19:10 -07:00
|
|
|
let routeTime = route.time?.formatted() ?? "Unknown".localized
|
2024-12-19 10:03:33 -06:00
|
|
|
if route.response && route.hopsTowards == route.hopsBack {
|
|
|
|
|
let hopString = String(localized: "\(route.hopsTowards) Hops")
|
|
|
|
|
Text("\(routeTime) - \(hopString)")
|
2024-10-12 05:35:14 -07:00
|
|
|
.font(.caption)
|
|
|
|
|
} else if route.response {
|
2024-12-19 10:03:33 -06:00
|
|
|
let hopTowardsString = String(localized: "\(route.hopsTowards) Hops")
|
2025-04-27 16:19:10 -07:00
|
|
|
let hopBackString = route.hopsBack >= 0 ? String(localized: "\(route.hopsBack) Hops") : String(localized: "Unknown")
|
2024-12-19 10:03:33 -06:00
|
|
|
Text("\(routeTime) - \(hopTowardsString) Towards \(hopBackString) Back")
|
2024-10-12 05:35:14 -07:00
|
|
|
.font(.caption)
|
|
|
|
|
} else if route.sent {
|
2024-12-19 10:03:33 -06:00
|
|
|
Text("\(routeTime) - No Response")
|
2024-10-12 05:35:14 -07:00
|
|
|
.font(.caption)
|
|
|
|
|
} else {
|
2024-12-19 10:03:33 -06:00
|
|
|
Text("\(routeTime) - Not Sent")
|
2024-10-12 05:35:14 -07:00
|
|
|
.font(.caption)
|
|
|
|
|
}
|
2023-12-09 15:01:01 -08:00
|
|
|
} icon: {
|
2024-11-02 10:22:19 -05:00
|
|
|
Image(systemName: route.response ? (route.hopsTowards == 0 && route.response ? "person.line.dotted.person" : "point.3.connected.trianglepath.dotted") : "person.slash")
|
2023-12-09 15:01:01 -08:00
|
|
|
.symbolRenderingMode(.hierarchical)
|
|
|
|
|
}
|
2024-10-04 18:28:42 -07:00
|
|
|
.swipeActions {
|
|
|
|
|
Button(role: .destructive) {
|
|
|
|
|
context.delete(route)
|
|
|
|
|
do {
|
|
|
|
|
try context.save()
|
|
|
|
|
} catch let error as NSError {
|
2025-03-31 22:06:00 -07:00
|
|
|
Logger.data.error("\(error.localizedDescription, privacy: .public)")
|
2024-10-04 18:28:42 -07:00
|
|
|
}
|
|
|
|
|
} label: {
|
2025-05-05 08:57:38 -07:00
|
|
|
Label("Delete", systemImage: "trash")
|
2024-10-04 18:28:42 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
2023-12-09 15:01:01 -08:00
|
|
|
.listStyle(.plain)
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
Divider()
|
|
|
|
|
ScrollView {
|
2023-12-09 15:01:01 -08:00
|
|
|
if selectedRoute != nil {
|
2024-11-02 10:22:19 -05:00
|
|
|
if selectedRoute?.response ?? false && selectedRoute?.hopsTowards ?? 0 >= 0 {
|
2024-09-26 16:48:18 -07:00
|
|
|
Label {
|
2025-04-27 16:19:10 -07:00
|
|
|
Text("Route: \(selectedRoute?.routeText ?? "Unknown".localized)")
|
2024-09-26 16:48:18 -07:00
|
|
|
} icon: {
|
2024-10-13 09:20:05 -07:00
|
|
|
Image(systemName: "signpost.right")
|
2023-12-21 19:33:45 -08:00
|
|
|
.symbolRenderingMode(.hierarchical)
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.font(.title3)
|
2023-12-09 15:01:01 -08:00
|
|
|
Label {
|
2025-04-27 16:19:10 -07:00
|
|
|
Text("Route Back: \(selectedRoute?.routeBackText ?? "Unknown".localized)")
|
2023-12-09 15:01:01 -08:00
|
|
|
} icon: {
|
2024-10-13 09:20:05 -07:00
|
|
|
Image(systemName: "signpost.left")
|
2023-12-09 15:01:01 -08:00
|
|
|
.symbolRenderingMode(.hierarchical)
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.font(.title3)
|
2024-09-30 08:23:47 -07:00
|
|
|
} else if !(selectedRoute?.sent ?? true) {
|
|
|
|
|
Label {
|
|
|
|
|
VStack {
|
2025-04-27 16:19:10 -07:00
|
|
|
Text("Trace route to \(selectedRoute?.node?.user?.longName ?? "Unknown".localized) was not sent.")
|
2024-09-30 08:23:47 -07:00
|
|
|
.font(idiom == .phone ? .body : .largeTitle)
|
|
|
|
|
.fontWeight(.semibold)
|
|
|
|
|
Text("Trace Route was rate limited. You can send a trace route a maximum of once every thirty seconds.")
|
|
|
|
|
.font(idiom == .phone ? .caption : .body)
|
|
|
|
|
.foregroundStyle(.secondary)
|
|
|
|
|
.padding()
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
2024-09-30 08:23:47 -07:00
|
|
|
} icon: {
|
|
|
|
|
Image(systemName: "square.and.arrow.up.trianglebadge.exclamationmark")
|
|
|
|
|
.symbolRenderingMode(.hierarchical)
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
} else {
|
2024-09-30 08:23:47 -07:00
|
|
|
Label {
|
|
|
|
|
VStack {
|
2025-04-27 16:19:10 -07:00
|
|
|
Text("Trace route sent to \(selectedRoute?.node?.user?.longName ?? "Unknown".localized)")
|
2024-09-30 08:23:47 -07:00
|
|
|
.font(idiom == .phone ? .body : .largeTitle)
|
|
|
|
|
.fontWeight(.semibold)
|
|
|
|
|
Text("A Trace Route was sent, no response has been received.")
|
|
|
|
|
.font(idiom == .phone ? .caption : .body)
|
|
|
|
|
.foregroundStyle(.secondary)
|
|
|
|
|
.padding()
|
2024-09-24 16:04:14 -07:00
|
|
|
}
|
2024-09-30 08:23:47 -07:00
|
|
|
} icon: {
|
|
|
|
|
Image(systemName: "signpost.right.and.left")
|
|
|
|
|
.symbolRenderingMode(.hierarchical)
|
|
|
|
|
}
|
2023-12-09 15:01:01 -08:00
|
|
|
}
|
2024-10-22 22:44:14 -05:00
|
|
|
if false {// selectedRoute?.hops?.count ?? 0 >= 3 {
|
2024-09-24 16:04:14 -07:00
|
|
|
HStack(alignment: .center) {
|
|
|
|
|
GeometryReader { geometry in
|
2024-09-25 11:19:39 -07:00
|
|
|
let size = ((geometry.size.width >= geometry.size.height ? geometry.size.height : geometry.size.width) / 2) - (idiom == .phone ? 45 : 85)
|
2024-09-24 16:04:14 -07:00
|
|
|
Spacer()
|
2024-09-25 11:19:39 -07:00
|
|
|
TraceRoute(radius: size < 600 ? size : 600, rotation: angle) {
|
2024-09-24 16:04:14 -07:00
|
|
|
contents()
|
2023-12-09 15:01:01 -08:00
|
|
|
}
|
2024-09-25 11:19:39 -07:00
|
|
|
.padding(.leading, idiom == .phone ? 0 : 20)
|
|
|
|
|
Spacer()
|
2023-12-09 15:01:01 -08:00
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.scaledToFit()
|
2023-12-09 15:01:01 -08:00
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.onAppear {
|
|
|
|
|
// Set the view rotation animation after the view appeared,
|
|
|
|
|
// to avoid animating initial rotation
|
|
|
|
|
DispatchQueue.main.async {
|
2024-09-24 17:17:42 -07:00
|
|
|
indexes = (selectedRoute?.hops?.array.count ?? 0) * 2
|
2024-09-24 16:04:14 -07:00
|
|
|
animation = .easeInOut(duration: 1.0)
|
|
|
|
|
withAnimation(.easeInOut(duration: 2.0)) {
|
|
|
|
|
angle = (angle == .degrees(-90) ? .degrees(-90) : .degrees(-90))
|
2023-12-09 15:01:01 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.onTapGesture {
|
|
|
|
|
withAnimation(.easeInOut(duration: 2.0)) {
|
|
|
|
|
angle = (angle == .degrees(-90) ? .degrees(90) : .degrees(-90))
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
if selectedRoute?.hasPositions ?? false {
|
2024-09-26 16:48:18 -07:00
|
|
|
// Map(position: $position, bounds: MapCameraBounds(minimumDistance: 1, maximumDistance: .infinity), scope: mapScope) {
|
|
|
|
|
// Annotation("You", coordinate: selectedRoute?.coordinate ?? LocationHelper.DefaultLocation) {
|
|
|
|
|
// ZStack {
|
|
|
|
|
// Circle()
|
|
|
|
|
// .fill(Color(.green))
|
|
|
|
|
// .strokeBorder(.white, lineWidth: 3)
|
|
|
|
|
// .frame(width: 15, height: 15)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// .annotationTitles(.automatic)
|
|
|
|
|
// // Direct Trace Route
|
|
|
|
|
// if selectedRoute?.response ?? false && selectedRoute?.hops?.count ?? 0 == 0 {
|
|
|
|
|
// if selectedRoute?.node?.positions?.count ?? 0 > 0, let mostRecent = selectedRoute?.node?.positions?.lastObject as? PositionEntity {
|
|
|
|
|
// let traceRouteCoords: [CLLocationCoordinate2D] = [selectedRoute?.coordinate ?? LocationsHandler.DefaultLocation, mostRecent.coordinate]
|
|
|
|
|
// Annotation(selectedRoute?.node?.user?.shortName ?? "???", coordinate: mostRecent.nodeCoordinate ?? LocationHelper.DefaultLocation) {
|
|
|
|
|
// ZStack {
|
|
|
|
|
// Circle()
|
|
|
|
|
// .fill(Color(.black))
|
|
|
|
|
// .strokeBorder(.white, lineWidth: 3)
|
|
|
|
|
// .frame(width: 15, height: 15)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// let dashed = StrokeStyle(
|
|
|
|
|
// lineWidth: 2,
|
|
|
|
|
// lineCap: .round, lineJoin: .round, dash: [7, 10]
|
|
|
|
|
// )
|
|
|
|
|
// MapPolyline(coordinates: traceRouteCoords)
|
|
|
|
|
// .stroke(.blue, style: dashed)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// .frame(maxWidth: .infinity, minHeight: 250)
|
|
|
|
|
// if selectedRoute?.response ?? false {
|
|
|
|
|
// VStack {
|
|
|
|
|
// /// Distance
|
|
|
|
|
// if selectedRoute?.node?.positions?.count ?? 0 > 0,
|
|
|
|
|
// selectedRoute?.coordinate != nil,
|
|
|
|
|
// let mostRecent = selectedRoute?.node?.positions?.lastObject as? PositionEntity {
|
|
|
|
|
// let startPoint = CLLocation(latitude: selectedRoute?.coordinate?.latitude ?? LocationsHandler.DefaultLocation.latitude, longitude: selectedRoute?.coordinate?.longitude ?? LocationsHandler.DefaultLocation.longitude)
|
|
|
|
|
// if startPoint.distance(from: CLLocation(latitude: LocationsHandler.DefaultLocation.latitude, longitude: LocationsHandler.DefaultLocation.longitude)) > 0.0 {
|
|
|
|
|
// let metersAway = selectedRoute?.coordinate?.distance(from: CLLocationCoordinate2D(latitude: mostRecent.latitude ?? LocationsHandler.DefaultLocation.latitude, longitude: mostRecent.longitude ?? LocationsHandler.DefaultLocation.longitude))
|
|
|
|
|
// Label {
|
|
|
|
|
// Text("distance".localized + ": \(distanceFormatter.string(fromDistance: Double(metersAway ?? 0)))")
|
|
|
|
|
// .foregroundColor(.primary)
|
|
|
|
|
// } icon: {
|
|
|
|
|
// Image(systemName: "lines.measurement.horizontal")
|
|
|
|
|
// .symbolRenderingMode(.hierarchical)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2024-09-24 16:04:14 -07:00
|
|
|
Spacer()
|
|
|
|
|
.padding(.bottom, 125)
|
2024-09-23 10:46:38 -07:00
|
|
|
}
|
2023-12-08 11:41:29 -08:00
|
|
|
} else {
|
2023-12-09 15:01:01 -08:00
|
|
|
ContentUnavailableView("Select a Trace Route", systemImage: "signpost.right.and.left")
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
|
|
|
|
}
|
2024-09-24 16:04:14 -07:00
|
|
|
.edgesIgnoringSafeArea(.bottom)
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
2023-12-09 15:01:01 -08:00
|
|
|
.navigationTitle("Trace Route Log")
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
|
|
|
|
.navigationBarItems(trailing:
|
2023-12-09 15:01:01 -08:00
|
|
|
ZStack {
|
Transports Interface to Support TCP for all Platforms and Serial on Mac (#1341)
* Initial implementation of transports
* Initial LogRadio implementation
* Fixes for Settings view (caused by debug commenting)
* Refinement of the object and actor model
* Connect view text and tab updates
* Fix mac catalyst and tests
* Warning and logging clean-up
* In progress commit
* Serial Transport and Reconnect draft work
* Serial transport and reconnection draft work
* Quick fix for BLE - still more work to do
* interim commit
* More in progress changes
* Minor improvements
* Pretty good initial implementation
* Bump version beyond the app store
* Fix for disconnection swipeAction
* Tweaks to TCPConnection implementation
* Retry for NONCE_ONLY_DB
* Revert json string change
* Simplified some of the API + "Anti-discovery"
* Tweaks for devices leaving the discovery process
* Bump version
* iOS26 Tweaks
* Tweaks and bug fixes
* Add link with slash sf symbol
* update symbol image on connect view
* BLE disconnect handling
* Log privacy attributes
* Onboarding and minor fixes.
* change database to nodes, add emoji to tcp logs
* Error handling improvements
* More logging emojis
* Suppressed unnecessary errors on disconnect
* Heartbeat emoji
* Add bluetooth symbol
* add privacy attributes to [TCP] logs, add custom bluetooth logo
* Improve routing logs
* Emoji for connect logs
* Heartbeat emoji
* Add CBCentralManagerScanOptionAllowDuplicatesKey options to central for bluetooth
* fix nav errors by switching from observableobject to state
* Update connection indicator icon
* fix for BLE disconnects
* Connection process fixes
* More fixes/tweaks to connection process
* Strict concurrency
* Fix some warnings, remove wifi warning
* delete stale keys
* interim commit
* Update privacy for log, fix wrong space
* fix a couple of linting items
* Switch to targeted
* interim commit
* BLE Signal strenth on connect view
* Remove BLE RSSI from long press menu
* Modem lights
* minor spacing tweak
* Additional BLE logging and a scanning fix.
* Discovery and BLE RSSI improvements
* Background suspension
* Update isConnected to enable UI during db load
* update protobufs
* Replace config if statements with switches, Fix unknown module config logging, make dark mode modem circle stroke color white so they are visible
* Additional logging cleanup
* hast
* Set unmessagable to true if the longname has the unmessagable emoji
* Connect error handling improvements
* Admin popup list icon and activity lights updates
* Revert use of .toolbar back to .navigationBarItems
* More public logging
* Better BLE error handling
* Node DB progress meter
* minor tweak to activity light interaction timing
* Fix comment linting, remove stale keys
* Remove stale keys
* Easy linting fixes
* Two more simple linting fixes
* clean up meshtasticapp
* More public logging
* Replay config
* Logging
* Fix for unselected node on Settings
* Tweak to progress meter based on device idiom
* Update protos
* Session replay redaction of messages
* Serial fix for old devices, and a let statement
* Mask text too
* Fix typo
* BLE poweredOff is now an auto-reconnectable error
* Update logging
* Fix for peerRemovedPairingInformation
* Logging for BLE peripheral:didUpdateValueFor errors.
* Fix for inconsistent swipe disconnect behavior
* periperal:didUpdateValueFor error handling
* Fix for BLEConnection continuation guarding
* BLEConnection actor deadlock on disconnect
* Heartbeat nonce
* Fix for swipe disconnect and task cancellation
* Fix for swipe actions not honoring .disabled()
* Tell BLETransport when BLEConnection is cancelled
* Update navigation logging
* Logging updates
* Bump version to 2.7.0
* Organize into folders and heartbeat stuff
* Minor improvements to manual TCP connection
* Auto-connect toggle
* Possible BLE bug, still waiting to see in logs
* Concurrency tweaks
* Concurrency improvements
* requestDeviceMetadata fix. fixes remote admin
* Minor typo fixes
* "All" button for log filters: category and level
* More robust continuation handling for BLE
* @FetchRequest based ChannelMessageList
* Update info.plist and device hardware file
* Move auto connect toggle to app settings and debug mode, tint properly with the accent color
* Add label to auto connect toggle
* Update log for node info received from ourselves over the mesh
* Remove unused scrollViewProxy
* Update Meshtastic/Views/Onboarding/DeviceOnboarding.swift
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update target for connect view
* Properly Set datadog environment
* Comment out ble manager
* Adjust cyclomatic complexity thresholds in .swiftlint.yml
* Linting fixes, delete ble manager
* Make session replay debug only
---------
Co-authored-by: jake-b <jake-b@users.noreply.github.com>
Co-authored-by: jake <jake@jakes-Mac-mini.local>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-27 08:09:02 -07:00
|
|
|
ConnectedDevice(deviceConnected: accessoryManager.isConnected, name: accessoryManager.activeConnection?.device.shortName ?? "?")
|
2023-12-08 11:41:29 -08:00
|
|
|
})
|
|
|
|
|
}
|
2024-09-22 23:31:26 -07:00
|
|
|
@ViewBuilder func contents(animation: Animation? = nil) -> some View {
|
2024-09-24 17:17:42 -07:00
|
|
|
ForEach(0..<indexes, id: \.self) { idx in
|
2024-09-24 16:15:42 -07:00
|
|
|
TraceRouteComponent(animation: animation) {
|
2024-10-05 09:55:08 -07:00
|
|
|
let hops = selectedRoute?.hops?.array as? [TraceRouteHopEntity] ?? [] // getTraceRouteHops(context: PersistenceController.preview.container.viewContext)//
|
2024-09-24 16:15:42 -07:00
|
|
|
if idx % 2 == 0 {
|
2024-09-25 11:19:39 -07:00
|
|
|
let i = idx / 2
|
2024-09-24 17:17:42 -07:00
|
|
|
let snrColor = getSnrColor(snr: hops[i].snr, preset: modemPreset)
|
2024-09-24 16:15:42 -07:00
|
|
|
VStack {
|
2024-09-24 17:17:42 -07:00
|
|
|
let nodeColor = UIColor(hex: UInt32(truncatingIfNeeded: hops[i].num))
|
2024-09-25 11:19:39 -07:00
|
|
|
CircleText(text: String(hops[i].num.toHex().suffix(4)), color: Color(nodeColor), circleSize: idiom == .phone ? 70 : 125)
|
2024-09-24 17:17:42 -07:00
|
|
|
Text("\(String(format: "%.2f", hops[i].snr)) dB")
|
2024-09-25 11:19:39 -07:00
|
|
|
.font(idiom == .phone ? .caption2 : .headline)
|
2024-09-24 17:17:42 -07:00
|
|
|
.foregroundColor(snrColor)
|
2024-09-25 11:19:39 -07:00
|
|
|
.allowsTightening(true)
|
|
|
|
|
.fontWeight(.semibold)
|
2024-09-24 16:15:42 -07:00
|
|
|
}
|
|
|
|
|
} else {
|
2024-09-25 11:19:39 -07:00
|
|
|
let i = (idx - 1) / 2
|
2024-09-24 17:17:42 -07:00
|
|
|
let snrColor = getSnrColor(snr: hops[i].snr, preset: modemPreset)
|
2024-09-24 16:15:42 -07:00
|
|
|
Image(systemName: "arrowshape.right.fill")
|
|
|
|
|
.resizable()
|
2024-09-25 11:19:39 -07:00
|
|
|
.frame(width: idiom == .phone ? 25 : 60, height: idiom == .phone ? 25 : 60)
|
2024-09-24 17:17:42 -07:00
|
|
|
.foregroundColor(snrColor.opacity(0.7))
|
2024-09-22 23:31:26 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|
2024-09-25 11:19:39 -07:00
|
|
|
|
|
|
|
|
func getTraceRouteHops(context: NSManagedObjectContext) -> [TraceRouteHopEntity] {
|
|
|
|
|
/// static let context = PersistenceController.preview.container.viewContext
|
|
|
|
|
var array = [TraceRouteHopEntity]()
|
|
|
|
|
let trh1 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh1.num = 366311664
|
|
|
|
|
trh1.snr = 12.5
|
|
|
|
|
let trh2 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh2.num = 3662955168
|
|
|
|
|
trh2.snr = -115.00
|
|
|
|
|
let trh3 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh3.num = 3663982804
|
|
|
|
|
trh3.snr = 17.5
|
|
|
|
|
let trh4 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh4.num = 4202719792
|
|
|
|
|
trh4.snr = 7.0
|
|
|
|
|
let trh5 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh5.num = 603700594
|
|
|
|
|
trh5.snr = 8.9
|
|
|
|
|
let trh6 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh6.num = 836212501
|
|
|
|
|
trh6.snr = -24.0
|
|
|
|
|
let trh7 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh7.num = 3663116644
|
|
|
|
|
trh7.snr = -6.0
|
|
|
|
|
let trh8 = TraceRouteHopEntity(context: context)
|
|
|
|
|
trh8.num = 8362955168
|
|
|
|
|
trh8.snr = 7.5
|
|
|
|
|
array.append(trh1)
|
|
|
|
|
array.append(trh2)
|
|
|
|
|
array.append(trh3)
|
|
|
|
|
array.append(trh4)
|
|
|
|
|
array.append(trh5)
|
|
|
|
|
array.append(trh6)
|
|
|
|
|
array.append(trh7)
|
|
|
|
|
array.append(trh8)
|
|
|
|
|
return array
|
2023-12-08 11:41:29 -08:00
|
|
|
}
|