diff --git a/README.md b/README.md index cf25d863..fe4d2d27 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,17 @@ RNCallKeep.displayIncomingCall(uuid, handle, localizedCallerName); - `false` (default) - `true` (you know... when not false) +### answerIncomingCall +_This feature is available only on Android._ + +Use this to tell the sdk a user answered a call from the app UI. + +```js +RNCallKeep.answerIncomingCall(uuid) +``` +- `uuid`: string + - The `uuid` used for `startCall` or `displayIncomingCall` + ### startCall @@ -193,6 +204,17 @@ When you finish an incoming/outgoing call. RNCallKeep.endCall(uuid); ``` +- `uuid`: string + - The `uuid` used for `startCall` or `displayIncomingCall` + +### rejectCall + +When you reject an incoming call. + +```js +RNCallKeep.rejectCall(uuid); +``` + - `uuid`: string - The `uuid` used for `startCall` or `displayIncomingCall` diff --git a/index.js b/index.js index bed9d2da..83c3ec45 100644 --- a/index.js +++ b/index.js @@ -55,7 +55,9 @@ class RNCallKeep { }; answerIncomingCall = (uuid) => { - RNCallKeepModule.answerIncomingCall(uuid) + if (!isIOS) { + RNCallKeepModule.answerIncomingCall(uuid); + } } startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false ) => { @@ -85,8 +87,16 @@ class RNCallKeep { RNCallKeepModule.reportEndCallWithUUID(uuid, reason); } + /* + * Android explicitly states we reject a call + * On iOS we just notify of an endCall + */ rejectCall = (uuid) => { - RNCallKeepModule.rejectCall(uuid); + if (!isIOS) { + RNCallKeepModule.rejectCall(uuid); + } else { + RNCallKeepModule.endCall(uuid); + } } endCall = (uuid) => {