diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 4e2c12c9..6f8a654a 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -291,9 +291,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject { } } - func requestDeviceMetadata() { + func requestDeviceMetadata(fromUser: UserEntity, toUser: UserEntity, context: NSManagedObjectContext) -> Int64 { - guard (connectedPeripheral!.peripheral.state == CBPeripheralState.connected) else { return } + guard (connectedPeripheral!.peripheral.state == CBPeripheralState.connected) else { return 0 } let nodeName = connectedPeripheral!.peripheral.name ?? NSLocalizedString("unknown", comment: NSLocalizedString("unknown", comment: "Unknown")) let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.devicemetadata %@", @@ -310,12 +310,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject { dataMessage.portnum = PortNum.adminApp dataMessage.wantResponse = true meshPacket.decoded = dataMessage - var toRadio: ToRadio = ToRadio() - toRadio.packet = meshPacket - let binaryData: Data = try! toRadio.serializedData() - connectedPeripheral!.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) - // Either Read the config complete value or from num notify value - connectedPeripheral!.peripheral.readValue(for: FROMRADIO_characteristic) + let messageDescription = "Requested Device Metadata for node \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown")) by \(toUser.longName ?? NSLocalizedString("unknown", comment: "Unknown"))" + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + return Int64(meshPacket.id) + } + return 0 } func sendTraceRouteRequest(destNum: Int64, wantResponse: Bool) -> Bool { diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV6.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV6.xcdatamodel/contents index da2cb3ef..f658ef98 100644 --- a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV6.xcdatamodel/contents +++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV6.xcdatamodel/contents @@ -47,6 +47,17 @@ + + + + + + + + + + + @@ -170,6 +181,7 @@ + diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index ebd26065..19e219b4 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -119,7 +119,7 @@ struct MapViewSwiftUI: UIViewRepresentable { annotationView.canShowCallout = true annotationView.glyphText = "📟" annotationView.clusteringIdentifier = "nodeGroup" - annotationView.markerTintColor = UIColor(.accentColor) + annotationView.markerTintColor = UIColor(.indigo) annotationView.titleVisibility = .visible return annotationView case let waypointAnnotation as WaypointEntity: @@ -133,15 +133,18 @@ struct MapViewSwiftUI: UIViewRepresentable { annotationView.glyphText = String(UnicodeScalar(Int(waypointAnnotation.icon)) ?? "📍") } annotationView.clusteringIdentifier = "waypointGroup" - annotationView.markerTintColor = UIColor(.indigo) + annotationView.markerTintColor = UIColor(.accentColor) + annotationView.displayPriority = .required annotationView.titleVisibility = .visible + let leftIcon = UIImageView(image: annotationView.glyphText?.image()) + leftIcon.backgroundColor = UIColor(.accentColor) + annotationView.leftCalloutAccessoryView = leftIcon let subtitle = UILabel() subtitle.text = waypointAnnotation.longDescription subtitle.numberOfLines = 0 + annotationView.detailCalloutAccessoryView = subtitle let editIcon = UIButton(type: .detailDisclosure) editIcon.setImage(UIImage(systemName: "square.and.pencil"), for: .normal) - // Build the Callout - annotationView.detailCalloutAccessoryView = subtitle; annotationView.rightCalloutAccessoryView = editIcon return annotationView default: return nil