Skip to content

Commit 8e56b0a

Browse files
author
Sylvain Boily
authored
Merge pull request #300 from dtsolis/answerIncoming
[iOS] Add support for answering incoming call
2 parents ba4197a + 9ccc663 commit 8e56b0a

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ RNCallKeep.displayIncomingCall(uuid, handle, localizedCallerName);
237237
- `android`: object (currently no-op)
238238

239239
### answerIncomingCall
240-
_This feature is available only on Android._
241240

242241
Use this to tell the sdk a user answered a call from the app UI.
243242

index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ class RNCallKeep {
103103
};
104104

105105
answerIncomingCall = (uuid) => {
106-
if (!isIOS) {
107-
RNCallKeepModule.answerIncomingCall(uuid);
108-
}
106+
RNCallKeepModule.answerIncomingCall(uuid);
109107
};
110108

111109
startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false) => {

ios/RNCallKeep/RNCallKeep.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@ + (void)initCallKitProvider {
220220
[self requestTransaction:transaction];
221221
}
222222

223+
RCT_EXPORT_METHOD(answerIncomingCall:(NSString *)uuidString)
224+
{
225+
#ifdef DEBUG
226+
NSLog(@"[RNCallKeep][answerIncomingCall] uuidString = %@", uuidString);
227+
#endif
228+
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
229+
CXAnswerCallAction *answerCallAction = [[CXAnswerCallAction alloc] initWithCallUUID:uuid];
230+
CXTransaction *transaction = [[CXTransaction alloc] init];
231+
[transaction addAction:answerCallAction];
232+
233+
[self requestTransaction:transaction];
234+
}
235+
223236
RCT_EXPORT_METHOD(endCall:(NSString *)uuidString)
224237
{
225238
#ifdef DEBUG

0 commit comments

Comments
 (0)