From 54681719fb8e8da1b1d26af4e4baeac1fcc1d12f Mon Sep 17 00:00:00 2001 From: Yannik Bloscheck Date: Sun, 13 Jul 2025 01:19:18 +0200 Subject: [PATCH] [ios] Adding link to delete OSM profile page Signed-off-by: Yannik Bloscheck --- editor/osm_auth.hpp | 4 ++++ iphone/Maps/Model/Profile.swift | 7 ++++++ .../UI/Settings/Profile/ProfileView.swift | 23 ++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/editor/osm_auth.hpp b/editor/osm_auth.hpp index de81dc358..d97c4037f 100644 --- a/editor/osm_auth.hpp +++ b/editor/osm_auth.hpp @@ -111,6 +111,10 @@ public: { return m_baseUrl + "/user/" + user + "/notes"; } + std::string GetDeleteURL() const + { + return m_baseUrl + "/account/deletion"; + } std::string BuildOAuth2Url() const; //@} diff --git a/iphone/Maps/Model/Profile.swift b/iphone/Maps/Model/Profile.swift index 0c2a443a5..c2e03fb44 100644 --- a/iphone/Maps/Model/Profile.swift +++ b/iphone/Maps/Model/Profile.swift @@ -95,6 +95,13 @@ import OSMEditor } + /// The URL for deleting an OpenStreetMap profile + static var deleteUrl: URL { + return URL(string: String(describing: osm.OsmOAuth.ServerAuth().GetDeleteURL()))! + } + + + // MARK: Methods /// Save the authorization token based on a code during the Oauth process diff --git a/iphone/Maps/UI/Settings/Profile/ProfileView.swift b/iphone/Maps/UI/Settings/Profile/ProfileView.swift index 2eafd0804..47f3c61ce 100644 --- a/iphone/Maps/UI/Settings/Profile/ProfileView.swift +++ b/iphone/Maps/UI/Settings/Profile/ProfileView.swift @@ -58,15 +58,32 @@ struct ProfileView: View { .toolbar { ToolbarItem(placement: .destructiveAction) { if !isPresentedAsAlert, Profile.isExisting, !Profile.needsReauthorization { - Button { - Profile.logout() - lastUpdated = Date.now + Menu { + Button { + Profile.logout() + lastUpdated = Date.now + } label: { + if #available(iOS 16, *) { + Label("osm_profile_logout", systemImage: "rectangle.portrait.and.arrow.forward") + } else { + Label("osm_profile_logout", systemImage: "power") + } + } + + Button(role: .destructive) { + openUrl(Profile.deleteUrl) + } label: { + Label("osm_profile_delete", systemImage: "trash") + } } label: { if #available(iOS 16, *) { Label("osm_profile_logout", systemImage: "rectangle.portrait.and.arrow.forward") } else { Label("osm_profile_logout", systemImage: "power") } + } primaryAction: { + Profile.logout() + lastUpdated = Date.now } } }