Fix regression that prevented universal links from working
This commit is contained in:
parent
ec6cb1a1b1
commit
530051386f
|
@ -43,7 +43,17 @@ struct Browser {
|
||||||
/// - Note: Some browsers (specifically Chromium-derived ones) will ignore the request
|
/// - Note: Some browsers (specifically Chromium-derived ones) will ignore the request
|
||||||
/// to open in the background.
|
/// to open in the background.
|
||||||
static func open(_ urlString: String, inBackground: Bool) {
|
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 {
|
if let defaultBrowser = defaultBrowser {
|
||||||
defaultBrowser.openURL(url, inBackground: inBackground)
|
defaultBrowser.openURL(url, inBackground: inBackground)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue