Prepare more models for websockets communication

This commit is contained in:
Mario Danic 2018-10-11 12:19:55 +02:00
parent 0f0509c2d4
commit a488ebafdf
3 changed files with 92 additions and 16 deletions

View File

@ -0,0 +1,36 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* 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 com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
import lombok.Data;
@Data
@JsonObject
@Parcel
public class CallOverallWebSocketMessage extends BaseWebSocketMessage {
@JsonField(name = "message")
CallWebSocketMessage callWebSocketMessage;
}

View File

@ -0,0 +1,40 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* 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 com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
import org.parceler.Parcel;
import lombok.Data;
@Data
@JsonObject
@Parcel
public class CallWebSocketMessage {
@JsonField(name = "recipient")
RecipientWebSocketMessage recipientWebSocketMessage;
@JsonField(name = "data")
NCMessageWrapper ncMessageWrapper;
}

View File

@ -25,9 +25,12 @@ import com.nextcloud.talk.api.ExternalSignaling;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.rooms.Conversation;
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
import com.nextcloud.talk.models.json.signaling.NCSignalingMessage;
import com.nextcloud.talk.models.json.websocket.AuthParametersWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.AuthWebSocketMessage;
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.RecipientWebSocketMessage;
@ -145,22 +148,19 @@ public class ScarletHelper {
return requestOfferOverallWebSocketMessage;
}
/*
- (void)sendCallMessage:(NCSignalingMessage *)message
{
NSDictionary *messageDict = @{
@"type": @"message",
@"message": @{
@"recipient": @{
@"type": @"session",
@"sessionid": message.to
},
@"data": [message functionDict]
}
};
public CallOverallWebSocketMessage getAssembledCallMessageModel(NCMessageWrapper ncMessageWrapper) {
CallOverallWebSocketMessage callOverallWebSocketMessage = new CallOverallWebSocketMessage();
callOverallWebSocketMessage.setType("message");
[self sendMessage:messageDict];
CallWebSocketMessage callWebSocketMessage = new CallWebSocketMessage();
RecipientWebSocketMessage recipientWebSocketMessage = new RecipientWebSocketMessage();
recipientWebSocketMessage.setType("session");
recipientWebSocketMessage.setSessionId(ncMessageWrapper.getSignalingMessage().getTo());
callWebSocketMessage.setRecipientWebSocketMessage(recipientWebSocketMessage);
callWebSocketMessage.setNcMessageWrapper(ncMessageWrapper);
callOverallWebSocketMessage.setCallWebSocketMessage(callWebSocketMessage);
return callOverallWebSocketMessage;
}
*/
}