diff --git a/Intents/AddWebFeedIntentHandler.swift b/Intents/AddWebFeedIntentHandler.swift
deleted file mode 100644
index f87259ea5..000000000
--- a/Intents/AddWebFeedIntentHandler.swift
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// AddWebFeedIntentHandler.swift
-// NetNewsWire
-//
-// Created by Maurice Parker on 10/18/19.
-// Copyright © 2019 Ranchero Software. All rights reserved.
-//
-
-import Intents
-
-public enum AddWebFeedIntentHandlerError: LocalizedError, Sendable {
- case communicationFailure
-
- public var errorDescription: String? {
- switch self {
- case .communicationFailure:
- return NSLocalizedString("Unable to communicate with NetNewsWire.", comment: "Communication failure")
- }
- }
-
-}
-
-public class AddWebFeedIntentHandler: NSObject, AddWebFeedIntentHandling {
-
- override init() {
- super.init()
- }
-
- public func resolveUrl(for intent: AddWebFeedIntent) async -> AddWebFeedUrlResolutionResult {
- guard let url = intent.url else {
- return .unsupported(forReason: .required)
- }
- return .success(with: url)
- }
-
- public func provideAccountNameOptions(for intent: AddWebFeedIntent) async throws -> [String] {
- guard let extensionContainers = await ExtensionContainersFile.read() else {
- throw AddWebFeedIntentHandlerError.communicationFailure
- }
-
- let accountNames = extensionContainers.accounts.map { $0.name }
- return accountNames
- }
-
- public func resolveAccountName(for intent: AddWebFeedIntent) async -> AddWebFeedAccountNameResolutionResult {
- guard let accountName = intent.accountName else {
- return .notRequired()
- }
-
- guard let extensionContainers = await ExtensionContainersFile.read() else {
- return .unsupported(forReason: .communication)
- }
- if extensionContainers.findAccount(forName: accountName) == nil {
- return .unsupported(forReason: .invalid)
- }
-
- return .success(with: accountName)
- }
-
- public func provideFolderNameOptions(for intent: AddWebFeedIntent) async throws -> [String] {
- guard let extensionContainers = await ExtensionContainersFile.read() else {
- throw AddWebFeedIntentHandlerError.communicationFailure
- }
-
- guard let accountName = intent.accountName, let account = extensionContainers.findAccount(forName: accountName) else {
- return [String]()
- }
-
- let folderNames = account.folders.map { $0.name }
- return folderNames
- }
-
- public func resolveFolderName(for intent: AddWebFeedIntent) async -> AddWebFeedFolderNameResolutionResult {
- guard let accountName = intent.accountName, let folderName = intent.folderName else {
- return .notRequired()
- }
-
- guard let extensionContainers = await ExtensionContainersFile.read() else {
- return .unsupported(forReason: .communication)
- }
- guard let account = extensionContainers.findAccount(forName: accountName) else {
- return .unsupported(forReason: .invalid)
- }
-
- let folder = account.findFolder(forName: folderName)
- if folder == nil {
- return .unsupported(forReason: .invalid)
- }
-
- return .success(with: folderName)
- }
-
- public func handle(intent: AddWebFeedIntent) async -> AddWebFeedIntentResponse {
- guard let url = intent.url, let extensionContainers = await ExtensionContainersFile.read() else {
- return AddWebFeedIntentResponse(code: .failure, userActivity: nil)
- }
-
- let account: ExtensionAccount? = {
- if let accountName = intent.accountName {
- return extensionContainers.findAccount(forName: accountName)
- } else {
- return extensionContainers.accounts.first
- }
- }()
-
- guard let validAccount = account else {
- return AddWebFeedIntentResponse(code: .failure, userActivity: nil)
- }
-
- let container: ExtensionContainer? = {
- if let folderName = intent.folderName {
- return validAccount.findFolder(forName: folderName)
- } else {
- return validAccount
- }
- }()
-
- guard let validContainer = container, let containerID = validContainer.containerID else {
- return AddWebFeedIntentResponse(code: .failure, userActivity: nil)
- }
-
- let request = ExtensionFeedAddRequest(name: nil, feedURL: url, destinationContainerID: containerID)
- ExtensionFeedAddRequestFile.save(request)
- return AddWebFeedIntentResponse(code: .success, userActivity: nil)
- }
-}
diff --git a/Intents/Base.lproj/Intents.intentdefinition b/Intents/Base.lproj/Intents.intentdefinition
deleted file mode 100644
index e1969b641..000000000
--- a/Intents/Base.lproj/Intents.intentdefinition
+++ /dev/null
@@ -1,314 +0,0 @@
-
-
-
-
- INEnums
-
- INIntentDefinitionModelVersion
- 1.1
- INIntentDefinitionNamespace
- U6u7RF
- INIntentDefinitionSystemVersion
- 19D76
- INIntentDefinitionToolsBuildVersion
- 11B53
- INIntentDefinitionToolsVersion
- 11.2.1
- INIntents
-
-
- INIntentCategory
- create
- INIntentConfigurable
-
- INIntentDescription
- Add a web feed
- INIntentDescriptionID
- IuAbef
- INIntentIneligibleForSuggestions
-
- INIntentInput
- url
- INIntentKeyParameter
- url
- INIntentLastParameterTag
- 4
- INIntentManagedParameterCombinations
-
- url,accountName
-
- INIntentParameterCombinationSupportsBackgroundExecution
-
- INIntentParameterCombinationTitle
- Add ${url} to ${accountName}
- INIntentParameterCombinationTitleID
- kaKsEY
- INIntentParameterCombinationUpdatesLinked
-
-
- url,accountName,folderName
-
- INIntentParameterCombinationSupportsBackgroundExecution
-
- INIntentParameterCombinationTitle
- Add ${url} to ${folderName} in ${accountName}
- INIntentParameterCombinationTitleID
- dkSFD2
- INIntentParameterCombinationUpdatesLinked
-
-
-
- INIntentName
- AddWebFeed
- INIntentParameters
-
-
- INIntentParameterDisplayName
- URL
- INIntentParameterDisplayNameID
- BCHr23
- INIntentParameterDisplayPriority
- 1
- INIntentParameterName
- url
- INIntentParameterPromptDialogs
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogFormatString
- What is the ${url} you would like add?
- INIntentParameterPromptDialogFormatStringID
- jLLidQ
- INIntentParameterPromptDialogType
- Primary
-
-
- INIntentParameterSupportsResolution
-
- INIntentParameterTag
- 2
- INIntentParameterType
- URL
- INIntentParameterUnsupportedReasons
-
-
- INIntentParameterUnsupportedReasonCode
- required
- INIntentParameterUnsupportedReasonCustom
-
- INIntentParameterUnsupportedReasonFormatString
- You must supply a URL.
- INIntentParameterUnsupportedReasonFormatStringID
- 4xjRes
-
-
-
-
- INIntentParameterCustomDisambiguation
-
- INIntentParameterDisplayName
- Account Name
- INIntentParameterDisplayNameID
- CSrgUY
- INIntentParameterDisplayPriority
- 2
- INIntentParameterMetadata
-
- INIntentParameterMetadataCapitalization
- Sentences
-
- INIntentParameterName
- accountName
- INIntentParameterPromptDialogs
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogType
- Primary
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogFormatString
- There are ${count} options matching ‘${accountName}’.
- INIntentParameterPromptDialogFormatStringID
- IbqUVS
- INIntentParameterPromptDialogType
- DisambiguationIntroduction
-
-
- INIntentParameterPromptDialogFormatString
- Which one?
- INIntentParameterPromptDialogFormatStringID
- fWs3li
- INIntentParameterPromptDialogType
- DisambiguationSelection
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogFormatString
- Just to confirm, you wanted ‘${accountName}’?
- INIntentParameterPromptDialogFormatStringID
- HHiZUh
- INIntentParameterPromptDialogType
- Confirmation
-
-
- INIntentParameterSupportsDynamicEnumeration
-
- INIntentParameterSupportsResolution
-
- INIntentParameterTag
- 3
- INIntentParameterType
- String
- INIntentParameterUnsupportedReasons
-
-
- INIntentParameterUnsupportedReasonCode
- invalid
- INIntentParameterUnsupportedReasonCustom
-
- INIntentParameterUnsupportedReasonFormatString
- A valid Account Name is required.
- INIntentParameterUnsupportedReasonFormatStringID
- JGkCuS
-
-
- INIntentParameterUnsupportedReasonCode
- communication
- INIntentParameterUnsupportedReasonCustom
-
- INIntentParameterUnsupportedReasonFormatString
- Unable to communicate with NetNewsWire.
- INIntentParameterUnsupportedReasonFormatStringID
- uSfloN
-
-
-
-
- INIntentParameterCustomDisambiguation
-
- INIntentParameterDisplayName
- Folder Name
- INIntentParameterDisplayNameID
- zXhMPF
- INIntentParameterDisplayPriority
- 3
- INIntentParameterMetadata
-
- INIntentParameterMetadataCapitalization
- Sentences
-
- INIntentParameterName
- folderName
- INIntentParameterPromptDialogs
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogType
- Primary
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogFormatString
- There are ${count} options matching ‘${folderName}’.
- INIntentParameterPromptDialogFormatStringID
- 5CYbGL
- INIntentParameterPromptDialogType
- DisambiguationIntroduction
-
-
- INIntentParameterPromptDialogFormatString
- Which one?
- INIntentParameterPromptDialogFormatStringID
- gEzXaM
- INIntentParameterPromptDialogType
- DisambiguationSelection
-
-
- INIntentParameterPromptDialogCustom
-
- INIntentParameterPromptDialogFormatString
- Just to confirm, you wanted ‘${folderName}’?
- INIntentParameterPromptDialogFormatStringID
- k5GTo0
- INIntentParameterPromptDialogType
- Confirmation
-
-
- INIntentParameterRelationship
-
- INIntentParameterRelationshipParentName
- accountName
- INIntentParameterRelationshipPredicateName
- HasAnyValue
-
- INIntentParameterSupportsDynamicEnumeration
-
- INIntentParameterSupportsResolution
-
- INIntentParameterTag
- 4
- INIntentParameterType
- String
- INIntentParameterUnsupportedReasons
-
-
- INIntentParameterUnsupportedReasonCode
- invalid
- INIntentParameterUnsupportedReasonCustom
-
- INIntentParameterUnsupportedReasonFormatString
- A valid Folder Name is required.
- INIntentParameterUnsupportedReasonFormatStringID
- ef5kBt
-
-
- INIntentParameterUnsupportedReasonCode
- communication
- INIntentParameterUnsupportedReasonCustom
-
- INIntentParameterUnsupportedReasonFormatString
- Unable to communicate with NetNewsWire.
- INIntentParameterUnsupportedReasonFormatStringID
- ExjqcE
-
-
-
-
- INIntentResponse
-
- INIntentResponseCodes
-
-
- INIntentResponseCodeName
- success
- INIntentResponseCodeSuccess
-
-
-
- INIntentResponseCodeName
- failure
-
-
-
- INIntentTitle
- Add Web Feed
- INIntentTitleID
- oV681v
- INIntentType
- Custom
- INIntentVerb
- Add
-
-
- INTypes
-
-
-
diff --git a/Intents/en.lproj/Intents.strings b/Intents/en.lproj/Intents.strings
deleted file mode 100644
index 187512780..000000000
--- a/Intents/en.lproj/Intents.strings
+++ /dev/null
@@ -1,30 +0,0 @@
-"4xjRes" = "You must supply a URL.";
-
-"8Dh9Yy" = "No feed was found at the specified URL.";
-
-"BCHr23" = "URL";
-
-"CSrgUY" = "Account Name";
-
-"HHiZUh" = "Just to confirm, you wanted ‘${accountName}’?";
-
-"IbqUVS" = "There are ${count} options matching ‘${accountName}’.";
-
-"IuAbef" = "Add a feed";
-
-"JGkCuS" = "An account name is required.";
-
-"UGGPkp" = "You are already subscribed to this feed in this account.";
-
-"dkSFD2" = "Add${url}to ${accountName}";
-
-"drQfaI" = "No feed was found at the specified URL.";
-
-"fWs3li" = "Which one?";
-
-"jLLidQ" = "What is the ${url}you would like add?";
-
-"oV681v" = "Add Feed";
-
-"srME8b" = "You are already subscribed to this feed in this account.";
-
diff --git a/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift b/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift
index af8b20be0..f8f5c8b86 100644
--- a/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift
+++ b/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift
@@ -40,6 +40,13 @@ public struct FeedSpecifier: Hashable, Sendable {
return FeedSpecifier(title: "writing - rachelbythebay", urlString: feedURLString, source: .userEntered, orderFound: 0)
}
+ // The blog page only advertises the master podcast feed in its
, so the finder would
+ // otherwise miss the blog feed.
+ if url.isRelayFMBlogURL {
+ let feedURLString = "https://www.relay.fm/blog/feed"
+ return FeedSpecifier(title: "Relay FM Blog", urlString: feedURLString, source: .userEntered, orderFound: 0)
+ }
+
return nil
}
diff --git a/Modules/FeedFinder/Tests/FeedFinderTests/FeedFinderTests.swift b/Modules/FeedFinder/Tests/FeedFinderTests/FeedFinderTests.swift
index 8d43fc7e8..3e503a19c 100644
--- a/Modules/FeedFinder/Tests/FeedFinderTests/FeedFinderTests.swift
+++ b/Modules/FeedFinder/Tests/FeedFinderTests/FeedFinderTests.swift
@@ -15,4 +15,13 @@ final class FeedFinderTests: XCTestCase {
let feedFinder = FeedFinder()
XCTAssertNotNil(feedFinder)
}
+
+ func testKnownFeedSpecifierForRelayFMBlog() throws {
+ let specifier = FeedSpecifier.knownFeedSpecifier(url: URL(string: "https://www.relay.fm/blog")!)
+ XCTAssertEqual(specifier?.urlString, "https://www.relay.fm/blog/feed")
+ }
+
+ func testKnownFeedSpecifierIgnoresRelayFMRoot() throws {
+ XCTAssertNil(FeedSpecifier.knownFeedSpecifier(url: URL(string: "https://www.relay.fm")!))
+ }
}
diff --git a/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift b/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift
index 304b532fe..0aae2aaa2 100644
--- a/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift
+++ b/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift
@@ -15,6 +15,7 @@ nonisolated public struct SpecialCase {
public static let openRSSOrgHostName = "openrss.org"
public static let youtubeHostName = "youtube.com"
public static let redditHostName = "reddit.com"
+ public static let relayFMHostName = "relay.fm"
public static func urlStringContainSpecialCase(_ urlString: String, _ specialCases: [String]) -> Bool {
let lowerURLString = urlString.lowercased(with: localeForLowercasing)
@@ -84,6 +85,16 @@ nonisolated extension URL {
public var isRedditURL: Bool {
SpecialCase.urlStringMatchesDomain(absoluteString, [SpecialCase.redditHostName])
}
+
+ /// The Relay FM blog, specifically — not the whole relay.fm domain (its root advertises the master
+ /// podcast feed). Matches the /blog index and /blog/ pages.
+ public var isRelayFMBlogURL: Bool {
+ guard SpecialCase.urlStringMatchesDomain(absoluteString, [SpecialCase.relayFMHostName]) else {
+ return false
+ }
+ let path = path()
+ return path == "/blog" || path.hasPrefix("/blog/")
+ }
}
nonisolated extension Set where Element == URL {
diff --git a/Modules/RSWeb/Tests/RSWebTests/SpecialCasesTests.swift b/Modules/RSWeb/Tests/RSWebTests/SpecialCasesTests.swift
index c0e5bd3ae..c1086d512 100644
--- a/Modules/RSWeb/Tests/RSWebTests/SpecialCasesTests.swift
+++ b/Modules/RSWeb/Tests/RSWebTests/SpecialCasesTests.swift
@@ -23,4 +23,18 @@ struct SpecialCasesTests {
#expect(!URL(string: "https://reddit.com.evil.example/feed")!.isRedditURL)
#expect(!URL(string: "https://example.com/r/reddit.com")!.isRedditURL)
}
+
+ @Test func isRelayFMBlogURLMatchesBlog() {
+ #expect(URL(string: "https://www.relay.fm/blog")!.isRelayFMBlogURL)
+ #expect(URL(string: "http://relay.fm/blog")!.isRelayFMBlogURL)
+ #expect(URL(string: "https://www.relay.fm/blog/")!.isRelayFMBlogURL)
+ #expect(URL(string: "https://www.relay.fm/blog/some-post")!.isRelayFMBlogURL)
+ }
+
+ @Test func isRelayFMBlogURLRejectsNonBlog() {
+ #expect(!URL(string: "https://relay.fm")!.isRelayFMBlogURL) // root → master feed
+ #expect(!URL(string: "http://relay.fm/master/feed")!.isRelayFMBlogURL)
+ #expect(!URL(string: "https://www.relay.fm/blogsomething")!.isRelayFMBlogURL)
+ #expect(!URL(string: "https://relay.fm.evil.example/blog")!.isRelayFMBlogURL) // host check
+ }
}
diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj
index fd472c0a7..dbc57a42e 100644
--- a/NetNewsWire.xcodeproj/project.pbxproj
+++ b/NetNewsWire.xcodeproj/project.pbxproj
@@ -12,14 +12,10 @@
179C39EA26F76B0500D4E741 /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = 179C39E926F76B0500D4E741 /* Zip */; };
179D280B26F6F93D003B2E0A /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = 179D280A26F6F93D003B2E0A /* Zip */; };
27692BB9F5D9450894A7EDA4 /* ErrorLog in Frameworks */ = {isa = PBXBuildFile; productRef = C1939AC39272487C923003B8 /* ErrorLog */; };
- 27B86EEB25A53AAB00264340 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; };
4679674625E599C100844E8D /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 4679674525E599C100844E8D /* Articles */; };
4679674725E599C100844E8D /* Articles in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 4679674525E599C100844E8D /* Articles */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
510C416924E5CDE3008226FD /* NetNewsWire Share Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
511B148924E5DBDD00C919BD /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 511B148824E5DBDD00C919BD /* Account */; };
- 5131463E235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 51314637235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
- 513146B3235A81A400387FDC /* AddWebFeedIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513146B1235A81A400387FDC /* AddWebFeedIntentHandler.swift */; };
- 51314705235C41FC00387FDC /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 51314707235C41FC00387FDC /* Intents.intentdefinition */; };
513277442590FBB60064F1E7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 514C16CD24D2E63F009A3AFA /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
5132775E2590FC640064F1E7 /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 5132775D2590FC640064F1E7 /* Articles */; };
5132775F2590FC640064F1E7 /* Articles in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 5132775D2590FC640064F1E7 /* Articles */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
@@ -63,7 +59,6 @@
848E84D52DB749670023F3BA /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 848E84D42DB749670023F3BA /* RSCore */; };
848E84D62DB749670023F3BA /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 848E84D42DB749670023F3BA /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
848E84D82DB749720023F3BA /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 848E84D72DB749720023F3BA /* RSCore */; };
- 848E84DB2DB749860023F3BA /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 848E84DA2DB749860023F3BA /* RSCore */; };
848E84DF2DB749A40023F3BA /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 848E84DE2DB749A40023F3BA /* RSCore */; };
849182CC2FD32B1B005C3020 /* Appanoose.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 849182BB2FD32B1B005C3010 /* Appanoose.nnwtheme */; };
849182CC2FD32B1B005C3021 /* Biblioteca.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = 849182BB2FD32B1B005C3011 /* Biblioteca.nnwtheme */; };
@@ -86,7 +81,6 @@
84EE3F152DB8A0A0009D3A8D /* RSTree in Frameworks */ = {isa = PBXBuildFile; productRef = 84EE3F142DB8A0A0009D3A8D /* RSTree */; };
84EE3F162DB8A0A0009D3A8D /* RSTree in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 84EE3F142DB8A0A0009D3A8D /* RSTree */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
84EE3F182DB8A0AC009D3A8D /* RSTree in Frameworks */ = {isa = PBXBuildFile; productRef = 84EE3F172DB8A0AC009D3A8D /* RSTree */; };
- 84EE3F1B2DB8A0B6009D3A8D /* RSTree in Frameworks */ = {isa = PBXBuildFile; productRef = 84EE3F1A2DB8A0B6009D3A8D /* RSTree */; };
84EE43482DB8A441009D3A8D /* RSDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 84EE43472DB8A441009D3A8D /* RSDatabase */; };
84EE43492DB8A441009D3A8D /* RSDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 84EE43472DB8A441009D3A8D /* RSDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
84EE434B2DB8A44C009D3A8D /* RSDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 84EE434A2DB8A44C009D3A8D /* RSDatabase */; };
@@ -124,13 +118,6 @@
remoteGlobalIDString = 510C415B24E5CDE3008226FD;
remoteInfo = ShareExtension;
};
- 5131463C235A7BBE00387FDC /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 849C64581ED37A5D003D8FC0 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 51314636235A7BBE00387FDC;
- remoteInfo = "NetNewsWire iOS Intents Extension";
- };
5138E94224D3404300AFF0FE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 849C64581ED37A5D003D8FC0 /* Project object */;
@@ -194,16 +181,6 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
- 5102AE7724D17FB50050839C /* Embed Frameworks */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = "";
- dstSubfolderSpec = 10;
- files = (
- );
- name = "Embed Frameworks";
- runOnlyForDeploymentPostprocessing = 0;
- };
513277512590FC000064F1E7 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -222,7 +199,6 @@
files = (
513C5CF0232571C2003D4054 /* NetNewsWire iOS Share Extension.appex in Embed Foundation Extensions */,
176814002564BB2D00D98635 /* NetNewsWire iOS Widget Extension.appex in Embed Foundation Extensions */,
- 5131463E235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
@@ -311,10 +287,6 @@
/* Begin PBXFileReference section */
176813F32564BB2C00D98635 /* NetNewsWire iOS Widget Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire iOS Widget Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
- 51314637235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire iOS Intents Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
- 513146B1235A81A400387FDC /* AddWebFeedIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedIntentHandler.swift; sourceTree = ""; };
- 51314706235C41FC00387FDC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = ""; };
- 51314714235C420900387FDC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = ""; };
513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire iOS Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
518B2ED22351B3DD00400001 /* NetNewsWire-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "NetNewsWire-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
6581C73320CED60000F4AD34 /* Subscribe to Feed.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Subscribe to Feed.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -407,8 +379,6 @@
84A6D03F2D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
- IntentsExtension/Info.plist,
- IntentsExtension/IntentHandler.swift,
Resources/Info.plist,
ShareExtension/Info.plist,
ShareExtension/ShareFolderPickerAccountCell.xib,
@@ -432,13 +402,6 @@
);
target = 513C5CE5232571C2003D4054 /* NetNewsWire iOS Share Extension */;
};
- 84A6D0412D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
- isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
- membershipExceptions = (
- IntentsExtension/IntentHandler.swift,
- );
- target = 51314636235A7BBE00387FDC /* NetNewsWire iOS Intents Extension */;
- };
84D35E0A2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
@@ -480,16 +443,6 @@
);
target = 513C5CE5232571C2003D4054 /* NetNewsWire iOS Share Extension */;
};
- 84D35E0D2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
- isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
- membershipExceptions = (
- ShareExtension/ExtensionContainers.swift,
- ShareExtension/ExtensionContainersFile.swift,
- ShareExtension/ExtensionFeedAddRequest.swift,
- ShareExtension/ExtensionFeedAddRequestFile.swift,
- );
- target = 51314636235A7BBE00387FDC /* NetNewsWire iOS Intents Extension */;
- };
84D35E0E2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
@@ -548,9 +501,9 @@
8448F1F62D1E36BF0048BA50 /* Widget */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (8448F2052D1E36BF0048BA50 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Widget; sourceTree = ""; };
84719F0E2DB9C52B00EEF332 /* Tests */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84719F272DB9C52B00EEF332 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Tests; sourceTree = ""; };
84719F372DB9C60400EEF332 /* xcconfig */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84719F392DB9C60500EEF332 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (common, ); path = xcconfig; sourceTree = ""; };
- 84A6CFB52D1B4EC500F23315 /* iOS */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84A6D03F2D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84A6D0402D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84A6D0412D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = iOS; sourceTree = ""; };
+ 84A6CFB52D1B4EC500F23315 /* iOS */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84A6D03F2D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84A6D0402D1B4EC500F23315 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = iOS; sourceTree = ""; };
84CB35042DB9B5E2002AC251 /* Modules */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Modules; sourceTree = ""; };
- 84D35D422DB9F32D004AA60E /* Shared */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84D35E0A2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0B2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0C2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0D2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0E2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0F2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Shared; sourceTree = ""; };
+ 84D35D422DB9F32D004AA60E /* Shared */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (84D35E0A2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0B2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0C2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0E2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 84D35E0F2DB9F32D004AA60E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Shared; sourceTree = ""; };
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
@@ -571,16 +524,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- 51314634235A7BBE00387FDC /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 27B86EEB25A53AAB00264340 /* Account in Frameworks */,
- 848E84DB2DB749860023F3BA /* RSCore in Frameworks */,
- 84EE3F1B2DB8A0B6009D3A8D /* RSTree in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
513C5CE3232571C2003D4054 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -666,15 +609,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 513145F9235A55A700387FDC /* Intents */ = {
- isa = PBXGroup;
- children = (
- 51314707235C41FC00387FDC /* Intents.intentdefinition */,
- 513146B1235A81A400387FDC /* AddWebFeedIntentHandler.swift */,
- );
- path = Intents;
- sourceTree = "";
- };
84023C9D2FC7E3B800284625 /* Recovered References */ = {
isa = PBXGroup;
children = (
@@ -711,7 +645,6 @@
840A1F092E41337800CFCCFC /* Technotes */,
842E249F2DB9F9B800FF7DD8 /* Mac */,
84A6CFB52D1B4EC500F23315 /* iOS */,
- 513145F9235A55A700387FDC /* Intents */,
8448F1F62D1E36BF0048BA50 /* Widget */,
84D35D422DB9F32D004AA60E /* Shared */,
849182072FD32B1B005C3150 /* Themes */,
@@ -733,7 +666,6 @@
6581C73320CED60000F4AD34 /* Subscribe to Feed.appex */,
513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */,
518B2ED22351B3DD00400001 /* NetNewsWire-iOSTests.xctest */,
- 51314637235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex */,
510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */,
176813F32564BB2C00D98635 /* NetNewsWire iOS Widget Extension.appex */,
);
@@ -790,30 +722,6 @@
productReference = 510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */;
productType = "com.apple.product-type.app-extension";
};
- 51314636235A7BBE00387FDC /* NetNewsWire iOS Intents Extension */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 5131463F235A7BBE00387FDC /* Build configuration list for PBXNativeTarget "NetNewsWire iOS Intents Extension" */;
- buildPhases = (
- 51314633235A7BBE00387FDC /* Sources */,
- 51314634235A7BBE00387FDC /* Frameworks */,
- 51314635235A7BBE00387FDC /* Resources */,
- 5102AE7724D17FB50050839C /* Embed Frameworks */,
- 513F328A2593EFCE0003048F /* Delete Unnecessary Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = "NetNewsWire iOS Intents Extension";
- packageProductDependencies = (
- 51BC2F4A24D343A500E90810 /* Account */,
- 848E84DA2DB749860023F3BA /* RSCore */,
- 84EE3F1A2DB8A0B6009D3A8D /* RSTree */,
- );
- productName = "NetNewsWire iOS Intents Extension";
- productReference = 51314637235A7BBE00387FDC /* NetNewsWire iOS Intents Extension.appex */;
- productType = "com.apple.product-type.app-extension";
- };
513C5CE5232571C2003D4054 /* NetNewsWire iOS Share Extension */ = {
isa = PBXNativeTarget;
buildConfigurationList = 513C5CFC232571C2003D4054 /* Build configuration list for PBXNativeTarget "NetNewsWire iOS Share Extension" */;
@@ -889,7 +797,6 @@
);
dependencies = (
5138E94324D3404300AFF0FE /* PBXTargetDependency */,
- 5131463D235A7BBE00387FDC /* PBXTargetDependency */,
176813FF2564BB2D00D98635 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
@@ -1012,12 +919,6 @@
510C415B24E5CDE3008226FD = {
CreatedOnToolsVersion = 12.0;
};
- 51314636235A7BBE00387FDC = {
- CreatedOnToolsVersion = 11.2;
- DevelopmentTeam = SHJK2V3AJG;
- LastSwiftMigration = 1120;
- ProvisioningStyle = Automatic;
- };
513C5CE5232571C2003D4054 = {
CreatedOnToolsVersion = 11.0;
DevelopmentTeam = SHJK2V3AJG;
@@ -1087,7 +988,6 @@
840D617B2029031C009BC708 /* NetNewsWire-iOS */,
6581C73220CED60000F4AD34 /* Subscribe to Feed */,
513C5CE5232571C2003D4054 /* NetNewsWire iOS Share Extension */,
- 51314636235A7BBE00387FDC /* NetNewsWire iOS Intents Extension */,
176813F22564BB2C00D98635 /* NetNewsWire iOS Widget Extension */,
518B2ED12351B3DD00400001 /* NetNewsWire-iOSTests */,
510C415B24E5CDE3008226FD /* NetNewsWire Share Extension */,
@@ -1110,13 +1010,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- 51314635235A7BBE00387FDC /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
513C5CE4232571C2003D4054 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1178,25 +1071,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 513F328A2593EFCE0003048F /* Delete Unnecessary Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- alwaysOutOfDate = 1;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- );
- inputPaths = (
- );
- name = "Delete Unnecessary Frameworks";
- outputFileListPaths = (
- );
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "if [ \"${CONFIGURATION}\" = \"Release\" ]; then\n# Delete the framework that Xcode should have never included\n# https://forums.swift.org/t/is-this-an-xcode-bug-or-somehow-related-to-spm/33987\nrm -rf \"${TARGET_BUILD_DIR}/NetNewsWire iOS Intents Extension.appex/Frameworks\"\nfi\n";
- };
513F328B2593F03F0003048F /* Delete Unnecessary Frameworks */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -1343,15 +1217,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- 51314633235A7BBE00387FDC /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 513146B3235A81A400387FDC /* AddWebFeedIntentHandler.swift in Sources */,
- 51314705235C41FC00387FDC /* Intents.intentdefinition in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
513C5CE2232571C2003D4054 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1408,11 +1273,6 @@
target = 510C415B24E5CDE3008226FD /* NetNewsWire Share Extension */;
targetProxy = 510C416724E5CDE3008226FD /* PBXContainerItemProxy */;
};
- 5131463D235A7BBE00387FDC /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 51314636235A7BBE00387FDC /* NetNewsWire iOS Intents Extension */;
- targetProxy = 5131463C235A7BBE00387FDC /* PBXContainerItemProxy */;
- };
5138E94324D3404300AFF0FE /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 513C5CE5232571C2003D4054 /* NetNewsWire iOS Share Extension */;
@@ -1435,18 +1295,6 @@
};
/* End PBXTargetDependency section */
-/* Begin PBXVariantGroup section */
- 51314707235C41FC00387FDC /* Intents.intentdefinition */ = {
- isa = PBXVariantGroup;
- children = (
- 51314706235C41FC00387FDC /* Base */,
- 51314714235C420900387FDC /* en */,
- );
- name = Intents.intentdefinition;
- sourceTree = "";
- };
-/* End PBXVariantGroup section */
-
/* Begin XCBuildConfiguration section */
176814022564BB2D00D98635 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -1480,22 +1328,6 @@
};
name = Release;
};
- 51314640235A7BBE00387FDC /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReferenceAnchor = 84719F372DB9C60400EEF332 /* xcconfig */;
- baseConfigurationReferenceRelativePath = NetNewsWire_iOSintentextension_target.xcconfig;
- buildSettings = {
- };
- name = Debug;
- };
- 51314642235A7BBE00387FDC /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReferenceAnchor = 84719F372DB9C60400EEF332 /* xcconfig */;
- baseConfigurationReferenceRelativePath = NetNewsWire_iOSintentextension_target.xcconfig;
- buildSettings = {
- };
- name = Release;
- };
513C5CF2232571C2003D4054 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReferenceAnchor = 84719F372DB9C60400EEF332 /* xcconfig */;
@@ -1629,15 +1461,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 5131463F235A7BBE00387FDC /* Build configuration list for PBXNativeTarget "NetNewsWire iOS Intents Extension" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 51314640235A7BBE00387FDC /* Debug */,
- 51314642235A7BBE00387FDC /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
513C5CFC232571C2003D4054 /* Build configuration list for PBXNativeTarget "NetNewsWire iOS Share Extension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -1799,10 +1622,6 @@
isa = XCSwiftPackageProductDependency;
productName = Account;
};
- 51BC2F4A24D343A500E90810 /* Account */ = {
- isa = XCSwiftPackageProductDependency;
- productName = Account;
- };
51C4CFF524D37DD500AF9874 /* Secrets */ = {
isa = XCSwiftPackageProductDependency;
productName = Secrets;
@@ -1851,10 +1670,6 @@
isa = XCSwiftPackageProductDependency;
productName = RSCore;
};
- 848E84DA2DB749860023F3BA /* RSCore */ = {
- isa = XCSwiftPackageProductDependency;
- productName = RSCore;
- };
848E84DE2DB749A40023F3BA /* RSCore */ = {
isa = XCSwiftPackageProductDependency;
productName = RSCore;
@@ -1871,10 +1686,6 @@
isa = XCSwiftPackageProductDependency;
productName = RSTree;
};
- 84EE3F1A2DB8A0B6009D3A8D /* RSTree */ = {
- isa = XCSwiftPackageProductDependency;
- productName = RSTree;
- };
84EE43472DB8A441009D3A8D /* RSDatabase */ = {
isa = XCSwiftPackageProductDependency;
productName = RSDatabase;
diff --git a/iOS/AppIntents/AddFeedAppIntent.swift b/iOS/AppIntents/AddFeedAppIntent.swift
new file mode 100644
index 000000000..cebac627f
--- /dev/null
+++ b/iOS/AppIntents/AddFeedAppIntent.swift
@@ -0,0 +1,122 @@
+//
+// AddFeedAppIntent.swift
+// NetNewsWire-iOS
+//
+// Modern App Intents replacement for the legacy SiriKit "Add Feed" intent.
+//
+//
+
+import Foundation
+import AppIntents
+
+struct AddFeedAppIntent: AppIntent {
+
+ static let title: LocalizedStringResource = "Add Feed"
+ static let description = IntentDescription("Adds a feed to NetNewsWire.")
+
+ // Runs in the background: like the Share Extension, this only enqueues a request into the
+ // app group; the main app turns it into an actual feed the next time it processes the queue.
+ static let openAppWhenRun = false
+
+ @Parameter(title: "URL")
+ var url: URL
+
+ @Parameter(title: "Account", optionsProvider: AccountNameOptionsProvider())
+ var accountName: String?
+
+ @Parameter(title: "Folder", optionsProvider: FolderNameOptionsProvider())
+ var folderName: String?
+
+ static var parameterSummary: some ParameterSummary {
+ Summary("Add \(\.$url) to \(\.$accountName)") {
+ \.$folderName
+ }
+ }
+
+ func perform() async throws -> some IntentResult & ProvidesDialog {
+ guard let extensionContainers = await ExtensionContainersFile.read() else {
+ throw AddFeedAppIntentError.noAccounts
+ }
+
+ let account: ExtensionAccount?
+ if let accountName {
+ account = extensionContainers.findAccount(forName: accountName)
+ } else {
+ account = extensionContainers.accounts.first
+ }
+ guard let account else {
+ throw AddFeedAppIntentError.noAccounts
+ }
+
+ // Resolve the destination container: the named folder if it exists in this account;
+ // otherwise the account itself — but substitute its first folder when the account
+ // disallows feeds at the root (mirrors AddFeedDefaultContainer.substituteContainerIfNeeded).
+ // Not hard-failing on an unknown folder name also covers cross-account name mismatches.
+ let container: ExtensionContainer
+ if let folderName, let folder = account.findFolder(forName: folderName) {
+ container = folder
+ } else if account.disallowFeedInRootFolder, let firstFolder = account.folders.first {
+ container = firstFolder
+ } else {
+ container = account
+ }
+
+ guard let containerID = container.containerID else {
+ throw AddFeedAppIntentError.noContainer
+ }
+
+ let request = ExtensionFeedAddRequest(name: nil, feedURL: url, destinationContainerID: containerID)
+ ExtensionFeedAddRequestFile.save(request)
+
+ // Neutral wording: the feed is queued here and actually created when the app next runs.
+ return .result(dialog: "Adding \(url.absoluteString) to NetNewsWire.")
+ }
+}
+
+enum AddFeedAppIntentError: Error, CustomLocalizedStringResourceConvertible {
+ case noAccounts
+ case noContainer
+
+ var localizedStringResource: LocalizedStringResource {
+ switch self {
+ case .noAccounts:
+ return "There are no accounts to add the feed to."
+ case .noContainer:
+ return "Couldn’t find a place to add the feed."
+ }
+ }
+}
+
+struct AccountNameOptionsProvider: DynamicOptionsProvider {
+ func results() async throws -> [String] {
+ guard let extensionContainers = await ExtensionContainersFile.read() else {
+ return []
+ }
+ return extensionContainers.accounts.map { $0.name }
+ }
+}
+
+struct FolderNameOptionsProvider: DynamicOptionsProvider {
+
+ // Scope folder options to the account the user picked (falls back to all accounts' folders
+ // when no account is chosen yet).
+ @IntentParameterDependency(\.$accountName)
+ var addFeedIntent
+
+ func results() async throws -> [String] {
+ guard let extensionContainers = await ExtensionContainersFile.read() else {
+ return []
+ }
+
+ let accounts: [ExtensionAccount]
+ if let accountName = addFeedIntent?.accountName, let account = extensionContainers.findAccount(forName: accountName) {
+ accounts = [account]
+ } else {
+ accounts = extensionContainers.accounts
+ }
+
+ // Dedupe: folder names can repeat across accounts when unscoped.
+ var seen = Set()
+ return accounts.flatMap { $0.folders.map { $0.name } }.filter { seen.insert($0).inserted }
+ }
+}
diff --git a/iOS/AppIntents/NetNewsWireAppShortcuts.swift b/iOS/AppIntents/NetNewsWireAppShortcuts.swift
new file mode 100644
index 000000000..eec6d2dd4
--- /dev/null
+++ b/iOS/AppIntents/NetNewsWireAppShortcuts.swift
@@ -0,0 +1,24 @@
+//
+// NetNewsWireAppShortcuts.swift
+// NetNewsWire-iOS
+//
+// Makes App Intents available in the Shortcuts app / Spotlight / Siri with no user setup.
+//
+//
+
+import AppIntents
+
+struct NetNewsWireAppShortcuts: AppShortcutsProvider {
+
+ static var appShortcuts: [AppShortcut] {
+ AppShortcut(
+ intent: AddFeedAppIntent(),
+ phrases: [
+ "Add a feed to \(.applicationName)",
+ "Add feed in \(.applicationName)"
+ ],
+ shortTitle: "Add Feed",
+ systemImageName: "plus"
+ )
+ }
+}
diff --git a/iOS/IntentsExtension/Info.plist b/iOS/IntentsExtension/Info.plist
deleted file mode 100644
index 3b75a62cc..000000000
--- a/iOS/IntentsExtension/Info.plist
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
- OrganizationIdentifier
- $(ORGANIZATION_IDENTIFIER)
- AppGroup
- $(APP_GROUP_ID)
- AppIdentifierPrefix
- $(AppIdentifierPrefix)
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleDisplayName
- NetNewsWire iOS Intents Extension
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- $(MARKETING_VERSION)
- CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
- NSExtension
-
- NSExtensionAttributes
-
- IntentsRestrictedWhileLocked
-
- IntentsRestrictedWhileProtectedDataUnavailable
-
- IntentsSupported
-
- AddWebFeedIntent
-
-
- NSExtensionPointIdentifier
- com.apple.intents-service
- NSExtensionPrincipalClass
- $(PRODUCT_MODULE_NAME).IntentHandler
-
-
-
diff --git a/iOS/IntentsExtension/IntentHandler.swift b/iOS/IntentsExtension/IntentHandler.swift
deleted file mode 100644
index 5e5e20ebc..000000000
--- a/iOS/IntentsExtension/IntentHandler.swift
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// IntentHandler.swift
-// NetNewsWire iOS Intents Extension
-//
-// Created by Maurice Parker on 10/18/19.
-// Copyright © 2019 Ranchero Software. All rights reserved.
-//
-
-import Intents
-
-final class IntentHandler: INExtension {
-
- override func handler(for intent: INIntent) -> Any {
- switch intent {
- case is AddWebFeedIntent:
- return AddWebFeedIntentHandler()
- default:
- fatalError("Unhandled intent type: \(intent)")
- }
- }
-
-}
diff --git a/iOS/IntentsExtension/NetNewsWire_iOS_IntentsExtension.entitlements b/iOS/IntentsExtension/NetNewsWire_iOS_IntentsExtension.entitlements
deleted file mode 100644
index 54049ed3b..000000000
--- a/iOS/IntentsExtension/NetNewsWire_iOS_IntentsExtension.entitlements
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- com.apple.security.application-groups
-
- $(APP_GROUP_ID)
-
- keychain-access-groups
-
- $(AppIdentifierPrefix)$(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS$(BUNDLE_ID_SUFFIX)
-
-
-
diff --git a/iOS/Resources/Info.plist b/iOS/Resources/Info.plist
index 7eed09d23..d3a7aaddb 100644
--- a/iOS/Resources/Info.plist
+++ b/iOS/Resources/Info.plist
@@ -70,7 +70,6 @@
Grant permission to save images from the article.
NSUserActivityTypes
- AddWebFeedIntent
NextUnread
ReadArticle
Restoration
diff --git a/xcconfig/NetNewsWire_iOSintentextension_target.xcconfig b/xcconfig/NetNewsWire_iOSintentextension_target.xcconfig
deleted file mode 100644
index 509c30776..000000000
--- a/xcconfig/NetNewsWire_iOSintentextension_target.xcconfig
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "./common/NetNewsWire_iOSextension_common.xcconfig"
-CODE_SIGN_ENTITLEMENTS = iOS/IntentsExtension/NetNewsWire_iOS_IntentsExtension.entitlements
-INFOPLIST_FILE = iOS/IntentsExtension/Info.plist
-PRODUCT_BUNDLE_IDENTIFIER = $(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS$(BUNDLE_ID_SUFFIX).IntentsExtension