use of com.fanap.podchat.call.model.SendClientDTO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createGroupCallRequestMessage.
public static String createGroupCallRequestMessage(CallRequest request, String uniqueId) {
CreateCallVO createCallVO = new CreateCallVO();
createCallVO.setGroup(true);
createCallVO.setCreatorId(CoreConfig.userId);
if (request.getSubjectId() <= 0)
createCallVO.setInvitees(request.getInvitees());
else
createCallVO.setThreadId(request.getSubjectId());
createCallVO.setType(request.getCallType());
CreateCallThread callThread = null;
if (Util.isNotNullOrEmpty(request.getTitle())) {
callThread = new CreateCallThread();
callThread.setTitle(request.getTitle());
}
if (Util.isNotNullOrEmpty(request.getImage())) {
if (callThread == null)
callThread = new CreateCallThread();
callThread.setImage(request.getImage());
}
if (Util.isNotNullOrEmpty(request.getDescription())) {
if (callThread == null)
callThread = new CreateCallThread();
callThread.setDescription(request.getDescription());
}
if (Util.isNotNullOrEmpty(request.getMetadata())) {
if (callThread == null)
callThread = new CreateCallThread();
callThread.setMetadata(request.getMetadata());
}
if (Util.isNotNullOrEmpty(request.getUniqueName())) {
if (callThread == null)
callThread = new CreateCallThread();
callThread.setUniqueName(request.getUniqueName());
}
if (callThread != null) {
createCallVO.setCreateCallThreadRequest(callThread);
}
SendClientDTO sendClientDTO = new SendClientDTO();
sendClientDTO.setVideo(request.getCallType() == CallType.Constants.VIDEO_CALL);
sendClientDTO.setMute(false);
sendClientDTO.setClientType(ClientType.Constants.ANDROID);
JsonObject contentObj = (JsonObject) App.getGson().toJsonTree(createCallVO);
JsonElement clientDtoObj = App.getGson().toJsonTree(sendClientDTO);
contentObj.add("creatorClientDto", clientDtoObj);
if (callThread == null) {
contentObj.remove("createCallThreadRequest");
}
AsyncMessage message = new AsyncMessage();
message.setContent(contentObj.toString());
message.setType(ChatMessageType.Constants.GROUP_CALL_REQUEST);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
JsonObject messageObj = (JsonObject) App.getGson().toJsonTree(message);
messageObj.remove("subjectId");
return messageObj.toString();
}
use of com.fanap.podchat.call.model.SendClientDTO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createAcceptCallRequest.
public static String createAcceptCallRequest(AcceptCallRequest request, String uniqueId) {
AsyncMessage message = new AsyncMessage();
SendClientDTO sendClientDTO = new SendClientDTO();
sendClientDTO.setVideo(request.isVideoCall());
sendClientDTO.setMute(request.isMute());
sendClientDTO.setClientType(ClientType.Constants.ANDROID);
JsonElement clientDtoObj = App.getGson().toJsonTree(sendClientDTO);
message.setContent(clientDtoObj.toString());
message.setType(ChatMessageType.Constants.ACCEPT_CALL);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setSubjectId(request.getCallId());
message.setUniqueId(uniqueId);
JsonObject messageObj = (JsonObject) App.getGson().toJsonTree(message);
return messageObj.toString();
}
use of com.fanap.podchat.call.model.SendClientDTO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createCallRequestMessage.
public static String createCallRequestMessage(CallRequest request, String uniqueId) {
CreateCallVO createCallVO = new CreateCallVO();
createCallVO.setCreatorId(CoreConfig.userId);
if (request.getSubjectId() <= 0)
createCallVO.setInvitees(request.getInvitees());
else
createCallVO.setThreadId(request.getSubjectId());
createCallVO.setType(request.getCallType());
SendClientDTO sendClientDTO = new SendClientDTO();
sendClientDTO.setVideo(request.getCallType() == CallType.Constants.VIDEO_CALL);
sendClientDTO.setMute(false);
sendClientDTO.setClientType(ClientType.Constants.ANDROID);
JsonObject contentObj = (JsonObject) App.getGson().toJsonTree(createCallVO);
JsonElement clientDtoObj = App.getGson().toJsonTree(sendClientDTO);
contentObj.add("creatorClientDto", clientDtoObj);
AsyncMessage message = new AsyncMessage();
message.setContent(contentObj.toString());
message.setType(ChatMessageType.Constants.CALL_REQUEST);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
JsonObject messageObj;
if (Util.isNullOrEmpty(request.getInvitees())) {
message.setSubjectId(request.getSubjectId());
messageObj = (JsonObject) App.getGson().toJsonTree(message);
} else {
messageObj = (JsonObject) App.getGson().toJsonTree(message);
messageObj.remove("subjectId");
}
return messageObj.toString();
}
Aggregations