mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Pin Icons for device roles
This commit is contained in:
parent
99bb8610ae
commit
822028fb7b
7 changed files with 66 additions and 11 deletions
|
|
@ -35,6 +35,30 @@ enum KeyboardType: Int, CaseIterable, Identifiable {
|
|||
}
|
||||
}
|
||||
|
||||
enum CenteringMode: Int, CaseIterable, Identifiable {
|
||||
|
||||
case allAnnotations = 0
|
||||
case allPositions = 1
|
||||
case latestPosition = 2
|
||||
case clientGps = 7
|
||||
|
||||
var id: Int { self.rawValue }
|
||||
var description: String {
|
||||
get {
|
||||
switch self {
|
||||
case .allAnnotations:
|
||||
return "Center of All Annotations"// NSLocalizedString("default", comment: "Default Keyboard")
|
||||
case .allPositions:
|
||||
return "Center of All Node Postions"// NSLocalizedString("ascii.capable", comment: "ASCII Capable Keyboard")
|
||||
case .latestPosition:
|
||||
return "Latest Node Position"//NSLocalizedString("twitter", comment: "Twitter Keyboard")
|
||||
case .clientGps:
|
||||
return "Client GPS Location"//NSLocalizedString("email.address", comment: "Email Address Keyboard")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum MeshMapType: String, CaseIterable, Identifiable {
|
||||
|
||||
case standard = "standard"
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@
|
|||
<entity name="PositionEntity" representedClassName="PositionEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="altitude" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="heading" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="latest" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="latitudeI" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="longitudeI" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="satsInView" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
mapView.mapType = mapViewType
|
||||
mapView.setUserTrackingMode(.none, animated: true)
|
||||
// Other MKMapView Settings
|
||||
mapView.preferredConfiguration.elevationStyle = .realistic
|
||||
mapView.isPitchEnabled = true
|
||||
mapView.isRotateEnabled = true
|
||||
mapView.isScrollEnabled = true
|
||||
|
|
@ -54,6 +55,9 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
mapView.showsUserLocation = true
|
||||
#if targetEnvironment(macCatalyst)
|
||||
mapView.showsZoomControls = true
|
||||
mapView.showsPitchControl = true
|
||||
#else
|
||||
mapView.showsPointsOfInterest = true
|
||||
#endif
|
||||
mapView.delegate = context.coordinator
|
||||
return mapView
|
||||
|
|
@ -144,6 +148,9 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
annotationView.titleVisibility = .adaptive
|
||||
}
|
||||
|
||||
|
||||
//annotationView.tag = -1
|
||||
annotationView.canShowCallout = true
|
||||
annotationView.titleVisibility = .adaptive
|
||||
let leftIcon = UIImageView(image: annotationView.glyphText?.image())
|
||||
leftIcon.backgroundColor = UIColor(.indigo)
|
||||
|
|
@ -155,6 +162,19 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
let distanceFormatter = MKDistanceFormatter()
|
||||
subtitle.text! += "Altitude: \(distanceFormatter.string(fromDistance: Double(positionAnnotation.altitude))) \n"
|
||||
if positionAnnotation.nodePosition?.metadata != nil {
|
||||
|
||||
if DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.client ||
|
||||
DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.clientMute ||
|
||||
DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.routerClient{
|
||||
annotationView.glyphImage = UIImage(systemName: "flipphone")
|
||||
} else if DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.repeater {
|
||||
annotationView.glyphImage = UIImage(systemName: "repeat")
|
||||
} else if DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.router {
|
||||
annotationView.glyphImage = UIImage(systemName: "wifi.router.fill")
|
||||
} else if DeviceRoles(rawValue: Int(positionAnnotation.nodePosition!.metadata?.role ?? 0)) == DeviceRoles.tracker {
|
||||
annotationView.glyphImage = UIImage(systemName: "location.viewfinder")
|
||||
}
|
||||
|
||||
let pf = PositionFlags(rawValue: Int(positionAnnotation.nodePosition?.metadata?.positionFlags ?? 3))
|
||||
if pf.contains(.Satsinview) {
|
||||
subtitle.text! += "Sats in view: \(String(positionAnnotation.satsInView)) \n"
|
||||
|
|
@ -171,11 +191,9 @@ struct MapViewSwiftUI: UIViewRepresentable {
|
|||
|
||||
annotationView.glyphImage = UIImage(systemName: "location.north.fill")?.rotate(radians: Float(degreesToRadians(Double(positionAnnotation.heading))))
|
||||
subtitle.text! += "Heading: \(String(positionAnnotation.heading)) \n"
|
||||
} else {
|
||||
annotationView.glyphText = "📟"
|
||||
}
|
||||
} else {
|
||||
annotationView.glyphText = "📟"
|
||||
annotationView.glyphImage = UIImage(systemName: "flipphone")
|
||||
}
|
||||
subtitle.text! += positionAnnotation.time?.formatted() ?? "Unknown \n"
|
||||
subtitle.numberOfLines = 0
|
||||
|
|
|
|||
|
|
@ -60,14 +60,23 @@ struct AppSettings: View {
|
|||
}
|
||||
}
|
||||
|
||||
Section(header: Text("map options")) {
|
||||
Section(header: Text("global map options")) {
|
||||
|
||||
Picker("map.type", selection: $userSettings.meshMapType) {
|
||||
ForEach(MeshMapType.allCases) { map in
|
||||
Text(map.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Picker("map.type", selection: $userSettings.meshMapType) {
|
||||
ForEach(MeshMapType.allCases) { map in
|
||||
Text(map.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
}
|
||||
|
||||
Section(header: Text("mesh map options")) {
|
||||
Picker("map.centering", selection: $userSettings.meshMapType) {
|
||||
ForEach(CenteringMode.allCases) { cm in
|
||||
Text(cm.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@
|
|||
"lora"="LoRa";
|
||||
"lora.config"="LoRa Einstellungen";
|
||||
"map"="Mesh Karte";
|
||||
"map.centering"="Centering";
|
||||
"map.type"="kartentyp";
|
||||
"mesh.log"="Mesh Log";
|
||||
"mesh.log.bluetooth.config %@"="Bluetooth Konfiguration empfangen: %@";
|
||||
|
|
|
|||
|
|
@ -137,7 +137,8 @@
|
|||
"lora"="LoRa";
|
||||
"lora.config"="LoRa Config";
|
||||
"map"="Mesh Map";
|
||||
"map.type"="Map Type";
|
||||
"map.type"="Default Type";
|
||||
"map.centering"="Centering";
|
||||
"mesh.log"="Mesh Log";
|
||||
"mesh.log.bluetooth.config %@"="Bluetooth config received: %@";
|
||||
"mesh.log.cannedmessage.config %@"="Canned Message module config received: %@";
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@
|
|||
"lora"="LoRa";
|
||||
"lora.config"="LoRa 配置";
|
||||
"map"="Mesh 地图";
|
||||
"map.centering"="Centering";
|
||||
"map.type"="地图类型";
|
||||
"mesh.log"="Mesh 日志";
|
||||
"mesh.log.bluetooth.config %@"="Bluetooth config received: %@";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue