File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ declare module 'react-native-callkeep' {
104
104
105
105
static setReachable ( ) : void
106
106
107
+ /**
108
+ * @description isCallActive method is available only on iOS.
109
+ */
107
110
static isCallActive ( uuid : string ) : Promise < boolean >
108
111
109
112
/**
Original file line number Diff line number Diff line change @@ -335,12 +335,19 @@ + (void)initCallKitProvider {
335
335
[self requestTransaction: transaction];
336
336
}
337
337
338
- RCT_EXPORT_METHOD (isCallActive:(NSString *)uuidString)
338
+ RCT_EXPORT_METHOD (isCallActive:(NSString *)uuidString
339
+ isCallActiveResolver:(RCTPromiseResolveBlock)resolve
340
+ rejecter:(RCTPromiseRejectBlock)reject)
339
341
{
340
342
#ifdef DEBUG
341
343
NSLog (@" [RNCallKeep][isCallActive] uuid = %@ " , uuidString);
342
344
#endif
343
- [RNCallKeep isCallActive: uuidString];
345
+ BOOL isActive = [RNCallKeep isCallActive: uuidString];
346
+ if (isActive) {
347
+ resolve (@YES );
348
+ } else {
349
+ resolve (@NO );
350
+ }
344
351
}
345
352
346
353
- (void )requestTransaction : (CXTransaction *)transaction
@@ -381,8 +388,8 @@ + (BOOL)isCallActive:(NSString *)uuidString
381
388
382
389
for (CXCall *call in callObserver.calls ){
383
390
NSLog (@" [RNCallKeep] isCallActive %@ %d ?" , call.UUID , [call.UUID isEqual: uuid]);
384
- if ([call.UUID isEqual: [[NSUUID alloc ] initWithUUIDString: uuidString]] && !call. hasConnected ){
385
- return true ;
391
+ if ([call.UUID isEqual: [[NSUUID alloc ] initWithUUIDString: uuidString]]){
392
+ return call. hasConnected ;
386
393
}
387
394
}
388
395
return false ;
You can’t perform that action at this time.
0 commit comments