mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix regression that prevented universal links from working
This commit is contained in:
@@ -43,7 +43,17 @@ struct Browser {
|
||||
/// - Note: Some browsers (specifically Chromium-derived ones) will ignore the request
|
||||
/// to open in the background.
|
||||
static func open(_ urlString: String, inBackground: Bool) {
|
||||
if let url = URL(unicodeString: urlString) {
|
||||
guard let url = URL(unicodeString: urlString), let preparedURL = url.preparedForOpeningInBrowser() else { return }
|
||||
|
||||
let configuration = NSWorkspace.OpenConfiguration()
|
||||
configuration.requiresUniversalLinks = true
|
||||
configuration.promptsUserIfNeeded = false
|
||||
if inBackground {
|
||||
configuration.activates = false
|
||||
}
|
||||
|
||||
NSWorkspace.shared.open(preparedURL, configuration: configuration) { (runningApplication, error) in
|
||||
guard error != nil else { return }
|
||||
if let defaultBrowser = defaultBrowser {
|
||||
defaultBrowser.openURL(url, inBackground: inBackground)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user