File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
android/src/main/java/io/wazo/callkeep Expand file tree Collapse file tree 3 files changed +19
-2
lines changed 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 @@ -94,7 +94,7 @@ class RNCallKeep {
9494 } ;
9595
9696 endAllCalls = ( ) => {
97- isIOS ? RNCallKeepModule . endAllCalls ( ) : RNCallKeepModule . endCall ( ) ;
97+ RNCallKeepModule . endAllCalls ( ) ;
9898 } ;
9999
100100 supportConnectionService = ( ) => supportConnectionService ;
You can’t perform that action at this time.
0 commit comments