From cb6dbb1a4871273ad9270e8e0959b70bf99a0067 Mon Sep 17 00:00:00 2001 From: Tsolis Dimitris Sotiris Date: Tue, 13 Oct 2020 17:52:31 +0300 Subject: [PATCH 1/2] [iOS] Add support for answering incoming call --- index.js | 4 +--- ios/RNCallKeep/RNCallKeep.m | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f5e223fb..b07e4e6c 100644 --- a/index.js +++ b/index.js @@ -87,9 +87,7 @@ class RNCallKeep { }; answerIncomingCall = (uuid) => { - if (!isIOS) { - RNCallKeepModule.answerIncomingCall(uuid); - } + RNCallKeepModule.answerIncomingCall(uuid); }; startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false ) => { diff --git a/ios/RNCallKeep/RNCallKeep.m b/ios/RNCallKeep/RNCallKeep.m index 8179e168..e88ad89f 100644 --- a/ios/RNCallKeep/RNCallKeep.m +++ b/ios/RNCallKeep/RNCallKeep.m @@ -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 From 9ccc663ca37cbc2601e52f5078080e66713c6453 Mon Sep 17 00:00:00 2001 From: Tsolis Dimitris Sotiris Date: Tue, 8 Dec 2020 11:58:09 +0200 Subject: [PATCH 2/2] Update readme --- README.md | 1 - ios/RNCallKeep/RNCallKeep.m | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ac892673..7a3ac906 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,6 @@ RNCallKeep.displayIncomingCall(uuid, handle, localizedCallerName); - `true` (you know... when not false) ### answerIncomingCall -_This feature is available only on Android._ Use this to tell the sdk a user answered a call from the app UI. diff --git a/ios/RNCallKeep/RNCallKeep.m b/ios/RNCallKeep/RNCallKeep.m index e88ad89f..3dc16e00 100644 --- a/ios/RNCallKeep/RNCallKeep.m +++ b/ios/RNCallKeep/RNCallKeep.m @@ -208,7 +208,7 @@ + (void)initCallKitProvider { RCT_EXPORT_METHOD(answerIncomingCall:(NSString *)uuidString) { #ifdef DEBUG - NSLog(@"[RNCallKeep][answerCall] uuidString = %@", uuidString); + NSLog(@"[RNCallKeep][answerIncomingCall] uuidString = %@", uuidString); #endif NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString]; CXAnswerCallAction *answerCallAction = [[CXAnswerCallAction alloc] initWithCallUUID:uuid];