[ios] Adding link to delete OSM profile page

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-07-13 01:19:18 +02:00
parent 8b3cdbb937
commit 54681719fb
3 changed files with 31 additions and 3 deletions

View File

@@ -111,6 +111,10 @@ public:
{
return m_baseUrl + "/user/" + user + "/notes";
}
std::string GetDeleteURL() const
{
return m_baseUrl + "/account/deletion";
}
std::string BuildOAuth2Url() const;
//@}

View File

@@ -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

View File

@@ -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
}
}
}