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
136
136
RNCallKeep .setCurrentCallActive (uuid);
137
137
```
138
138
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
+
139
154
- ` uuid ` : string
140
155
- The ` uuid ` used for ` startCall ` or ` displayIncomingCall `
141
156
Original file line number Diff line number Diff line change @@ -114,7 +114,9 @@ export default class RNCallKeep {
114
114
static setReachable ( ) {
115
115
116
116
}
117
+ static isCallActive ( uuid : string ) : Promise < boolean > {
117
118
119
+ }
118
120
/**
119
121
* @description supportConnectionService method is available only on Android.
120
122
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ class RNCallKeep {
108
108
}
109
109
} ;
110
110
111
+ isCallActive = async ( uuid ) => await RNCallKeepModule . isCallActive ( uuid ) ;
112
+
111
113
endCall = ( uuid ) => RNCallKeepModule . endCall ( uuid ) ;
112
114
113
115
endAllCalls = ( ) => RNCallKeepModule . endAllCalls ( ) ;
Original file line number Diff line number Diff line change @@ -46,4 +46,7 @@ continueUserActivity:(NSUserActivity *)userActivity
46
46
47
47
+ (void )endCallWithUUID : (NSString *)uuidString
48
48
reason : (int )reason ;
49
+
50
+ + (BOOL )isCallActive : (NSString *)uuidString ;
51
+
49
52
@end
Original file line number Diff line number Diff line change @@ -273,6 +273,14 @@ + (void)initCallKitProvider {
273
273
[self requestTransaction: transaction];
274
274
}
275
275
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
+
276
284
- (void )requestTransaction : (CXTransaction *)transaction
277
285
{
278
286
#ifdef DEBUG
@@ -304,6 +312,20 @@ - (void)requestTransaction:(CXTransaction *)transaction
304
312
}];
305
313
}
306
314
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
+
307
329
+ (void )endCallWithUUID : (NSString *)uuidString
308
330
reason : (int )reason
309
331
{
You can’t perform that action at this time.
0 commit comments