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);
207207- ` uuid ` : string
208208 - The ` uuid ` used for ` startCall ` or ` displayIncomingCall `
209209
210+ ### endAllCalls
211+
212+ End all ongoing connections.
213+
214+ ``` js
215+ RNCallKeep .endAllCalls ();
216+ ```
217+
210218### rejectCall
211219
212220When you reject an incoming call.
Original file line number Diff line number Diff line change 6161import java .util .Arrays ;
6262import java .util .HashMap ;
6363import java .util .List ;
64+ import java .util .Map ;
6465import java .util .ResourceBundle ;
6566
6667import static android .support .v4 .app .ActivityCompat .requestPermissions ;
@@ -192,6 +193,22 @@ public void endCall(String uuid) {
192193 Log .d (TAG , "endCall executed" );
193194 }
194195
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+
195212 @ ReactMethod
196213 public void checkPhoneAccountPermission (ReadableArray optionalPermissions , Promise promise ) {
197214 Activity currentActivity = this .getCurrentActivity ();
Original file line number Diff line number Diff line change 6363public class VoiceConnectionService extends ConnectionService {
6464 private static Boolean isAvailable = false ;
6565 private static String TAG = "RNCK:VoiceConnectionService" ;
66- private static Map <String , VoiceConnection > currentConnections = new HashMap <>();
66+ public static Map <String , VoiceConnection > currentConnections = new HashMap <>();
6767
6868 public static Connection getConnection (String connectionId ) {
6969 if (currentConnections .containsKey (connectionId )) {
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class RNCallKeep {
104104 } ;
105105
106106 endAllCalls = ( ) => {
107- isIOS ? RNCallKeepModule . endAllCalls ( ) : RNCallKeepModule . endCall ( ) ;
107+ RNCallKeepModule . endAllCalls ( ) ;
108108 } ;
109109
110110 supportConnectionService = ( ) => supportConnectionService ;
You can’t perform that action at this time.
0 commit comments