diff --git a/README.md b/README.md index 4530d883..89d89c40 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/index.js b/index.js index 91a12414..06278d59 100644 --- a/index.js +++ b/index.js @@ -103,9 +103,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 111c1261..86b64882 100644 --- a/ios/RNCallKeep/RNCallKeep.m +++ b/ios/RNCallKeep/RNCallKeep.m @@ -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