Skip to content

Commit e2cffa8

Browse files
author
Kyle Kurz
authored
Merge pull request #35 from sangoma/defineFunctionsNotOniOS
Wrap rejectCall and answerIncomingCall for iOS
2 parents 7b9c1cc + cafa5cd commit e2cffa8

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ RNCallKeep.displayIncomingCall(uuid, handle, localizedCallerName);
137137
- `false` (default)
138138
- `true` (you know... when not false)
139139

140+
### answerIncomingCall
141+
_This feature is available only on Android._
142+
143+
Use this to tell the sdk a user answered a call from the app UI.
144+
145+
```js
146+
RNCallKeep.answerIncomingCall(uuid)
147+
```
148+
- `uuid`: string
149+
- The `uuid` used for `startCall` or `displayIncomingCall`
150+
140151

141152
### startCall
142153

@@ -193,6 +204,17 @@ When you finish an incoming/outgoing call.
193204
RNCallKeep.endCall(uuid);
194205
```
195206

207+
- `uuid`: string
208+
- The `uuid` used for `startCall` or `displayIncomingCall`
209+
210+
### rejectCall
211+
212+
When you reject an incoming call.
213+
214+
```js
215+
RNCallKeep.rejectCall(uuid);
216+
```
217+
196218
- `uuid`: string
197219
- The `uuid` used for `startCall` or `displayIncomingCall`
198220

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class RNCallKeep {
5555
};
5656

5757
answerIncomingCall = (uuid) => {
58-
RNCallKeepModule.answerIncomingCall(uuid)
58+
if (!isIOS) {
59+
RNCallKeepModule.answerIncomingCall(uuid);
60+
}
5961
}
6062

6163
startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false ) => {
@@ -85,8 +87,16 @@ class RNCallKeep {
8587
RNCallKeepModule.reportEndCallWithUUID(uuid, reason);
8688
}
8789

90+
/*
91+
* Android explicitly states we reject a call
92+
* On iOS we just notify of an endCall
93+
*/
8894
rejectCall = (uuid) => {
89-
RNCallKeepModule.rejectCall(uuid);
95+
if (!isIOS) {
96+
RNCallKeepModule.rejectCall(uuid);
97+
} else {
98+
RNCallKeepModule.endCall(uuid);
99+
}
90100
}
91101

92102
endCall = (uuid) => {

0 commit comments

Comments
 (0)