Browse Source

Fix an issue with conversation password not being applied to calls

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 years ago
parent
commit
d81707b496

+ 6 - 7
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -208,6 +208,7 @@ public class CallController extends BaseController {
     private WebSocketConnectionHelper webSocketConnectionHelper;
     private WebSocketConnectionHelper webSocketConnectionHelper;
     private boolean hasMCU;
     private boolean hasMCU;
     private boolean hasExternalSignalingServer;
     private boolean hasExternalSignalingServer;
+    private String conversationPassword;
 
 
     public CallController(Bundle args) {
     public CallController(Bundle args) {
         super(args);
         super(args);
@@ -216,16 +217,13 @@ public class CallController extends BaseController {
         roomId = args.getString(BundleKeys.KEY_ROOM_ID, "");
         roomId = args.getString(BundleKeys.KEY_ROOM_ID, "");
         roomToken = args.getString(BundleKeys.KEY_ROOM_TOKEN, "");
         roomToken = args.getString(BundleKeys.KEY_ROOM_TOKEN, "");
         conversationUser = args.getParcelable(BundleKeys.KEY_USER_ENTITY);
         conversationUser = args.getParcelable(BundleKeys.KEY_USER_ENTITY);
-
-        if (conversationUser == null) {
-            conversationUser = userUtils.getCurrentUser();
-        }
-
-        credentials = ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken());
+        conversationPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "");
         isVoiceOnlyCall = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false);
         isVoiceOnlyCall = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false);
 
 
         if (conversationUser.getUserId().equals("?")) {
         if (conversationUser.getUserId().equals("?")) {
             credentials = null;
             credentials = null;
+        } else {
+            credentials = ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken());
         }
         }
 
 
         baseUrl = args.getString(BundleKeys.KEY_MODIFIED_BASE_URL, "");
         baseUrl = args.getString(BundleKeys.KEY_MODIFIED_BASE_URL, "");
@@ -994,7 +992,8 @@ public class CallController extends BaseController {
     }
     }
 
 
     private void joinRoomAndCall() {
     private void joinRoomAndCall() {
-        ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken), null)
+        ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl,
+                roomToken), conversationPassword)
                 .subscribeOn(Schedulers.newThread())
                 .subscribeOn(Schedulers.newThread())
                 .observeOn(AndroidSchedulers.mainThread())
                 .observeOn(AndroidSchedulers.mainThread())
                 .retry(3)
                 .retry(3)