Handle the feed protocol on iOS. Fixes #2703
This commit is contained in:
parent
00ab05c95a
commit
b8419737cf
|
@ -38,6 +38,7 @@
|
|||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>feed</string>
|
||||
<string>feeds</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
|
|
|
@ -100,12 +100,23 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
|
||||
// Handle Opening of URLs
|
||||
|
||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||
func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) {
|
||||
guard let context = urlContexts.first else { return }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
for context in URLContexts {
|
||||
let urlString = context.url.absoluteString
|
||||
|
||||
// Handle the feed: and feeds: schemes
|
||||
if urlString.starts(with: "feed:") || urlString.starts(with: "feeds:") {
|
||||
let normalizedURLString = urlString.normalizedURL
|
||||
if normalizedURLString.mayBeURL {
|
||||
self.coordinator.showAddWebFeed(initialFeed: normalizedURLString, initialFeedName: nil)
|
||||
}
|
||||
}
|
||||
|
||||
// Show Unread View or Article
|
||||
if context.url.absoluteString.contains(WidgetDeepLink.unread.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: context.url.absoluteString ) else { return }
|
||||
if urlString.contains(WidgetDeepLink.unread.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: urlString ) else { return }
|
||||
let id = comps.queryItems?.first(where: { $0.name == "id" })?.value
|
||||
if id != nil {
|
||||
if AccountManager.shared.isSuspended {
|
||||
|
@ -120,8 +131,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
}
|
||||
|
||||
// Show Today View or Article
|
||||
if context.url.absoluteString.contains(WidgetDeepLink.today.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: context.url.absoluteString ) else { return }
|
||||
if urlString.contains(WidgetDeepLink.today.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: urlString ) else { return }
|
||||
let id = comps.queryItems?.first(where: { $0.name == "id" })?.value
|
||||
if id != nil {
|
||||
if AccountManager.shared.isSuspended {
|
||||
|
@ -136,8 +147,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
}
|
||||
|
||||
// Show Starred View or Article
|
||||
if context.url.absoluteString.contains(WidgetDeepLink.starred.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: context.url.absoluteString ) else { return }
|
||||
if urlString.contains(WidgetDeepLink.starred.url.absoluteString) {
|
||||
guard let comps = URLComponents(string: urlString ) else { return }
|
||||
let id = comps.queryItems?.first(where: { $0.name == "id" })?.value
|
||||
if id != nil {
|
||||
if AccountManager.shared.isSuspended {
|
||||
|
@ -153,7 +164,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue