Skip to content

fix(ios): apply the setup() options to CallKit right away - #907

Merged
sboily merged 2 commits into
masterfrom
fix/ios-setup-again
Oct 17, 2026
Merged

sboily merged 2 commits into
masterfrom
fix/ios-setup-again

Conversation

@sboily

@sboily sboily commented Oct 17, 2026

Copy link
Copy Markdown
Member

Takes over #732 by @c960657.

The problem

When the module loads, init builds the CallKit provider from the settings that setup() stored during the previous launch (so a VoIP push can be reported before JavaScript runs). setup() then stores the new options, but initCallKitProvider only creates a provider, so the existing one keeps the old configuration:

  • after an app update that changes its setup() options (or any option computed at runtime), CallKit uses the previous launch's options until the next launch;
  • calling setup() again, as [IOS] Allow calling setup() multiple times #732 wanted for options that depend on user preferences, never changes CallKit.

The change

setup() sets sharedProvider.configuration when the provider exists (the approach of #732). Unlike #732, it keeps the documented rule that setup() from JavaScript is ignored after a setup from native code ([RNCallKeep setup:] in the app delegate): #732 let JavaScript override it. A native app can now call [RNCallKeep setup:] again to change the options; that went through the JavaScript method, which returned early. docs/setup.md and the setSettings section of docs/api.md say how to change the options.

Tests

The Mac Catalyst harness compiles RNCallKeep.m with React stubs and reads callKeepProvider.configuration (options A: 1 call group, in Recents, no video; options B: 3 groups, not in Recents, video):

Scenario master #732 this PR
A stored by a previous launch, then setup(B) A B B
setup(A), then setup(B) A B B
native setup(A), then JavaScript setup(B) A B A (documented)
native setup(A), then native setup(B) A B B

On an iPhone 15 Pro Max with iOS 27, the example app had stored includesCallsInRecents: true during earlier launches; a build of this branch whose setup() passes false showed an incoming call, answered and hung up normally, and the call did not appear in the Phone app's Recents (with master it would: the provider keeps true).

When the module loads, it builds the CallKit provider from the settings
stored by setup() during the previous launch. setup() then stored the new
options but left the provider alone (initCallKitProvider only creates it),
so CallKit kept the previous launch's options, and a second setup() never
changed them.

setup() now sets the provider's configuration when the provider exists.
The Mac Catalyst harness, which compiles RNCallKeep.m and reads
callKeepProvider.configuration, shows it with options A stored and
setup(B) (relaunch), and with setup(A) then setup(B): master keeps A,
this change applies B.

As documented, setup() from JavaScript is still ignored after a setup
from native code; calling [RNCallKeep setup:] again now updates the
options too (it went through the JavaScript method, which returned early).

Based on #732 by Christian Schmidt, which applied the configuration the
same way but also let JavaScript override a native setup.

Co-authored-by: Christian Schmidt <cs@relatel.dk>
@sboily
sboily merged commit 4147e33 into master Oct 17, 2026
4 checks passed
@sboily
sboily deleted the fix/ios-setup-again branch October 17, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant