Additional swift lint fixes

This commit is contained in:
Garth Vander Houwen 2024-06-02 20:13:40 -07:00
parent 51929b3a35
commit 82a8336e35
6 changed files with 15 additions and 22 deletions

View file

@ -116,8 +116,6 @@ func positionToCsvFile(positions: [PositionEntity]) -> String {
func routeToCsvFile(locations: [LocationEntity]) -> String {
var csvString: String = ""
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
// Create Position Header
csvString = "Id, Latitude, Longitude, Altitude, Speed, Heading"
for loc in locations {

View file

@ -729,20 +729,19 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
}
case .neighborinfoApp:
if let neighborInfo = try? NeighborInfo(serializedData: decodedInfo.packet.decoded.payload) {
MeshLogger.log("🕸️ MESH PACKET received for Neighbor Info App UNHANDLED")
// MeshLogger.log("🕸 MESH PACKET received for Neighbor Info App UNHANDLED \(neighborInfo)")
// MeshLogger.log("🕸 MESH PACKET received for Neighbor Info App UNHANDLED")
MeshLogger.log("🕸️ MESH PACKET received for Neighbor Info App UNHANDLED \(neighborInfo)")
}
case .paxcounterApp:
paxCounterPacket(packet: decodedInfo.packet, context: context!)
case .mapReportApp:
MeshLogger.log("🕸️ MESH PACKET received for Map Report App UNHANDLED\(try! decodedInfo.packet.jsonString())")
MeshLogger.log("🕸️ MESH PACKET received Map Report App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
case .UNRECOGNIZED:
MeshLogger.log("🕸️ MESH PACKET received for Other App UNHANDLED \(try! decodedInfo.packet.jsonString())")
MeshLogger.log("🕸️ MESH PACKET received UNRECOGNIZED App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
case .max:
logger.info("MAX PORT NUM OF 511")
case .atakPlugin:
MeshLogger.log("🕸️ MESH PACKET received for ATAK Plugin App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
}
if decodedInfo.configCompleteID != 0 && decodedInfo.configCompleteID == configNonce {

View file

@ -517,7 +517,7 @@ func adminAppPacket (packet: MeshPacket, context: NSManagedObjectContext) {
let ringtone = adminMessage.getRingtoneResponse
upsertRtttlConfigPacket(ringtone: ringtone, nodeNum: Int64(packet.from), context: context)
} else {
MeshLogger.log("🕸️ MESH PACKET received for Admin App \(try! packet.decoded.jsonString())")
MeshLogger.log("🕸️ MESH PACKET received Admin App UNHANDLED \((try? packet.decoded.jsonString()) ?? "JSON Decode Failure")")
}
// Save an ack for the admin message log for each admin message response received as we stopped sending acks if there is also a response to reduce airtime.
adminResponseAck(packet: packet, context: context)

View file

@ -127,7 +127,7 @@ struct ChannelList: View {
} catch {
context.rollback()
print("💥 Save Channel Mute Error")
logger.error("💥 Save Channel Mute Error")
}
} label: {
Label(channel.mute ? "Show Alerts" : "Hide Alerts", systemImage: channel.mute ? "bell" : "bell.slash")

View file

@ -109,25 +109,25 @@ struct MeshMap: View {
//
// if ((newPath?.hasPrefix("meshtastic://open-waypoint")) != nil) {
// guard let url = URL(string: appState.navigationPath ?? "NONE") else {
// print("Invalid URL")
// logger.error("Invalid URL")
// return
// }
// guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
// print("Invalid URL Components")
// logger.error("Invalid URL Components")
// return
// }
// guard let action = components.host, action == "open-waypoint" else {
// print("Unknown waypoint URL action")
// logger.error("Unknown waypoint URL action")
// return
// }
// guard let waypointId = components.queryItems?.first(where: { $0.name == "id" })?.value else {
// print("Waypoint id not found")
// logger.error("Waypoint id not found")
// return
// }
// guard let waypoint = waypoints.first(where: { $0.id == Int64(waypointId) }) else {
// logger.error("Waypoint not found")
// return
// }
//// guard let waypoint = waypoints.first(where: { $0.id == Int64(waypointId) }) else {
//// print("Waypoint not found")
//// return
//// }
// //showWaypoints = true
// //position = .camera(MapCamera(centerCoordinate: waypoint.coordinate, distance: 1000, heading: 0, pitch: 60))
// }

View file

@ -64,10 +64,6 @@ struct TraceRouteLog: View {
.font(.title2)
}
let hopsArray = selectedRoute?.hops?.array as? [TraceRouteHopEntity] ?? []
let lineCoords = hopsArray.compactMap({(hop) -> CLLocationCoordinate2D in
return hop.coordinate ?? LocationHelper.DefaultLocation
})
if selectedRoute?.response ?? false {
if selectedRoute?.hasPositions ?? false {
Map(position: $position, bounds: MapCameraBounds(minimumDistance: 1, maximumDistance: .infinity), scope: mapScope) {
@ -83,7 +79,7 @@ struct TraceRouteLog: View {
// 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 {
var traceRouteCoords: [CLLocationCoordinate2D] = [selectedRoute?.coordinate ?? LocationsHandler.DefaultLocation, mostRecent.coordinate]
let traceRouteCoords: [CLLocationCoordinate2D] = [selectedRoute?.coordinate ?? LocationsHandler.DefaultLocation, mostRecent.coordinate]
Annotation(selectedRoute?.node?.user?.shortName ?? "???", coordinate: mostRecent.nodeCoordinate ?? LocationHelper.DefaultLocation) {
ZStack {
Circle()