Skip to content

Commit 2b1bb0a

Browse files
author
Brandon Huang
committed
Differentiate intent type comparisons for iOS 13, include fix in providerConfiguration for video option
1 parent 4ae5507 commit 2b1bb0a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

ios/RNCallKeep/RNCallKeep.m

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ + (CXProviderConfiguration *)getProviderConfiguration:(NSDictionary*)settings
391391
providerConfiguration.maximumCallsPerCallGroup = 1;
392392
providerConfiguration.supportedHandleTypes = [NSSet setWithObjects:[NSNumber numberWithInteger:CXHandleTypePhoneNumber], nil];
393393
if (settings[@"supportsVideo"]) {
394-
providerConfiguration.supportsVideo = settings[@"supportsVideo"];
394+
providerConfiguration.supportsVideo = [settings[@"supportsVideo"] boolValue];
395395
}
396396
if (settings[@"maximumCallGroups"]) {
397397
providerConfiguration.maximumCallGroups = [settings[@"maximumCallGroups"] integerValue];
@@ -461,8 +461,17 @@ + (BOOL)application:(UIApplication *)application
461461
INInteraction *interaction = userActivity.interaction;
462462
INPerson *contact;
463463
NSString *handle;
464-
BOOL isAudioCall = [userActivity.activityType isEqualToString:INStartAudioCallIntentIdentifier];
465-
BOOL isVideoCall = [userActivity.activityType isEqualToString:INStartVideoCallIntentIdentifier];
464+
BOOL isAudioCall;
465+
BOOL isVideoCall;
466+
// iOS 13 returns an INStartCallIntent userActivity type
467+
if (@available(iOS 13, *)) {
468+
INStartCallIntent *intent = (INStartCallIntent*)interaction.intent;
469+
isAudioCall = intent.callCapability == INCallCapabilityAudioCall;
470+
isVideoCall = intent.callCapability == INCallCapabilityVideoCall;
471+
} else {
472+
isAudioCall = [userActivity.activityType isEqualToString:INStartAudioCallIntentIdentifier];
473+
isVideoCall = [userActivity.activityType isEqualToString:INStartVideoCallIntentIdentifier];
474+
}
466475

467476
if (isAudioCall) {
468477
INStartAudioCallIntent *startAudioCallIntent = (INStartAudioCallIntent *)interaction.intent;
@@ -472,14 +481,15 @@ + (BOOL)application:(UIApplication *)application
472481
contact = [startVideoCallIntent.contacts firstObject];
473482
}
474483

484+
475485
if (contact != nil) {
476486
handle = contact.personHandle.value;
477487
}
478488

479489
if (handle != nil && handle.length > 0 ){
480490
NSDictionary *userInfo = @{
481-
@"handle": handle,
482-
@"video": @(isVideoCall)
491+
@"handle": handle,
492+
@"video": @(isVideoCall)
483493
};
484494

485495
RNCallKeep *callKeep = [RNCallKeep allocWithZone: nil];

0 commit comments

Comments
 (0)