Skip to content

Commit 460a14f

Browse files
committed
checkIfActiveCall
1 parent d21c9c3 commit 460a14f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ios/RNCallKeep/RNCallKeep.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#import <React/RCTEventEmitter.h>
1616

1717
@interface RNCallKeep : RCTEventEmitter <CXProviderDelegate>
18-
1918
@property (nonatomic, strong) CXCallController *callKeepCallController;
2019
@property (nonatomic, strong) CXProvider *callKeepProvider;
2120

@@ -37,4 +36,7 @@ continueUserActivity:(NSUserActivity *)userActivity
3736

3837
+ (void)endCallWithUUID:(NSString *)uuidString
3938
reason:(int)reason;
39+
40+
+ (BOOL)checkIfActiveCall:(NSString *)uuidString;
41+
4042
@end

ios/RNCallKeep/RNCallKeep.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,20 @@ - (void)requestTransaction:(CXTransaction *)transaction
304304
}];
305305
}
306306

307+
+ (BOOL)checkIfActiveCall:(NSString *)uuidString
308+
{
309+
CXCallObserver *callObserver = [[CXCallObserver alloc] init];
310+
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
311+
312+
for(CXCall *call in callObserver.calls){
313+
NSLog(@"Connected: %d", [call.UUID isEqual:uuid]);
314+
if([call.UUID isEqual:[[NSUUID alloc] initWithUUIDString:uuidString]] && !call.hasConnected){
315+
return true;
316+
}
317+
}
318+
return false;
319+
}
320+
307321
+ (void)endCallWithUUID:(NSString *)uuidString
308322
reason:(int)reason
309323
{

0 commit comments

Comments
 (0)