motion/project/template/ios-intents-extension/files/app/intent_handler.rb
# Implement resolution methods to provide additional information about your intent (optional).
Implement resolution methods to provide additional information about your intent (optional).
Implement resolution methods to provide additional information about your intent ( optional ) .
def resolveRecipientsForSendMessage(intent, withCompletion:completion)
    recipients = intent.recipients
    if recipients.empty?
      completion.call([INPersonResolutionResult.needsValue])
      return
    end
    resolutionResults = []
    recipients.each do |recipient|
        matchingContacts = [recipient]
        if matchingContacts.count > 1
          resolutionResults << INPersonResolutionResult.disambiguationWithPeopleToDisambiguate(matchingContacts)
        elsif matchingContacts.count == 1
          resolutionResults << INPersonResolutionResult.successWithResolvedPerson(recipient)
        else
          resolutionResults << INPersonResolutionResult.unsupported
        end
    end
    completion.call(resolutionResults)
  end
def resolveRecipientsForSendMessage ( intent , withCompletion : completion ) recipients = intent . recipients if recipients . empty? completion . call ( [ INPersonResolutionResult . needsValue ] ) return end resolutionResults = [ ] recipients . each do | recipient | matchingContacts = [ recipient ] if matchingContacts . count > 1 resolutionResults << INPersonResolutionResult . disambiguationWithPeopleToDisambiguate ( matchingContacts ) elsif matchingContacts . count == 1 resolutionResults << INPersonResolutionResult . successWithResolvedPerson ( recipient ) else resolutionResults << INPersonResolutionResult . unsupported end end completion . call ( resolutionResults ) end
Implement resolution methods to provide additional information about your intent (optional).
Implement resolution methods to provide additional information about your intent ( optional ) .
# If no recipients were provided we'll need to prompt for a value. # Implement your contact matching logic here to create an array of matching contacts # We need Siri's help to ask user to pick one from the matches. # We have exactly one matching contact # We have no contacts matching the description provided
intent
withCompletion
completion