Closed zxcpoiu closed 4 years ago
I'll leave it here for few days/weeks for feedback.
Please merge this. Without this, it's a hit or miss. With this, JS bridge works 100% of the time. Tested on iPhone 6 (iOS 12.4.5)
by using this, is it possible to call reportNewIncomingCall
from JS layer and then call completion()
?
@tsugitta
No, I don't think so. Apple says should invoke reportNewIncomingCall
ASAP and in the same block of the function. We might have successfully to call reportNewIncomingCall
on the js side, but it's risky, because no one knows what is the algorithm behind the scene of current ios version that determine when to kill your app.
When I call reportNewIncomingCall
passing the completion handler to withCompletionHandler
property, on js side, have I to call VoipPushNotification.onVoipNotificationCompleted(notification.uuid);
to let iOS know that it's finished?
Right after calling the reportNewIncomingCall
method on the native site, my phone starts ringing but I'm still doing some jobs on js side, like registration. It's that right? I thought that only after I would call the completion method, It would starts the call flow. Thank you in advance if someone can clarify the logic behind it.
Motivation
From iOS 11+, we should use
Apple asked us to call
completion()
when we've done the job.I've observed that if we call
completion()
directly afterreportCallkit
on the native side in the same block ofdidReceiveIncomingPushWithPayload
, since react native initialized asynchronously and we might have some works to do on the JS side to initiate a call, in this case, if we callcompletion()
too early, it may cause our js job to stop executing. ( The system revoke the execution lock when we callcompletion()
I guess. And seems different iOS version acts differently when callcompletion()
)This may be useful to someone.
Usage:
https://github.com/react-native-webrtc/react-native-voip-push-notification/pull/52/commits/d519beed33bd7c15ac3db7a9fec7190da6a825ec