ios - SiriKit INSendMessageIntent skip confirm delegate -
i've been working on sirikit while, , result of demo not satisfied boss. reading apple documents & did best search online, still can't find way skip confirm step in sendmessageintent!
this purpose:
after resolving user comments siri,
func resolvecontent(forsendmessage intent: insendmessageintent, completion: @escaping (instringresolutionresult) -> void) { if let text = intent.content, !text.isempty { if text == "login touch id" { completion(instringresolutionresult.success(with: text)) } else if text == "change password"{ completion(instringresolutionresult.success(with: text)) } completion(instringresolutionresult.disambiguation(with: ["login touch id", "change password"])) } else { completion(instringresolutionresult.disambiguation(with: ["login touch id", "change password"])) } }
skip step "confirm",
func confirm(sendmessage intent: insendmessageintent, completion: @escaping (insendmessageintentresponse) -> void) { // verify user authenticated , app ready send message. let useractivity = nsuseractivity(activitytype: nsstringfromclass(insendmessageintent.self)) let response = insendmessageintentresponse(code: .success, useractivity: useractivity) completion(response) }
and handle delegate directly,
func handle(sendmessage intent: insendmessageintent, completion: @escaping (insendmessageintentresponse) -> void) { // implement application logic send message here. let useractivity = nsuseractivity(activitytype: nsstringfromclass(insendmessageintent.self)) let response = insendmessageintentresponse(code: .success, useractivity: useractivity) completion(response) }
hope there's can answer question me. lot!
the confirm
function optional, don't need implement able conform insendmessageintenthandling
protocol, handle(intent:completion:)
required. shows can skip confirmation part.
you should delete confirm
function , sirikit
call handle
function directly, without confirmation.
Comments
Post a Comment