diff --git a/Riot/Generated/InfoPlist.swift b/Riot/Generated/InfoPlist.swift index b9784e4003..a2d4e486e5 100644 --- a/Riot/Generated/InfoPlist.swift +++ b/Riot/Generated/InfoPlist.swift @@ -35,6 +35,7 @@ internal enum InfoPlist { internal static let nsMicrophoneUsageDescription: String = _document["NSMicrophoneUsageDescription"] internal static let nsPhotoLibraryUsageDescription: String = _document["NSPhotoLibraryUsageDescription"] internal static let nsSiriUsageDescription: String = _document["NSSiriUsageDescription"] + internal static let nsUserActivityTypes: [String] = _document["NSUserActivityTypes"] internal static let uiBackgroundModes: [String] = _document["UIBackgroundModes"] internal static let uiLaunchStoryboardName: String = _document["UILaunchStoryboardName"] internal static let uiRequiredDeviceCapabilities: [String] = _document["UIRequiredDeviceCapabilities"] diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 179bcbbc13..5b55b8fc95 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -748,6 +748,26 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct { continueUserActivity = [self handleUniversalLink:userActivity]; } + else if ([userActivity.activityType isEqualToString:INSendMessageIntentIdentifier]) + { + INInteraction *interaction = userActivity.interaction; + if (interaction && [interaction.intent isKindOfClass:[INSendMessageIntent class]]) + { + INSendMessageIntent *intent = (INSendMessageIntent *)(interaction.intent); + INPerson *person = intent.recipients.firstObject; + if (person && person.customIdentifier) { + NSString *identifier = person.customIdentifier; + + [self startDirectChatWithUserId:identifier completion:NULL]; + // TODO: initialize text if from a siri shortcut + continueUserActivity = YES; + } else { + MXLogWarning(@"A recipient was missing in the INSendMessageIntent"); + } + } else { + MXLogWarning(@"How can an INSendMessageIntent activity not have an INSendMessageIntent?"); + } + } else if ([userActivity.activityType isEqualToString:INStartAudioCallIntentIdentifier] || [userActivity.activityType isEqualToString:INStartVideoCallIntentIdentifier]) { diff --git a/Riot/SupportingFiles/Info.plist b/Riot/SupportingFiles/Info.plist index 5bcda43e69..6744007bf1 100644 --- a/Riot/SupportingFiles/Info.plist +++ b/Riot/SupportingFiles/Info.plist @@ -65,6 +65,12 @@ The photo library is used to send photos and videos. NSSiriUsageDescription Siri is used to perform calls even from the lock screen. + NSUserActivityTypes + + INSendMessageIntent + INStartAudioCallIntent + INStartVideoCallIntent + UIBackgroundModes audio diff --git a/SiriIntents/Intents.intentdefinition b/SiriIntents/Intents.intentdefinition new file mode 100644 index 0000000000..9a63a122de --- /dev/null +++ b/SiriIntents/Intents.intentdefinition @@ -0,0 +1,475 @@ + + + + + INEnums + + INIntentDefinitionModelVersion + 1.2 + INIntentDefinitionNamespace + lIXvxR + INIntentDefinitionSystemVersion + 20G95 + INIntentDefinitionToolsBuildVersion + 13A233 + INIntentDefinitionToolsVersion + 13.0 + INIntents + + + INIntentCategory + system + INIntentClassName + INSendMessageIntent + INIntentClassPrefix + IN + INIntentCustomizable + + INIntentDescription + A request to send a message to the designated recipients. + INIntentDescriptionID + qsOBul + INIntentDomain + Messaging + INIntentInput + content + INIntentKeyParameter + recipients + INIntentLastParameterTag + 21 + INIntentName + SendMessage + INIntentParameterCombinations + + content,recipients + + INIntentParameterCombinationIsPrimary + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send “${content}” to ${recipients} + INIntentParameterCombinationTitleID + 2bXdOO + + content,speakableGroupName + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send “${content}” to ${speakableGroupName} + INIntentParameterCombinationTitleID + Kr6YXh + + content,speakableGroupName,recipients + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send “${content}” to ${speakableGroupName} + INIntentParameterCombinationTitleID + vvi9i0 + + recipients + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send a message to ${recipients} + INIntentParameterCombinationTitleID + D7JjnM + + speakableGroupName + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send a message to ${speakableGroupName} + INIntentParameterCombinationTitleID + quajA3 + + speakableGroupName,recipients + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Send a message to ${speakableGroupName} + INIntentParameterCombinationTitleID + FMCSms + + + INIntentParameters + + + INIntentParameterConfigurable + + INIntentParameterDisplayName + Group Name + INIntentParameterDisplayNameID + SendMessage-DisplayName-speakableGroupName + INIntentParameterDisplayPriority + 1 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + None + + INIntentParameterName + speakableGroupName + INIntentParameterSupportsResolution + + INIntentParameterTag + 3 + INIntentParameterType + SpeakableString + + + INIntentParameterConfigurable + + INIntentParameterDisplayName + Recipients + INIntentParameterDisplayNameID + SendMessage-DisplayName-recipients + INIntentParameterDisplayPriority + 2 + INIntentParameterMetadata + + INIntentParameterMetadataType + Contact + + INIntentParameterName + recipients + INIntentParameterSupportsMultipleValues + + INIntentParameterSupportsResolution + + INIntentParameterTag + 20 + INIntentParameterType + Person + + + INIntentParameterConfigurable + + INIntentParameterDisplayName + Content + INIntentParameterDisplayNameID + SendMessage-DisplayName-content + INIntentParameterDisplayPriority + 3 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + None + INIntentParameterMetadataDefaultValueID + 1VOmYx + INIntentParameterMetadataKeyboardType + ASCIICapable + INIntentParameterMetadataPlaceholderID + KkByhy + + INIntentParameterName + content + INIntentParameterSupportsResolution + + INIntentParameterTag + 1 + INIntentParameterType + String + + + INIntentParameterDisplayName + Conversation Identifier + INIntentParameterDisplayNameID + tjmTwf + INIntentParameterDisplayPriority + 4 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + None + INIntentParameterMetadataDefaultValueID + n2NqOm + INIntentParameterMetadataKeyboardType + ASCIICapable + INIntentParameterMetadataPlaceholderID + Zuaw5t + + INIntentParameterName + conversationIdentifier + INIntentParameterTag + 9 + INIntentParameterType + String + + + INIntentParameterDisplayName + Service Name + INIntentParameterDisplayNameID + ByTbRO + INIntentParameterDisplayPriority + 5 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + None + INIntentParameterMetadataDefaultValueID + pYYeOW + INIntentParameterMetadataKeyboardType + ASCIICapable + INIntentParameterMetadataPlaceholderID + 4UssF1 + + INIntentParameterName + serviceName + INIntentParameterTag + 6 + INIntentParameterType + String + + + INIntentParameterDisplayName + Sender + INIntentParameterDisplayNameID + PCCAwS + INIntentParameterDisplayPriority + 6 + INIntentParameterMetadata + + INIntentParameterMetadataType + Contact + + INIntentParameterName + sender + INIntentParameterTag + 21 + INIntentParameterType + Person + + + INIntentParameterDisplayName + Outgoing Message Type + INIntentParameterDisplayNameID + r7jr7O + INIntentParameterDisplayPriority + 7 + INIntentParameterEnumType + OutgoingMessageType + INIntentParameterEnumTypeNamespace + System + INIntentParameterName + outgoingMessageType + INIntentParameterTag + 15 + INIntentParameterType + Integer + + + INIntentParameterDisplayName + Attachments + INIntentParameterDisplayNameID + v0qUig + INIntentParameterDisplayPriority + 8 + INIntentParameterName + attachments + INIntentParameterObjectType + MessageAttachment + INIntentParameterObjectTypeNamespace + System + INIntentParameterTag + 17 + INIntentParameterType + Object + + + INIntentTitle + Send Message + INIntentTitleID + mjLtxO + INIntentType + System + INIntentUserConfirmationRequired + + + + INIntentCategory + system + INIntentClassName + INStartAudioCallIntent + INIntentClassPrefix + IN + INIntentCustomizable + + INIntentDescription + A request to start an audio-only call with one or more users. + INIntentDescriptionID + D0e0H6 + INIntentDomain + VoIP Calling + INIntentInput + contacts + INIntentKeyParameter + contacts + INIntentLastParameterTag + 13 + INIntentName + StartAudioCall + INIntentParameterCombinations + + contacts + + INIntentParameterCombinationIsPrimary + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Call ${contacts} + INIntentParameterCombinationTitleID + IFK6ls + + + INIntentParameters + + + INIntentParameterConfigurable + + INIntentParameterCustomDisambiguation + + INIntentParameterDisplayName + Contacts + INIntentParameterDisplayNameID + UcgJs8 + INIntentParameterDisplayPriority + 1 + INIntentParameterMetadata + + INIntentParameterMetadataPlaceholderID + AMekaD + INIntentParameterMetadataType + Contact + + INIntentParameterName + contacts + INIntentParameterSupportsMultipleValues + + INIntentParameterSupportsResolution + + INIntentParameterTag + 3 + INIntentParameterType + Person + + + INIntentParameterConfigurable + + INIntentParameterCustomDisambiguation + + INIntentParameterDisplayName + Destination Type + INIntentParameterDisplayNameID + C5uqwV + INIntentParameterDisplayPriority + 2 + INIntentParameterEnumType + CallDestinationType + INIntentParameterEnumTypeNamespace + System + INIntentParameterName + destinationType + INIntentParameterSupportsResolution + + INIntentParameterTag + 5 + INIntentParameterType + Integer + + + INIntentTitle + Start Audio Call + INIntentTitleID + XoA0EW + INIntentType + System + + + INIntentCategory + system + INIntentClassName + INStartVideoCallIntent + INIntentClassPrefix + IN + INIntentCustomizable + + INIntentDescription + A request to start a video call with one or more users. + INIntentDescriptionID + KsJzHc + INIntentDomain + VoIP Calling + INIntentInput + contacts + INIntentKeyParameter + contacts + INIntentLastParameterTag + 5 + INIntentName + StartVideoCall + INIntentParameterCombinations + + contacts + + INIntentParameterCombinationIsPrimary + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Start a video call with ${contacts} + INIntentParameterCombinationTitleID + 8RgOGn + + + INIntentParameters + + + INIntentParameterConfigurable + + INIntentParameterCustomDisambiguation + + INIntentParameterDisplayName + Contacts + INIntentParameterDisplayNameID + 0oDxox + INIntentParameterDisplayPriority + 1 + INIntentParameterMetadata + + INIntentParameterMetadataPlaceholderID + I8REHQ + INIntentParameterMetadataType + Contact + + INIntentParameterName + contacts + INIntentParameterSupportsMultipleValues + + INIntentParameterSupportsResolution + + INIntentParameterTag + 3 + INIntentParameterType + Person + + + INIntentTitle + Start Video Call + INIntentTitleID + dL0RQT + INIntentType + System + + + INTypes + + +