Skip to content

Commit

Permalink
Wrap rejectCall and answerIncomingCall for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Huang committed Aug 14, 2019
1 parent 7b9c1cc commit cafa5cd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`

Expand Down
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ class RNCallKeep {
};

answerIncomingCall = (uuid) => {
RNCallKeepModule.answerIncomingCall(uuid)
if (!isIOS) {
RNCallKeepModule.answerIncomingCall(uuid);
}
}

startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false ) => {
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit cafa5cd

Please sign in to comment.