From 56bbfe713be8eac4682002e7d2191c48a0b73ede Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 1 Sep 2021 14:13:04 -0500 Subject: [PATCH 1/3] Fix regression that prevented universal links from working --- iOS/Article/WebViewController.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index cba86084f..232d62db1 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -351,8 +351,13 @@ extension WebViewController: WKNavigationDelegate { if AppDefaults.shared.useSystemBrowser { UIApplication.shared.open(url, options: [:]) } else { - let vc = SFSafariViewController(url: url) - self.present(vc, animated: true, completion: nil) + UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { didOpen in + guard didOpen == false else { + return + } + let vc = SFSafariViewController(url: url) + self.present(vc, animated: true) + } } } else if components?.scheme == "mailto" { From ec6cb1a1b10be683457377054bda21e9c196bcdd Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 1 Sep 2021 20:38:30 -0500 Subject: [PATCH 2/3] Update to latest package versions --- .../xcshareddata/swiftpm/Package.resolved | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b58a85312..4117254f5 100644 --- a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Thomvis/BrightFutures.git", "state": { "branch": null, - "revision": "9279defa6bdc21501ce740266e5a14d0119ddc63", - "version": "8.0.1" + "revision": "939858b811026f85e87847a808f0bea2f187e5c4", + "version": "8.1.0" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/tid-kijyun/Kanna.git", "state": { "branch": null, - "revision": "c657fb9f5827ef138068215c76ad0bb62bbc92da", - "version": "5.2.4" + "revision": "f9e4922223dd0d3dfbf02ca70812cf5531fc0593", + "version": "5.2.7" } }, { @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/microsoft/plcrashreporter.git", "state": { "branch": null, - "revision": "de6b8f9db4b2a0aa859a5507550a70548e4da936", - "version": "1.8.1" + "revision": "d747ab5de269cd44022bbe96ff9609d8626694ab", + "version": "1.9.0" } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/Ranchero-Software/RSCore.git", "state": { "branch": null, - "revision": "2a13519b4d91843faa6aff4245b0e387dc64eafe", - "version": "1.0.6" + "revision": "060b12a3d3b6d27d57b2fae84160bfec91ec7118", + "version": "1.0.7" } }, { @@ -96,8 +96,8 @@ "repositoryURL": "https://github.com/Ranchero-Software/RSWeb.git", "state": { "branch": null, - "revision": "2f9ad98736c5c17dfb2be0b3cc06e71a49b061fa", - "version": "1.0.1" + "revision": "2f7849a9ad2cb461b3d6c9c920e163596e6b5d7b", + "version": "1.0.3" } }, { From 530051386fab59dbb6e55a80471909cecc1498b3 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 1 Sep 2021 20:38:50 -0500 Subject: [PATCH 3/3] Fix regression that prevented universal links from working --- Mac/Browser.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Mac/Browser.swift b/Mac/Browser.swift index 5f8b7a0ee..d574bc7ad 100644 --- a/Mac/Browser.swift +++ b/Mac/Browser.swift @@ -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 {