瀏覽代碼

Split calls to another API function

Signed-off-by: Joas Schilling <coding@schilljs.com>
Joas Schilling 4 年之前
父節點
當前提交
8e80c9fb99

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

@@ -1273,7 +1273,7 @@ public class CallController extends BaseController {
             inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
         }
 
-        int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
+        int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {1});
 
         ncApi.joinCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken), inCallFlag)
                 .subscribeOn(Schedulers.io())
@@ -1558,7 +1558,7 @@ public class CallController extends BaseController {
     }
 
     private void hangupNetworkCalls(boolean shutDownView) {
-        int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
+        int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {1});
 
         ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
                 .subscribeOn(Schedulers.io())
@@ -1686,7 +1686,7 @@ public class CallController extends BaseController {
 
     private void getPeersForCall() {
         Log.d(TAG, "getPeersForCall");
-        int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
+        int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {1});
 
         ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
                 .subscribeOn(Schedulers.io())

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java

@@ -209,7 +209,7 @@ public class CallNotificationController extends BaseController {
     }
 
     private void checkIfAnyParticipantsRemainInRoom() {
-        int apiVersion = ApiUtils.getConversationApiVersion(userBeingCalled, new int[] {1});
+        int apiVersion = ApiUtils.getCallApiVersion(userBeingCalled, new int[] {1});
 
         ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, userBeingCalled.getBaseUrl(),
                                                                   currentConversation.getToken()))

+ 4 - 0
app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java

@@ -111,6 +111,10 @@ public class ApiUtils {
         return baseUrl + ocsApiVersion + "/cloud/capabilities";
     }
 
+    public static int getCallApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
+        return getConversationApiVersion(capabilities, versions);
+    }
+
     public static int getConversationApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
         boolean hasApiV4 = false;
         for (int version : versions) {