Skip to content

Commit e849f27

Browse files
committed
Adding the possibility to add a completionHandler for the reportNewIncomingCall. Which is usefull if you want to tell the pushkit you handled the VoIP notification only after the call was successfully reported.
1 parent eacefd2 commit e849f27

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ios/RNCallKeep/RNCallKeep.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ continueUserActivity:(NSUserActivity *)userActivity
3333
hasVideo:(BOOL)hasVideo
3434
localizedCallerName:(NSString * _Nullable)localizedCallerName
3535
fromPushKit:(BOOL)fromPushKit
36-
payload:(NSDictionary * _Nullable)payload;
36+
payload:(NSDictionary * _Nullable)payload
37+
withCompletionHandler:(void (^_Nullable)(void))completion;
3738

3839
+ (void)endCallWithUUID:(NSString *)uuidString
3940
reason:(int)reason;

ios/RNCallKeep/RNCallKeep.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ + (void)initCallKitProvider {
151151
hasVideo:(BOOL)hasVideo
152152
localizedCallerName:(NSString * _Nullable)localizedCallerName)
153153
{
154-
[RNCallKeep reportNewIncomingCall: uuidString handle:handle handleType:handleType hasVideo:hasVideo localizedCallerName:localizedCallerName fromPushKit: NO payload:nil];
154+
[RNCallKeep reportNewIncomingCall: uuidString handle:handle handleType:handleType hasVideo:hasVideo localizedCallerName:localizedCallerName fromPushKit: NO payload:nil withCompletionHandler:nil];
155155
}
156156

157157
RCT_EXPORT_METHOD(startCall:(NSString *)uuidString
@@ -340,6 +340,7 @@ + (void)reportNewIncomingCall:(NSString *)uuidString
340340
localizedCallerName:(NSString * _Nullable)localizedCallerName
341341
fromPushKit:(BOOL)fromPushKit
342342
payload:(NSDictionary * _Nullable)payload
343+
withCompletionHandler:(void (^_Nullable)(void))completion
343344
{
344345
#ifdef DEBUG
345346
NSLog(@"[RNCallKeep][reportNewIncomingCall] uuidString = %@", uuidString);
@@ -373,6 +374,9 @@ + (void)reportNewIncomingCall:(NSString *)uuidString
373374
[callKeep configureAudioSession];
374375
}
375376
}
377+
if (completion != nil) {
378+
completion();
379+
}
376380
}];
377381
}
378382

@@ -383,7 +387,7 @@ + (void)reportNewIncomingCall:(NSString *)uuidString
383387
localizedCallerName:(NSString * _Nullable)localizedCallerName
384388
fromPushKit:(BOOL)fromPushKit
385389
{
386-
[RNCallKeep reportNewIncomingCall: uuidString handle:handle handleType:handleType hasVideo:hasVideo localizedCallerName:localizedCallerName fromPushKit: fromPushKit payload:nil];
390+
[RNCallKeep reportNewIncomingCall: uuidString handle:handle handleType:handleType hasVideo:hasVideo localizedCallerName:localizedCallerName fromPushKit: fromPushKit payload:nil withCompletionHandler:nil];
387391
}
388392

389393
- (BOOL)lessThanIos10_2

0 commit comments

Comments
 (0)