Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS] Fix the issue where a call does not open the app when the device is in a locked or killed state. #670

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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