From e095a9cf3f02983e71d21c79ccb0e88810c7d657 Mon Sep 17 00:00:00 2001 From: kean Date: Tue, 13 Jun 2023 11:23:02 -0400 Subject: [PATCH] Allow copying site address (addresses #15927) --- .../ViewRelated/Blog/Settings/SiteSettingsView.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Settings/SiteSettingsView.swift b/WordPress/Classes/ViewRelated/Blog/Settings/SiteSettingsView.swift index 7fbc089cc5b0..011f6b1f14e4 100644 --- a/WordPress/Classes/ViewRelated/Blog/Settings/SiteSettingsView.swift +++ b/WordPress/Classes/ViewRelated/Blog/Settings/SiteSettingsView.swift @@ -50,7 +50,7 @@ struct SiteSettingsView: View { Section(header: Text(Strings.Sections.general)) { siteTitleRow taglineRow - SettingsCell(title: Strings.General.address, value: blog.url ?? "") + addressRow } } @@ -89,6 +89,15 @@ struct SiteSettingsView: View { }) } + private var addressRow: some View { + SettingsCell(title: Strings.General.address, value: blog.url ?? "") + .contextMenu { + Button(Strings.General.copyAddress) { + UIPasteboard.general.url = blog.url.flatMap(URL.init) + } + } + } + // MARK: - Helpers @ViewBuilder @@ -162,6 +171,7 @@ private extension SiteSettingsView { static let taglineEditorPlaceholder = NSLocalizedString("Explain what this site is about.", comment: "Placeholder text for the tagline of a site") static let taglineEditorHint = NSLocalizedString("In a few words, explain what this site is about.", comment: "Explain what is the purpose of the tagline") static let address = NSLocalizedString("Address", comment: "Label for url blog setting") + static let copyAddress = NSLocalizedString("siteSettings.general.copyAddress", value: "Copy Address", comment: "Button title to copy site address") } } }