Skip to content
Open
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
20 changes: 19 additions & 1 deletion ios/RNCallKeep/RNCallKeep.m
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ + (BOOL)application:(UIApplication *)application
};

RNCallKeep *callKeep = [RNCallKeep allocWithZone: nil];
[callKeep sendEventWithNameWrapper:RNCallKeepDidReceiveStartCallAction body:userInfo];
[callKeep handleStartCallNotification: userInfo];
return YES;
}
return NO;
Expand All @@ -999,6 +999,24 @@ + (BOOL)requiresMainQueueSetup
return YES;
}

- (void)handleStartCallNotification:(NSDictionary *)userInfo
{
#ifdef DEBUG
NSLog(@"[RNCallKeep][handleStartCallNotification] userInfo = %@", userInfo);
#endif
int delayInSeconds;
if (!_isStartCallActionEventListenerAdded) {
// Workaround for when app is just launched and JS side hasn't registered to the event properly
delayInSeconds = OUTGOING_CALL_WAKEUP_DELAY;
} else {
delayInSeconds = 0;
}
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^{
[self sendEventWithNameWrapper:RNCallKeepDidReceiveStartCallAction body:userInfo];
});
}

#pragma mark - CXProviderDelegate

- (void)providerDidReset:(CXProvider *)provider{
Expand Down