Delay in reportNewIncomingCall triggering didDisplayIncomingCall
See original GitHub issueSomewhat related to #107
When following the instructions in the README to adjust didReceiveIncomingPushWithPayload
for iOS 13 changes, I’ve encountered a timing issue with how didDisplayIncomingCall
is triggered.
In my VoipPushNotification
handler for NewCall
notifications I resolve the contact name before using RNCallKeep.displayIncomingCall()
.
With the new changes I am reporting the incoming call from the AppDelegate.m
before sending the push notification to RNVoipPushNotificationManager
.
Ideally I would update the newly reported call in the push notification handler with the contact name, but reportNewIncomingCall
appears to trigger didDisplayIncomingCall
after the push notification is handled even though it is run before the push notification is passed to RNVoipPushNotificationManager
.
// Handle incoming pushes
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
// Process the received push
NSLog(@"CVE PUSH VOIP push received: %@ %@", payload, type);
NSDictionary* data = [payload.dictionaryPayload objectForKey:@"bsft"];
NSString* pushType = [data objectForKey:@"type"];
if ([pushType isEqualToString:@"NewCall"]) {
NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
NSString *sender = [data objectForKey:@"sender"];
[RNCallKeep reportNewIncomingCall:uuid handle:sender handleType:@"generic" hasVideo:false localizedCallerName:sender fromPushKit: YES];
}
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
}
Logs showing order of events to didDisplayIncomingCall
(RNCallKit received onIncomingCall
is from the push notification handling):
2020-01-16 15:52:56.050306+0000 [622:80095] 'VoipPushNotification received notification', { message:
{ bsft:
{ ver: '2',
type: 'NewCall',
sdp: '...',
registrationId: '...',
privacy: 'false',
callId: '...',
callingNumber: '...',
callTo: '...',
'alert-type': 'audible',
appearance: '...',
sender: '...' } } }
2020-01-16 15:52:56.130603+0000 [622:80095] 'RNCallKit received onIncomingCall:', 'callUUID: 6e6d9195-43e5-4179-8c8c-6c9b97c33f84'
2020-01-16 15:52:56.135143+0000 [622:80095] 'RNCallKit received didDisplayIncomingCall:', 'callUUID: 224c8274-4851-4862-be2b-acc06ffb7157', 'fromPushKit: 1'
2020-01-16 15:52:56.374563+0000 [622:80095] 'RNCallKit received didDisplayIncomingCall:', 'callUUID: 6e6d9195-43e5-4179-8c8c-6c9b97c33f84', 'fromPushKit: 0'
My current workaround is to immediately end any call reported from PushKit (using the fromPushKit
parameter) in didDisplayIncomingCall
, but this is not very good user experience.
My other idea was to pass the callUUID from didReceiveIncomingPushWithPayload
to RNVoipPushNotificationManager
so that it could update the existing call instead of creating a new call, but I couldn’t find a way to pass additional paramaters.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@grit96 I ended up creating a UUID server side and send it in the push, and then I can pass that into callkit and then use it when the app loads from the Push. It feels like a giant mess with timings potentially broken etc etc, what about if your user accepts the call before the app is awake enough to do anything about it, what if the phone call was cancelled or answered elsewhere but your app is still loading up and so callkit is still “ringing”. Meh Apple.
I would say so yes - my workaround was using a timer which seems to work okay.