Conversation
…tification center
There was a problem hiding this comment.
Pull request overview
Adds iOS VoIP call support to the library by integrating PushKit + CallKit on the native side and exposing the resulting events to JS via a new useVoIPEvents hook plus a getVoipToken() accessor.
Changes:
- Added native PushKit support (
FishjamVoIPPush) and bridgedvoipPushEvent+ synchronousgetVoipTokento JS. - Extended CallKit handling to emit an
answeraction and to initialize PushKit observing when the native event emitter starts observing. - Added JS-facing APIs:
useVoIPEventshook andgetVoipTokenexport; wired new native event name into the JS event pipeline.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/useVoIPEvents.ts | New hook listening to CallKit + PushKit event channels and seeding the current VoIP token on mount. |
| src/PushKit.ts | Adds JS getVoipToken() wrapper for the native synchronous getter. |
| src/index.ts | Exports new VoIP APIs (getVoipToken, useVoIPEvents, related types). |
| src/EventEmitter.ts | Registers voipPushEvent as a supported native event on the JS side. |
| src/CallKit.ts | Adds answer action type and a JS wrapper for reportIncomingCall. |
| src/useCallKit.ts | Minor formatting change in imports. |
| ios/RCTWebRTC/WebRTCModule+PushKit.{h,m} | Bridges PushKit token/incoming events to JS and exports getVoipToken. |
| ios/RCTWebRTC/FishjamVoIPPush.{h,m} | Implements PushKit registry/delegate, token tracking, and reporting incoming calls to CallKit. |
| ios/RCTWebRTC/CallKitManager.{h,m} | Makes manager a singleton, adds reportIncomingCall..., and emits answer callback. |
| ios/RCTWebRTC/WebRTCModule+CallKit.m | Uses singleton CallKitManager, emits answer, and starts/stops PushKit observing with event observing lifecycle. |
| ios/RCTWebRTC/WebRTCModule.{h,m} | Adds voipPushEvent constant and includes it in supportedEvents. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dict[@"displayName"] = displayName; | ||
| } | ||
|
|
||
| [[CallKitManager shared] reportIncomingCallWithDisplayName:displayName isVideo:isVideo]; |
There was a problem hiding this comment.
question: What's going to happen if this is called before JS is ready? Will the hook be retried? The native method can be called before the js loads.
There was a problem hiding this comment.
good catch, right now the incoming payload doesn't show up when the app is not even in background. I'll add retries to deliver the payload to js side
There was a problem hiding this comment.
I think I'd rather make the JS pull/check if there is any payload waiting. Should be much simpler.
There was a problem hiding this comment.
yes, that's what I've done, changes will be ready in a minute, I also did the same for accepting the call because it was also prone to race condition if the user accepted the call but JS hasn't lodaded yet
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/CallKit.ts:17
CallKitActionmodelsstarted/answer/endedasundefined, but the native side emits these keys withNSNull(which becomesnullin JS). Updating the types tonullbetter reflects the runtime payload and avoids misleading callback typings for consumers ofuseCallKitEvent.
export type CallKitAction = {
started?: undefined;
answer?: undefined;
ended?: undefined;
failed?: string;
muted?: boolean;
held?: boolean;
};
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
Adds VoIP calling support (iOS) to
@fishjam-cloud/react-native-webrtc: incoming calls now show the native CallKit UI, and the SDK receives VoIP pushes via PushKit so calls ring even when the app is backgrounded or killed. Everything is surfaced to JS through a singleuseVoIPEventshook.What changed
CallKitManageris now a shared singleton withreportIncomingCall…, which callsreportNewIncomingCallto show the system call UI, and emits ananswerevent when the user accepts.FishjamVoIPPushowns thePKPushRegistry/ delegate on a dedicated serial queue — handles the VoIP token, and ondidReceiveIncomingPushreports the call to CallKit (with an always-report safety net so iOS never throttles us). Registered at launch from the AppDelegate.answer/ended) ride the existingcallKitActionPerformedchannel; PushKit events (registered/incoming) ride a newvoipPushEventchannel. Added a synchronousgetVoipTokengetter.PushKit.ts(getVoipToken) and an updateduseVoIPEvents({ onIncoming, onAnswered, onEnded, onRegistered })hook that listens on both channels and seeds the current token on mount (covers the token-issued-before-subscribe race).voip-call): wiresuseVoIPEvents, plus AppDelegate registration,aps-environmententitlement, and thevoipbackground mode.Notes