Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions src/ios/AppDelegateCordovaCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@

@implementation AppDelegate (CordovaCall)

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
{
INInteraction *interaction = userActivity.interaction;
INIntent *intent = interaction.intent;
BOOL isVideo = [intent isKindOfClass:[INStartVideoCallIntent class]];
INPerson *contact;
if(isVideo) {
INStartVideoCallIntent *startCallIntent = (INStartVideoCallIntent *)intent;
contact = startCallIntent.contacts.firstObject;
} else {
INStartAudioCallIntent *startCallIntent = (INStartAudioCallIntent *)intent;
contact = startCallIntent.contacts.firstObject;
}
INPersonHandle *personHandle = contact.personHandle;
NSString *callId = personHandle.value;
NSString *callName = [[NSUserDefaults standardUserDefaults] stringForKey:callId];
if(!callName) {
callName = callId;
}
NSDictionary *intentInfo = @{ @"callName" : callName, @"callId" : callId, @"isVideo" : isVideo?@YES:@NO};
[[NSNotificationCenter defaultCenter] postNotificationName:@"RecentsCallNotification" object:intentInfo];
return YES;
}
// Comment out the following as it's overriding continueUserActivity in the Branch plugin
// Have to implement swizzle via cordova-plugin-ios-app-delegate-events but Branch's plugin has a custom declaration of continueUserActivity that gets called when not intended.
// - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
// {
// INInteraction *interaction = userActivity.interaction;
// INIntent *intent = interaction.intent;
// BOOL isVideo = [intent isKindOfClass:[INStartVideoCallIntent class]];
// INPerson *contact;
// if(isVideo) {
// INStartVideoCallIntent *startCallIntent = (INStartVideoCallIntent *)intent;
// contact = startCallIntent.contacts.firstObject;
// } else {
// INStartAudioCallIntent *startCallIntent = (INStartAudioCallIntent *)intent;
// contact = startCallIntent.contacts.firstObject;
// }
// INPersonHandle *personHandle = contact.personHandle;
// NSString *callId = personHandle.value;
// NSString *callName = [[NSUserDefaults standardUserDefaults] stringForKey:callId];
// if(!callName) {
// callName = callId;
// }
// NSDictionary *intentInfo = @{ @"callName" : callName, @"callId" : callId, @"isVideo" : isVideo?@YES:@NO};
// [[NSNotificationCenter defaultCenter] postNotificationName:@"RecentsCallNotification" object:intentInfo];
// return YES;
// }
@end