In my app, users can add tasks to lists via Sirikit (example Siri intent query: "In MyApp add to expense list 100 dollars for jeans"). if the list suggested is not available in the app, I ask for disambiguation.
the result from multiple choice in disambiguation is not captured in resolveTargetTaskList.
intent.targetTaskList?.title is the value I passed in the first try. as a result, it enters an infinite loop.
func resolveTargetTaskList(for intent: INAddTasksIntent, with completion: @escaping (INTaskListResolutionResult) -> Void) {
guard let title = intent.targetTaskList?.title else {
completion(.needsValue())
print("no title value")
}
completeResolveTaskList(listName: intent.targetTaskList!.title, with: completion)
}
public func completeResolveTaskList(listName: INSpeakableString, with completion: @escaping (INTaskListResolutionResult) -> Void) {
print("completeResolveTaskList")
let allLists = getAllLists()
for index in 0...(allLists.count - 1) {
if allLists[index].spokenPhrase.lowercased() == listName.spokenPhrase.lowercased() {
completion(.success(with: taskLists[index]))
}
}
switch allLists.count {
case 0:
completion(.unsupported())
default:
completion(.disambiguation(with: taskLists))
}
}
screenshot for reference:
https://drive.google.com/file/d/1Ds-Z9FWpNEHwA0urBu3i4yazi0NEMsGq/view?usp=sharing
Please help me.