Browse Source

Use generic message rather than specific one for requesting offers

"requestoffer" messages are compatible with the generic messages, so for
simplicity the generic message is used now instead of having specific
classes just for it.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Daniel Calviño Sánchez 2 years ago
parent
commit
37db855170

+ 0 - 39
app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferOverallWebSocketMessage.kt

@@ -1,39 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * @author Andy Scherzinger
- * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
- * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.nextcloud.talk.models.json.websocket
-
-import android.os.Parcelable
-import com.bluelinelabs.logansquare.annotation.JsonField
-import com.bluelinelabs.logansquare.annotation.JsonObject
-import kotlinx.android.parcel.Parcelize
-
-@Parcelize
-@JsonObject
-data class RequestOfferOverallWebSocketMessage(
-    @JsonField(name = ["type"])
-    var type: String? = null,
-    @JsonField(name = ["message"])
-    var requestOfferOverallWebSocketMessage: RequestOfferSignalingMessage? = null
-) : Parcelable {
-    // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
-    constructor() : this(null, null)
-}

+ 0 - 39
app/src/main/java/com/nextcloud/talk/models/json/websocket/RequestOfferSignalingMessage.kt

@@ -1,39 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * @author Andy Scherzinger
- * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
- * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.nextcloud.talk.models.json.websocket
-
-import android.os.Parcelable
-import com.bluelinelabs.logansquare.annotation.JsonField
-import com.bluelinelabs.logansquare.annotation.JsonObject
-import kotlinx.android.parcel.Parcelize
-
-@Parcelize
-@JsonObject
-class RequestOfferSignalingMessage(
-    @JsonField(name = ["recipient"])
-    var actorWebSocketMessage: ActorWebSocketMessage? = null,
-    @JsonField(name = ["data"])
-    var signalingDataWebSocketMessageForOffer: SignalingDataWebSocketMessageForOffer? = null
-) : Parcelable {
-    // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
-    constructor() : this(null, null)
-}

+ 0 - 39
app/src/main/java/com/nextcloud/talk/models/json/websocket/SignalingDataWebSocketMessageForOffer.kt

@@ -1,39 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * @author Andy Scherzinger
- * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
- * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.nextcloud.talk.models.json.websocket
-
-import android.os.Parcelable
-import com.bluelinelabs.logansquare.annotation.JsonField
-import com.bluelinelabs.logansquare.annotation.JsonObject
-import kotlinx.android.parcel.Parcelize
-
-@Parcelize
-@JsonObject
-class SignalingDataWebSocketMessageForOffer(
-    @JsonField(name = ["type"])
-    var type: String? = null,
-    @JsonField(name = ["roomType"])
-    var roomType: String? = null
-) : Parcelable {
-    // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
-    constructor() : this(null, null)
-}

+ 8 - 20
app/src/main/java/com/nextcloud/talk/webrtc/WebSocketConnectionHelper.java

@@ -33,11 +33,8 @@ import com.nextcloud.talk.models.json.websocket.CallOverallWebSocketMessage;
 import com.nextcloud.talk.models.json.websocket.CallWebSocketMessage;
 import com.nextcloud.talk.models.json.websocket.HelloOverallWebSocketMessage;
 import com.nextcloud.talk.models.json.websocket.HelloWebSocketMessage;
-import com.nextcloud.talk.models.json.websocket.RequestOfferOverallWebSocketMessage;
-import com.nextcloud.talk.models.json.websocket.RequestOfferSignalingMessage;
 import com.nextcloud.talk.models.json.websocket.RoomOverallWebSocketMessage;
 import com.nextcloud.talk.models.json.websocket.RoomWebSocketMessage;
-import com.nextcloud.talk.models.json.websocket.SignalingDataWebSocketMessageForOffer;
 import com.nextcloud.talk.utils.ApiUtils;
 
 import java.util.HashMap;
@@ -146,24 +143,15 @@ public class WebSocketConnectionHelper {
         return roomOverallWebSocketMessage;
     }
 
-    RequestOfferOverallWebSocketMessage getAssembledRequestOfferModel(String sessionId, String roomType) {
-        RequestOfferOverallWebSocketMessage requestOfferOverallWebSocketMessage = new RequestOfferOverallWebSocketMessage();
-        requestOfferOverallWebSocketMessage.setType("message");
+    CallOverallWebSocketMessage getAssembledRequestOfferModel(String sessionId, String roomType) {
+        NCSignalingMessage ncSignalingMessage = new NCSignalingMessage();
+        // "to" property is not actually needed in the "requestoffer" signaling message, but it is used to set the
+        // recipient session ID in the assembled call message.
+        ncSignalingMessage.setTo(sessionId);
+        ncSignalingMessage.setRoomType(roomType);
+        ncSignalingMessage.setType("requestoffer");
 
-        RequestOfferSignalingMessage requestOfferSignalingMessage = new RequestOfferSignalingMessage();
-
-        ActorWebSocketMessage actorWebSocketMessage = new ActorWebSocketMessage();
-        actorWebSocketMessage.setType("session");
-        actorWebSocketMessage.setSessionId(sessionId);
-        requestOfferSignalingMessage.setActorWebSocketMessage(actorWebSocketMessage);
-
-        SignalingDataWebSocketMessageForOffer signalingDataWebSocketMessageForOffer = new SignalingDataWebSocketMessageForOffer();
-        signalingDataWebSocketMessageForOffer.setRoomType(roomType);
-        signalingDataWebSocketMessageForOffer.setType("requestoffer");
-        requestOfferSignalingMessage.setSignalingDataWebSocketMessageForOffer(signalingDataWebSocketMessageForOffer);
-
-        requestOfferOverallWebSocketMessage.setRequestOfferOverallWebSocketMessage(requestOfferSignalingMessage);
-        return requestOfferOverallWebSocketMessage;
+        return getAssembledCallMessageModel(ncSignalingMessage);
     }
 
     CallOverallWebSocketMessage getAssembledCallMessageModel(NCSignalingMessage ncSignalingMessage) {