diff --git a/iOS/Intents/AddWebFeedIntentHandler.swift b/iOS/Intents/AddWebFeedIntentHandler.swift index fb0711fdb..94a61bc8f 100644 --- a/iOS/Intents/AddWebFeedIntentHandler.swift +++ b/iOS/Intents/AddWebFeedIntentHandler.swift @@ -35,16 +35,24 @@ public class AddWebFeedIntentHandler: NSObject, AddWebFeedIntentHandling { completion(.success(with: url)) } - public func provideAccountNameOptions(for intent: AddWebFeedIntent, with completion: @escaping ([String]?, Error?) -> Void) { + public func resolveTitle(for intent: AddWebFeedIntent, with completion: @escaping (INStringResolutionResult) -> Void) { + guard let title = intent.title else { + completion(INStringResolutionResult.notRequired()) + return + } + completion(.success(with: title)) + } + + public func provideAccountNameOptionsCollection(for intent: AddWebFeedIntent, with completion: @escaping (INObjectCollection?, Error?) -> Void) { guard let extensionContainers = ExtensionContainersFile.read() else { completion(nil, AddWebFeedIntentHandlerError.communicationFailure) return } let accountNames = extensionContainers.accounts.map { $0.name } - completion(accountNames, nil) + completion(INObjectCollection(items: accountNames as [NSString]), nil) } - + public func resolveAccountName(for intent: AddWebFeedIntent, with completion: @escaping (AddWebFeedAccountNameResolutionResult) -> Void) { guard let accountName = intent.accountName else { completion(AddWebFeedAccountNameResolutionResult.notRequired()) @@ -78,6 +86,21 @@ public class AddWebFeedIntentHandler: NSObject, AddWebFeedIntentHandling { completion(folderNames, nil) } + public func provideFolderNameOptionsCollection(for intent: AddWebFeedIntent, with completion: @escaping (INObjectCollection?, Error?) -> Void) { + guard let extensionContainers = ExtensionContainersFile.read() else { + completion(nil, AddWebFeedIntentHandlerError.communicationFailure) + return + } + + guard let accountName = intent.accountName, let account = extensionContainers.findAccount(forName: accountName) else { + completion(INObjectCollection(items: [NSString]()), nil) + return + } + + let folderNames = account.folders.map { $0.name } + completion(INObjectCollection(items: folderNames as [NSString]), nil) + } + public func resolveFolderName(for intent: AddWebFeedIntent, with completion: @escaping (AddWebFeedFolderNameResolutionResult) -> Void) { guard let accountName = intent.accountName, let folderName = intent.folderName else { completion(AddWebFeedFolderNameResolutionResult.notRequired()) @@ -135,7 +158,7 @@ public class AddWebFeedIntentHandler: NSObject, AddWebFeedIntentHandling { return } - let request = ExtensionFeedAddRequest(name: nil, feedURL: url, destinationContainerID: containerID) + let request = ExtensionFeedAddRequest(name: intent.title, feedURL: url, destinationContainerID: containerID) ExtensionFeedAddRequestFile.save(request) completion(AddWebFeedIntentResponse(code: .success, userActivity: nil)) } diff --git a/iOS/Intents/Base.lproj/Intents.intentdefinition b/iOS/Intents/Base.lproj/Intents.intentdefinition index e1969b641..6a9bdd91b 100644 --- a/iOS/Intents/Base.lproj/Intents.intentdefinition +++ b/iOS/Intents/Base.lproj/Intents.intentdefinition @@ -5,15 +5,15 @@ INEnums INIntentDefinitionModelVersion - 1.1 + 1.2 INIntentDefinitionNamespace U6u7RF INIntentDefinitionSystemVersion - 19D76 + 22A400 INIntentDefinitionToolsBuildVersion - 11B53 + 14B47b INIntentDefinitionToolsVersion - 11.2.1 + 14.1 INIntents @@ -32,21 +32,10 @@ INIntentKeyParameter url INIntentLastParameterTag - 4 + 5 INIntentManagedParameterCombinations - url,accountName - - INIntentParameterCombinationSupportsBackgroundExecution - - INIntentParameterCombinationTitle - Add ${url} to ${accountName} - INIntentParameterCombinationTitleID - kaKsEY - INIntentParameterCombinationUpdatesLinked - - - url,accountName,folderName + url,accountName,folderName,title INIntentParameterCombinationSupportsBackgroundExecution @@ -57,12 +46,25 @@ INIntentParameterCombinationUpdatesLinked + url,accountName,title + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Add ${url} to ${accountName} + INIntentParameterCombinationTitleID + kaKsEY + INIntentParameterCombinationUpdatesLinked + + INIntentName AddWebFeed INIntentParameters + INIntentParameterConfigurable + INIntentParameterDisplayName URL INIntentParameterDisplayNameID @@ -105,6 +107,52 @@ + INIntentParameterConfigurable + + INIntentParameterDisplayName + Title + INIntentParameterDisplayNameID + Ac5RHN + INIntentParameterDisplayPriority + 2 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + Words + INIntentParameterMetadataDefaultValueID + SVcvQb + + INIntentParameterName + title + INIntentParameterPromptDialogs + + + INIntentParameterPromptDialogCustom + + INIntentParameterPromptDialogType + Configuration + + + INIntentParameterPromptDialogCustom + + INIntentParameterPromptDialogFormatString + What is the ${title}of the feed? + INIntentParameterPromptDialogFormatStringID + IGNcSh + INIntentParameterPromptDialogType + Primary + + + INIntentParameterSupportsResolution + + INIntentParameterTag + 5 + INIntentParameterType + String + + + INIntentParameterConfigurable + INIntentParameterCustomDisambiguation INIntentParameterDisplayName @@ -112,7 +160,7 @@ INIntentParameterDisplayNameID CSrgUY INIntentParameterDisplayPriority - 2 + 3 INIntentParameterMetadata INIntentParameterMetadataCapitalization @@ -138,14 +186,6 @@ INIntentParameterPromptDialogType DisambiguationIntroduction - - INIntentParameterPromptDialogFormatString - Which one? - INIntentParameterPromptDialogFormatStringID - fWs3li - INIntentParameterPromptDialogType - DisambiguationSelection - INIntentParameterPromptDialogCustom @@ -190,6 +230,8 @@ + INIntentParameterConfigurable + INIntentParameterCustomDisambiguation INIntentParameterDisplayName @@ -197,7 +239,7 @@ INIntentParameterDisplayNameID zXhMPF INIntentParameterDisplayPriority - 3 + 4 INIntentParameterMetadata INIntentParameterMetadataCapitalization @@ -223,14 +265,6 @@ INIntentParameterPromptDialogType DisambiguationIntroduction - - INIntentParameterPromptDialogFormatString - Which one? - INIntentParameterPromptDialogFormatStringID - gEzXaM - INIntentParameterPromptDialogType - DisambiguationSelection - INIntentParameterPromptDialogCustom diff --git a/iOS/IntentsExtension/Info.plist b/iOS/IntentsExtension/Info.plist index ecb576837..e3e1b4889 100644 --- a/iOS/IntentsExtension/Info.plist +++ b/iOS/IntentsExtension/Info.plist @@ -2,8 +2,6 @@ - OrganizationIdentifier - $(ORGANIZATION_IDENTIFIER) AppGroup group.$(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS AppIdentifierPrefix @@ -44,5 +42,7 @@ NSExtensionPrincipalClass $(PRODUCT_MODULE_NAME).IntentHandler + OrganizationIdentifier + $(ORGANIZATION_IDENTIFIER) diff --git a/iOS/Resources/Info.plist b/iOS/Resources/Info.plist index 1b350b77f..eb286c11f 100644 --- a/iOS/Resources/Info.plist +++ b/iOS/Resources/Info.plist @@ -6,14 +6,33 @@ group.$(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS AppIdentifierPrefix $(AppIdentifierPrefix) - ITSAppUsesNonExemptEncryption - BGTaskSchedulerPermittedIdentifiers com.ranchero.NetNewsWire.FeedRefresh CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + nnwtheme + + CFBundleTypeName + NetNewsWire Theme + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.ranchero.netnewswire.theme + + LSTypeIsPackage + + + CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -54,6 +73,8 @@ $(CURRENT_PROJECT_VERSION) DeveloperEntitlements $(DEVELOPER_ENTITLEMENTS) + ITSAppUsesNonExemptEncryption + LSApplicationQueriesSchemes mailto @@ -61,6 +82,8 @@ LSRequiresIPhoneOS + LSSupportsOpeningDocumentsInPlace + NSAppTransportSecurity NSAllowsArbitraryLoads @@ -195,29 +218,6 @@ - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - nnwtheme - - CFBundleTypeName - NetNewsWire Theme - LSHandlerRank - Owner - CFBundleTypeRole - Viewer - LSItemContentTypes - - com.ranchero.netnewswire.theme - - LSTypeIsPackage - - - - LSSupportsOpeningDocumentsInPlace - UserAgent NetNewsWire (RSS Reader; https://netnewswire.com/)