Skip to content

Commit cb6dbb1

Browse files
committed
[iOS] Add support for answering incoming call
1 parent 698f795 commit cb6dbb1

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

index.js

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

8989
answerIncomingCall = (uuid) => {
90-
if (!isIOS) {
91-
RNCallKeepModule.answerIncomingCall(uuid);
92-
}
90+
RNCallKeepModule.answerIncomingCall(uuid);
9391
};
9492

9593
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
@@ -205,6 +205,19 @@ + (void)initCallKitProvider {
205205
[self requestTransaction:transaction];
206206
}
207207

208+
RCT_EXPORT_METHOD(answerIncomingCall:(NSString *)uuidString)
209+
{
210+
#ifdef DEBUG
211+
NSLog(@"[RNCallKeep][answerCall] uuidString = %@", uuidString);
212+
#endif
213+
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
214+
CXAnswerCallAction *answerCallAction = [[CXAnswerCallAction alloc] initWithCallUUID:uuid];
215+
CXTransaction *transaction = [[CXTransaction alloc] init];
216+
[transaction addAction:answerCallAction];
217+
218+
[self requestTransaction:transaction];
219+
}
220+
208221
RCT_EXPORT_METHOD(endCall:(NSString *)uuidString)
209222
{
210223
#ifdef DEBUG

0 commit comments

Comments
 (0)