// Handle the completed intent (required). public void HandleSendMessage(INSendMessageIntent intent, Action <INSendMessageIntentResponse> completion) { // Implement your application logic to send a message here. var userActivity = new NSUserActivity("com.trinetix.handlemessage"); // Define details var info = new NSMutableDictionary(); info.Add(new NSString("message"), new NSString(intent.Content)); // Populate Activity userActivity.UserInfo = info; // Add App Search ability //userActivity.EligibleForHandoff = true; //userActivity.EligibleForSearch = true; //userActivity.EligibleForPublicIndexing = true; //userActivity.BecomeCurrent(); // Assemble response and send it var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.InProgress, userActivity); completion(response); }
public void ResolveContent (INSendMessageIntent intent, Action<INStringResolutionResult> completion) { var text = intent.Content; if (!string.IsNullOrEmpty (text)) completion (INStringResolutionResult.GetSuccess (text)); else completion (INStringResolutionResult.NeedsValue); }
// Handle the completed intent (required). public void HandleSendMessage(INSendMessageIntent intent, Action <INSendMessageIntentResponse> completion) { // Implement your application logic to send a message here. var userActivity = new NSUserActivity("INSendMessageIntent"); var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Success, userActivity); completion(response); }
public void ConfirmSendMessage(INSendMessageIntent intent, Action <INSendMessageIntentResponse> completion) { // Verify user is authenticated and your app is ready to send a message. var userActivity = new NSUserActivity("INSendMessageIntent"); var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Ready, userActivity); completion(response); }
public void ResolveContent(INSendMessageIntent intent, Action <INStringResolutionResult> completion) { var text = intent.Content; if (!string.IsNullOrEmpty(text)) { completion(INStringResolutionResult.GetSuccess(text)); } else { completion(INStringResolutionResult.NeedsValue); } }
public void ResolveRecipients(INSendMessageIntent intent, Action <INPersonResolutionResult []> completion) { var resolutionResults = new List <INPersonResolutionResult> (); var matchingContacts = new List <INPerson> (); // Verify Recipients var recipients = intent.Recipients; if (recipients.Length == 0) { // We must have at least one recipient resolutionResults.Add(INPersonResolutionResult.NeedsValue); } else { // Scan all recipients foreach (var recipient in recipients) { // Know user to ElizaChat if (AddressBook.FindUser(recipient.Identifier) == null) { matchingContacts.Add(recipient); } } // Take action based on the found recipients switch (matchingContacts.Count) { case 0: // We have no contacts matching the description provided resolutionResults.Add(INPersonResolutionResult.Unsupported); break; case 1: // We have exactly one matching contact resolutionResults.Add(INPersonResolutionResult.GetSuccess(matchingContacts[0])); break; default: // We need Siri's help to ask user to pick one from the matches. resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts.ToArray())); break; } } // Report results to Siri completion(resolutionResults.ToArray()); }
public void ResolveRecipients (INSendMessageIntent intent, Action<INPersonResolutionResult []> completion) { var resolutionResults = new List<INPersonResolutionResult> (); var matchingContacts = new List<INPerson> (); // Verify Recipients var recipients = intent.Recipients; if (recipients.Length == 0) { // We must have at least one recipient resolutionResults.Add (INPersonResolutionResult.NeedsValue); } else { // Scan all recipients foreach (var recipient in recipients) { // Know user to ElizaChat if (AddressBook.FindUser (recipient.Identifier) == null) { matchingContacts.Add (recipient); } } // Take action based on the found recipients switch (matchingContacts.Count) { case 0: // We have no contacts matching the description provided resolutionResults.Add (INPersonResolutionResult.Unsupported); break; case 1: // We have exactly one matching contact resolutionResults.Add (INPersonResolutionResult.GetSuccess (matchingContacts[0])); break; default: // We need Siri's help to ask user to pick one from the matches. resolutionResults.Add (INPersonResolutionResult.GetDisambiguation (matchingContacts.ToArray ())); break; } } // Report results to Siri completion (resolutionResults.ToArray ()); }
public void ConfirmSendMessage (INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) { // Verify user is authenticated and your app is ready to send a message. var userActivity = new NSUserActivity (nameof (INSendMessageIntent)); var response = new INSendMessageIntentResponse (INSendMessageIntentResponseCode.Ready, userActivity); completion (response); }
// Handle the completed intent (required). public void HandleSendMessage (INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) { // Implement your application logic to send a message here. //var userActivity = new NSUserActivity (nameof (INSendMessageIntent)); var userActivity = new NSUserActivity ("com.appracatappra.askquestion"); // Define details var info = new NSMutableDictionary (); info.Add (new NSString ("question"), new NSString (intent.Content)); // Populate Activity userActivity.Title = "Ask Eliza a Question"; userActivity.UserInfo = info; // Add App Search ability userActivity.EligibleForHandoff = true; userActivity.EligibleForSearch = true; userActivity.EligibleForPublicIndexing = true; userActivity.BecomeCurrent (); // Assemble response and send it var response = new INSendMessageIntentResponse (INSendMessageIntentResponseCode.InProgress, userActivity); completion (response); }