mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Adds to the URL-Extensions file
This commit is contained in:
@@ -315,7 +315,7 @@ extension WebViewController: WKNavigationDelegate {
|
||||
} else if components?.scheme == "mailto" {
|
||||
decisionHandler(.cancel)
|
||||
|
||||
guard let emailAddress = URL(string: (url.emailAddress?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed))!) else {
|
||||
guard let emailAddress = url.percentEncodedEmailAddress else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ extension URL {
|
||||
scheme == "mailto" ? URLComponents(url: self, resolvingAgainstBaseURL: false)?.path : nil
|
||||
}
|
||||
|
||||
/// Percent encoded `mailto` URL for use with `canOpenUrl`. If the URL doesn't contain the `mailto` scheme, this is `nil`.
|
||||
var percentEncodedEmailAddress: URL? {
|
||||
scheme == "mailto" ? self.string.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)?.url : nil
|
||||
}
|
||||
|
||||
/// URL pointing to current app version release notes.
|
||||
static var releaseNotes: URL {
|
||||
let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
|
||||
|
||||
@@ -356,7 +356,7 @@ extension WebViewController: WKNavigationDelegate {
|
||||
} else if components?.scheme == "mailto" {
|
||||
decisionHandler(.cancel)
|
||||
|
||||
guard let emailAddress = URL(string: (url.emailAddress?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed))!) else {
|
||||
guard let emailAddress = url.percentEncodedEmailAddress else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user