From 94981d5f371537a50dd9fb1204ca9555fd427492 Mon Sep 17 00:00:00 2001
From: ganfra <francoisg@element.io>
Date: Tue, 13 Jul 2021 18:13:31 +0200
Subject: [PATCH] WebRTC call: allow starting call when already one

---
 .../home/room/detail/StartCallActionsHandler.kt   | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt
index 3fedf19170..f8e4d0b7b7 100644
--- a/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt
@@ -26,7 +26,6 @@ import im.vector.app.core.utils.PERMISSIONS_FOR_VIDEO_IP_CALL
 import im.vector.app.core.utils.checkPermissions
 import im.vector.app.features.call.webrtc.WebRtcCallManager
 import im.vector.app.features.settings.VectorPreferences
-import org.matrix.android.sdk.api.session.widgets.model.WidgetType
 
 class StartCallActionsHandler(
         private val roomId: String,
@@ -36,7 +35,7 @@ class StartCallActionsHandler(
         private val roomDetailViewModel: RoomDetailViewModel,
         private val startCallActivityResultLauncher: ActivityResultLauncher<Array<String>>,
         private val showDialogWithMessage: (String) -> Unit,
-        private val onTapToReturnToCall: () -> Unit)  {
+        private val onTapToReturnToCall: () -> Unit) {
 
     fun onVideoCallClicked() {
         handleCallRequest(true)
@@ -61,16 +60,8 @@ class StartCallActionsHandler(
             }
             2    -> {
                 val currentCall = callManager.getCurrentCall()
-                if (currentCall != null) {
-                    // resume existing if same room, if not prompt to kill and then restart new call?
-                    if (currentCall.signalingRoomId == roomId) {
-                        onTapToReturnToCall()
-                    }
-                    //                        else {
-                    // TODO might not work well, and should prompt
-                    //                            webRtcPeerConnectionManager.endCall()
-                    //                            safeStartCall(it, isVideoCall)
-                    //                        }
+                if (currentCall?.signalingRoomId == roomId) {
+                    onTapToReturnToCall()
                 } else if (!state.isAllowedToStartWebRTCCall) {
                     showDialogWithMessage(fragment.getString(
                             if (state.isDm()) {