From 01e303d74b10b5d34fe6132054c3d1ae08710baa Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 2 Sep 2024 21:35:01 -0700 Subject: [PATCH] Add a button to drop a pin for a waypoints in maps --- Localizable.xcstrings | 3 +++ .../Nodes/Helpers/Map/WaypointForm.swift | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 7298c16e1..fc3ff4480 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -6728,6 +6728,9 @@ }, "Drag & Drop is the recommended way to update firmware for NRF devices. If your iPhone or iPad is USB-C it will work with your regular USB-C charging cable, for lightning devices you need the Apple Lightning to USB camera adaptor." : { + }, + "Drop Pin in Maps" : { + }, "echo" : { "localizations" : { diff --git a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift index 175737455..99b3b12c0 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift @@ -269,10 +269,8 @@ struct WaypointForm: View { .fixedSize(horizontal: false, vertical: true) } icon: { Image(systemName: "doc.plaintext") - .symbolRenderingMode(.hierarchical) - .frame(width: 35) } - .padding(.bottom, 5) + .padding(.bottom) } /// Coordinate Label { @@ -280,11 +278,18 @@ struct WaypointForm: View { .textSelection(.enabled) .foregroundColor(.primary) } icon: { - Image(systemName: "mappin.and.ellipse") - .symbolRenderingMode(.hierarchical) - .frame(width: 35) + Image(systemName: "mappin.circle") } - .padding(.bottom, 5) + .padding(.bottom) + // Drop Maps Pin + Button(action: { + if let url = URL(string: "http://maps.apple.com/?ll=\(waypoint.coordinate.latitude),\(waypoint.coordinate.longitude)&q=\(waypoint.name ?? "Dropped Pin")") { + UIApplication.shared.open(url) + } + }) { + Label("Drop Pin in Maps", systemImage: "mappin.and.ellipse") + } + .padding(.bottom) /// Created Label { Text("Created: \(waypoint.created?.formatted() ?? "?")") @@ -292,9 +297,8 @@ struct WaypointForm: View { } icon: { Image(systemName: "clock.badge.checkmark") .symbolRenderingMode(.hierarchical) - .frame(width: 35) } - .padding(.bottom, 5) + .padding(.bottom) /// Updated if waypoint.lastUpdated != nil { Label { @@ -303,9 +307,8 @@ struct WaypointForm: View { } icon: { Image(systemName: "clock.arrow.circlepath") .symbolRenderingMode(.hierarchical) - .frame(width: 35) } - .padding(.bottom, 5) + .padding(.bottom) } /// Expires if waypoint.expire != nil {