2222static NSString *const RNCallKitPerformAnswerCallAction = @" RNCallKitPerformAnswerCallAction" ;
2323static NSString *const RNCallKitPerformEndCallAction = @" RNCallKitPerformEndCallAction" ;
2424static NSString *const RNCallKitDidActivateAudioSession = @" RNCallKitDidActivateAudioSession" ;
25+ static NSString *const RNCallKitDidDisplayIncomingCall = @" RNCallKitDidDisplayIncomingCall" ;
2526
2627@implementation RNCallKit
2728{
@@ -60,11 +61,12 @@ - (void)dealloc
6061- (NSArray <NSString *> *)supportedEvents
6162{
6263 return @[
63- RNCallKitDidReceiveStartCallAction,
64- RNCallKitPerformAnswerCallAction,
65- RNCallKitPerformEndCallAction,
66- RNCallKitDidActivateAudioSession
67- ];
64+ RNCallKitDidReceiveStartCallAction,
65+ RNCallKitPerformAnswerCallAction,
66+ RNCallKitPerformEndCallAction,
67+ RNCallKitDidActivateAudioSession,
68+ RNCallKitDidDisplayIncomingCall
69+ ];
6870}
6971
7072RCT_EXPORT_METHOD (setup:(NSDictionary *)options)
@@ -104,6 +106,7 @@ - (void)dealloc
104106 callUpdate.localizedCallerName = localizedCallerName;
105107
106108 [self .callKitProvider reportNewIncomingCallWithUUID: uuid update: callUpdate completion: ^(NSError * _Nullable error) {
109+ [self sendEventWithName: RNCallKitDidDisplayIncomingCall body: @{ @" error" : error ? error.localizedDescription : @" " }];
107110 if (error == nil ) {
108111 // Workaround per https://forums.developer.apple.com/message/169511
109112 if ([self lessThanIos10_2 ]) {
@@ -309,7 +312,7 @@ + (BOOL)application:(UIApplication *)application
309312
310313+ (BOOL )application : (UIApplication *)application
311314continueUserActivity : (NSUserActivity *)userActivity
312- restorationHandler : (void (^)(NSArray * __nullable restorableObjects))restorationHandler
315+ restorationHandler : (void (^)(NSArray * __nullable restorableObjects))restorationHandler
313316{
314317#ifdef DEBUG
315318 NSLog (@" [RNCallKit][application:continueUserActivity]" );
@@ -319,25 +322,25 @@ + (BOOL)application:(UIApplication *)application
319322 NSString *handle;
320323 BOOL isAudioCall = [userActivity.activityType isEqualToString: INStartAudioCallIntentIdentifier];
321324 BOOL isVideoCall = [userActivity.activityType isEqualToString: INStartVideoCallIntentIdentifier];
322-
325+
323326 if (isAudioCall) {
324327 INStartAudioCallIntent *startAudioCallIntent = (INStartAudioCallIntent *)interaction.intent ;
325328 contact = [startAudioCallIntent.contacts firstObject ];
326329 } else if (isVideoCall) {
327330 INStartVideoCallIntent *startVideoCallIntent = (INStartVideoCallIntent *)interaction.intent ;
328331 contact = [startVideoCallIntent.contacts firstObject ];
329332 }
330-
333+
331334 if (contact != nil ) {
332335 handle = contact.personHandle .value ;
333336 }
334-
337+
335338 if (handle != nil && handle.length > 0 ){
336339 NSDictionary *userInfo = @{
337340 @" handle" : handle,
338341 @" video" : @(isVideoCall)
339342 };
340-
343+
341344 [[NSNotificationCenter defaultCenter ] postNotificationName: RNCallKitHandleStartCallNotification
342345 object: self
343346 userInfo: userInfo];
0 commit comments