Skip to content

[IOS] Return promises - #725

Closed
c960657 wants to merge 1 commit into
react-native-webrtc:masterfrom
c960657:promises-ios
Closed

c960657 wants to merge 1 commit into
react-native-webrtc:masterfrom
c960657:promises-ios

Conversation

@c960657

@c960657 c960657 commented Aug 18, 2023

Copy link
Copy Markdown
Contributor

According to the README, several functions return a Promise, but they don't.

This patch fixes this for iOS (at least for some methods).

This is an old patch from an internal company repository. It may not cover all relevant methods, but it has been battle-tested in production for years. I did not write it myself.

@c960657 c960657 changed the title Return promises on iOS [IOS ]Return promises Aug 31, 2023
@c960657 c960657 changed the title [IOS ]Return promises [IOS] Return promises Aug 31, 2023
@sboily

sboily commented Oct 18, 2026

Copy link
Copy Markdown
Member

Thanks for sharing this patch, @c960657, and sorry it waited so long. We held it until #878 was settled, since both deal with CallKit refusing a transaction. Here is where things ended up, and why I'm closing this one rather than merging it:

  • The premise is fixed in the docs. Since 4.5.0, the API reference and index.d.ts say that displayIncomingCall, startCall, answerIncomingCall, endCall, endAllCalls, setMutedCall, setOnHold and sendDTMF return nothing, on both platforms. The README had promised promises that the library never returned.
  • The main case is now reported on both platforms. A refused startCall sends the new startCallFailed event (feat: report a refused startCall with startCallFailed (iOS, Android) #911), with CallKit's errorCode on iOS, and also on Android, where Telecom can refuse the call too. A refused incoming call was already reported (didDisplayIncomingCall with error on iOS, createIncomingConnectionFailed on Android).
  • Promises on iOS only would change behaviour for existing apps. Apps call these methods without awaiting or catching them. With this patch, an endCall for a call that's already gone rejects, because CallKit refuses it with UnknownCallUUID (seen on an iPhone during feat(ios): emit didFailCallAction when CallKit refuses a requested action #878's review), and that rejection would go unhandled. Android would keep returning nothing, so the same code would behave differently per platform.
  • From reading the patch: endAllCalls passes one resolver to every transaction, so it would settle once per call, and never when there's no call. The branch also conflicts with master, which has changed a lot since 2023.

If you need to know when a hold, mute, answer or DTMF action is refused, please open an issue with the case: an event like startCallFailed could cover it on both platforms.

@sboily sboily closed this Oct 18, 2026
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.

2 participants