Skip to content

Instantly share code, notes, and snippets.

@akdsouza
Created May 4, 2018 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akdsouza/ed6384a01ae79c852af65913e104c454 to your computer and use it in GitHub Desktop.
Save akdsouza/ed6384a01ae79c852af65913e104c454 to your computer and use it in GitHub Desktop.
class IntentHandler: INExtension, INStartAudioCallIntentHandling {
func handle(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) {
let userActivity = NSUserActivity(activityType: NSStringFromClass(INStartAudioCallIntent.self))
let response = INStartAudioCallIntentResponse(code: .continueInApp, userActivity: userActivity)
completion(response)
}
func resolveContacts(for intent: INStartAudioCallIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) {
var contactName: String?
if let contacts = intent.contacts {
contactName = contacts.first?.displayName
}
DataManager.sharedManager.findContact(contactName: contactName, with: { (contacts) in
})
}
func confirm(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) {
let userActivity = NSUserActivity(activityType: NSStringFromClass(INStartAudioCallIntent.self))
let response = INStartAudioCallIntentResponse(code: .ready, userActivity: userActivity)
completion(response)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment