Skip to content

Commit

Permalink
Merge pull request #35 from sangoma/defineFunctionsNotOniOS
Browse files Browse the repository at this point in the history
Wrap rejectCall and answerIncomingCall for iOS
  • Loading branch information
Kyle Kurz authored Aug 14, 2019
2 parents 7b9c1cc + cafa5cd commit e2cffa8
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 e2cffa8

Please sign in to comment.