Skip to content

Commit

Permalink
Merge pull request react-native-webrtc#300 from dtsolis/answerIncoming
Browse files Browse the repository at this point in the history
[iOS] Add support for answering incoming call
  • Loading branch information
sboily authored Feb 19, 2021
2 parents ba4197a + 9ccc663 commit 8e56b0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ RNCallKeep.displayIncomingCall(uuid, handle, localizedCallerName);
- `android`: object (currently no-op)

### answerIncomingCall
_This feature is available only on Android._

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

Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ class RNCallKeep {
};

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

startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false) => {
Expand Down
13 changes: 13 additions & 0 deletions ios/RNCallKeep/RNCallKeep.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ + (void)initCallKitProvider {
[self requestTransaction:transaction];
}

RCT_EXPORT_METHOD(answerIncomingCall:(NSString *)uuidString)
{
#ifdef DEBUG
NSLog(@"[RNCallKeep][answerIncomingCall] uuidString = %@", uuidString);
#endif
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
CXAnswerCallAction *answerCallAction = [[CXAnswerCallAction alloc] initWithCallUUID:uuid];
CXTransaction *transaction = [[CXTransaction alloc] init];
[transaction addAction:answerCallAction];

[self requestTransaction:transaction];
}

RCT_EXPORT_METHOD(endCall:(NSString *)uuidString)
{
#ifdef DEBUG
Expand Down

0 comments on commit 8e56b0a

Please sign in to comment.