File tree Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,21 @@ Be sure to set this only after your call is ready for two way audio; used both i
136136RNCallKeep .setCurrentCallActive (uuid);
137137```
138138
139+ - ` uuid ` : string
140+ - The ` uuid ` used for ` startCall ` or ` displayIncomingCall `
141+
142+ ### isCallActive
143+ _ This feature is available only on IOS._
144+
145+ Returns true if the UUID passed matches an existing and answered call.
146+ This will return true ONLY if the call exists and the user has already answered the call. It will return false
147+ if the call does not exist or has not been answered. This is exposed to both React Native and Native sides.
148+ This was exposed so a call can be canceled if ringing and the user answered on a different device.
149+
150+ ``` js
151+ RNCallKeep .isCallActive (uuid);
152+ ```
153+
139154- ` uuid ` : string
140155 - The ` uuid ` used for ` startCall ` or ` displayIncomingCall `
141156
Original file line number Diff line number Diff line change @@ -114,7 +114,9 @@ export default class RNCallKeep {
114114 static setReachable ( ) {
115115
116116 }
117+ static isCallActive ( uuid : string ) : Promise < boolean > {
117118
119+ }
118120 /**
119121 * @description supportConnectionService method is available only on Android.
120122 */
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ class RNCallKeep {
108108 }
109109 } ;
110110
111+ isCallActive = async ( uuid ) => await RNCallKeepModule . isCallActive ( uuid ) ;
112+
111113 endCall = ( uuid ) => RNCallKeepModule . endCall ( uuid ) ;
112114
113115 endAllCalls = ( ) => RNCallKeepModule . endAllCalls ( ) ;
Original file line number Diff line number Diff line change @@ -46,4 +46,7 @@ continueUserActivity:(NSUserActivity *)userActivity
4646
4747+ (void )endCallWithUUID : (NSString *)uuidString
4848 reason : (int )reason ;
49+
50+ + (BOOL )isCallActive : (NSString *)uuidString ;
51+
4952@end
Original file line number Diff line number Diff line change @@ -273,6 +273,14 @@ + (void)initCallKitProvider {
273273 [self requestTransaction: transaction];
274274}
275275
276+ RCT_EXPORT_METHOD (isCallActive:(NSString *)uuidString)
277+ {
278+ #ifdef DEBUG
279+ NSLog (@" [RNCallKeep][isCallActive] uuid = %@ " , uuidString);
280+ #endif
281+ [RNCallKeep isCallActive: uuidString];
282+ }
283+
276284- (void )requestTransaction : (CXTransaction *)transaction
277285{
278286#ifdef DEBUG
@@ -304,6 +312,20 @@ - (void)requestTransaction:(CXTransaction *)transaction
304312 }];
305313}
306314
315+ + (BOOL )isCallActive : (NSString *)uuidString
316+ {
317+ CXCallObserver *callObserver = [[CXCallObserver alloc ] init ];
318+ NSUUID *uuid = [[NSUUID alloc ] initWithUUIDString: uuidString];
319+
320+ for (CXCall *call in callObserver.calls ){
321+ NSLog (@" [RNCallKeep] isCallActive %@ %d ?" , call.UUID , [call.UUID isEqual: uuid]);
322+ if ([call.UUID isEqual: [[NSUUID alloc ] initWithUUIDString: uuidString]] && !call.hasConnected ){
323+ return true ;
324+ }
325+ }
326+ return false ;
327+ }
328+
307329+ (void )endCallWithUUID : (NSString *)uuidString
308330 reason : (int )reason
309331{
You can’t perform that action at this time.
0 commit comments