Skip to content

Commit

Permalink
Allow copying site address (addresses #15927)
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 14, 2023
1 parent 829b7bd commit 93d026c
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct SiteSettingsView: View {
Section(header: Text(Strings.Sections.general)) {
siteTitleRow
taglineRow
SettingsCell(title: Strings.General.address, value: blog.url ?? "")
addressRow
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}
}

0 comments on commit 93d026c

Please sign in to comment.