public void ResolveRecipients(INSearchForMessagesIntent intent, Action <INPersonResolutionResult[]> completion) { var recipients = intent.Recipients; // If no recipients were provided we'll need to prompt for a value. if (recipients.Length == 0) { completion(new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue }); return; } var resolutionResults = new List <INPersonResolutionResult> (); foreach (var recipient in recipients) { var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts if (matchingContacts.Length > 1) { // We need Siri's help to ask user to pick one from the matches. resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts)); } else if (matchingContacts.Length == 1) { // We have exactly one matching contact resolutionResults.Add(INPersonResolutionResult.GetSuccess(recipient)); } else { // We have no contacts matching the description provided resolutionResults.Add(INPersonResolutionResult.Unsupported); } } completion(resolutionResults.ToArray()); }
public CommonSettingsProvider(IServerApi serverApi, INPerson person) { INSettings personalSettings = serverApi.GetPersonalSettings(); _person = person; ReloadSettings(personalSettings); }
public SearchService(IServerApiService apiService, ServerCallback callback, INPerson person, IReadOnlyDictionary <int, INType> types) { callback.RegisterCallbackSearchListener(this); _apiService = apiService; _person = person; _types = types; }
public ServerApiService(IServerApi serverApi, DDatabaseInfo dbInfo, ISearchServiceFactory searchServiceFactory, IBackend backend) { _serverApi = serverApi; _dbInfo = dbInfo; _searchServiceFactory = searchServiceFactory; _currentPerson = dbInfo.Person; _backend = backend; LoadPeople(); LoadOrganizationUnits(); LoadMetadata(0); }
// Implement handlers for each intent you wish to handle. // As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. public void HandleSearchForMessages(INSearchForMessagesIntent intent, Action <INSearchForMessagesIntentResponse> completion) { // Implement your application logic to find a message that matches the information in the intent. var userActivity = new NSUserActivity("INSearchForMessagesIntent"); var response = new INSearchForMessagesIntentResponse(INSearchForMessagesIntentResponseCode.Success, userActivity); // Initialize with found message's attributes var sender = new INPerson(new INPersonHandle("*****@*****.**", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); var recipient = new INPerson(new INPersonHandle("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); var message = new INMessage("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient }); response.Messages = new INMessage[] { message }; completion(response); }
public ISearchService GetSearchService(IServerApiService apiService, INPerson person, IReadOnlyDictionary <int, INType> types) { return(new SearchService(apiService, _callback, person, types)); }
// Implement handlers for each intent you wish to handle. // As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. public void HandleSearchForMessages (INSearchForMessagesIntent intent, Action<INSearchForMessagesIntentResponse> completion) { // Implement your application logic to find a message that matches the information in the intent. var userActivity = new NSUserActivity (nameof (INSearchForMessagesIntent)); var response = new INSearchForMessagesIntentResponse (INSearchForMessagesIntentResponseCode.Success, userActivity); // Initialize with found message's attributes var sender = new INPerson (new INPersonHandle ("*****@*****.**", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); var recipient = new INPerson (new INPersonHandle ("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); var message = new INMessage ("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson [] { recipient }); response.Messages = new INMessage [] { message }; completion (response); }