Skip to content

Commit

Permalink
[iOS] Add support for answering incoming call
Browse files Browse the repository at this point in the history
  • Loading branch information
dtsolis committed Oct 13, 2020
1 parent 698f795 commit cb6dbb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,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 @@ -205,6 +205,19 @@ + (void)initCallKitProvider {
[self requestTransaction:transaction];
}

RCT_EXPORT_METHOD(answerIncomingCall:(NSString *)uuidString)
{
#ifdef DEBUG
NSLog(@"[RNCallKeep][answerCall] 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 cb6dbb1

Please sign in to comment.