File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed
android/src/main/java/io/wazo/callkeep Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,14 @@ RNCallKeep.endCall(uuid);
207
207
- ` uuid ` : string
208
208
- The ` uuid ` used for ` startCall ` or ` displayIncomingCall `
209
209
210
+ ### endAllCalls
211
+
212
+ End all ongoing connections.
213
+
214
+ ``` js
215
+ RNCallKeep .endAllCalls ();
216
+ ```
217
+
210
218
### rejectCall
211
219
212
220
When you reject an incoming call.
Original file line number Diff line number Diff line change 61
61
import java .util .Arrays ;
62
62
import java .util .HashMap ;
63
63
import java .util .List ;
64
+ import java .util .Map ;
64
65
import java .util .ResourceBundle ;
65
66
66
67
import static android .support .v4 .app .ActivityCompat .requestPermissions ;
@@ -192,6 +193,22 @@ public void endCall(String uuid) {
192
193
Log .d (TAG , "endCall executed" );
193
194
}
194
195
196
+ @ ReactMethod
197
+ public void endAllCalls () {
198
+ Log .d (TAG , "endAllCalls called" );
199
+ if (!isConnectionServiceAvailable () || !hasPhoneAccount ()) {
200
+ return ;
201
+ }
202
+
203
+ Map <String , VoiceConnection > currentConnections = VoiceConnectionService .currentConnections ;
204
+ for (Map .Entry <String , VoiceConnection > connectionEntry : currentConnections .entrySet ()) {
205
+ Connection connectionToEnd = connectionEntry .getValue ();
206
+ connectionToEnd .onDisconnect ();
207
+ }
208
+
209
+ Log .d (TAG , "endAllCalls executed" );
210
+ }
211
+
195
212
@ ReactMethod
196
213
public void checkPhoneAccountPermission (ReadableArray optionalPermissions , Promise promise ) {
197
214
Activity currentActivity = this .getCurrentActivity ();
Original file line number Diff line number Diff line change 63
63
public class VoiceConnectionService extends ConnectionService {
64
64
private static Boolean isAvailable = false ;
65
65
private static String TAG = "RNCK:VoiceConnectionService" ;
66
- private static Map <String , VoiceConnection > currentConnections = new HashMap <>();
66
+ public static Map <String , VoiceConnection > currentConnections = new HashMap <>();
67
67
68
68
public static Connection getConnection (String connectionId ) {
69
69
if (currentConnections .containsKey (connectionId )) {
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class RNCallKeep {
104
104
} ;
105
105
106
106
endAllCalls = ( ) => {
107
- isIOS ? RNCallKeepModule . endAllCalls ( ) : RNCallKeepModule . endCall ( ) ;
107
+ RNCallKeepModule . endAllCalls ( ) ;
108
108
} ;
109
109
110
110
supportConnectionService = ( ) => supportConnectionService ;
You can’t perform that action at this time.
0 commit comments