I've been working on SiriKit for a while, and the result of my demo was not satisfied by my boss. By reading all the Apple documents & did my best to search online, I still can't find a way to skip the confirm step in SendMessageIntent!
This is my purpose:
After resolving user comments to Siri,
func resolveContent(forSendMessage intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) {
if let text = intent.content, !text.isEmpty {
if text == "Login with Touch ID" {
completion(INStringResolutionResult.success(with: text))
} else if text == "Change password"{
completion(INStringResolutionResult.success(with: text))
}
completion(INStringResolutionResult.disambiguation(with: ["Login with Touch ID", "Change password"]))
} else {
completion(INStringResolutionResult.disambiguation(with: ["Login with Touch ID", "Change password"]))
}
}
Skip this step "confirm",
func confirm(sendMessage intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Verify user is authenticated and your app is ready to send a message.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
And do the handle delegate directly,
func handle(sendMessage intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Implement your application logic to send a message here.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
Hope there's someone can answer this question for me. Thanks a lot!