use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method handleOnParticipantRemoved.
public static ChatResponse<RemoveFromCallResult> handleOnParticipantRemoved(ChatMessage chatMessage) {
ChatResponse<RemoveFromCallResult> response = new ChatResponse<>();
ArrayList<CallParticipantVO> participantsLeft = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
}.getType());
RemoveFromCallResult result = new RemoveFromCallResult();
result.setCallId(chatMessage.getSubjectId());
result.setCallParticipants(participantsLeft);
if (Util.isNotNullOrEmpty(participantsLeft))
result.setUserRemoved(isUserContains(participantsLeft));
response.setResult(result);
response.setSubjectId(chatMessage.getSubjectId());
response.setUniqueId(chatMessage.getUniqueId());
return response;
}
use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method handleOnCallCanceled.
public static ChatResponse<CallCancelResult> handleOnCallCanceled(ChatMessage chatMessage) {
ChatResponse<CallCancelResult> response = new ChatResponse<>();
try {
CallParticipantVO participantVO = App.getGson().fromJson(chatMessage.getContent(), CallParticipantVO.class);
CallCancelResult result = new CallCancelResult(participantVO);
response.setResult(result);
response.setHasError(false);
response.setUniqueId(chatMessage.getUniqueId());
response.setSubjectId(chatMessage.getSubjectId());
response.setCache(false);
return response;
} catch (Exception e) {
e.printStackTrace();
response.setCache(false);
response.setHasError(true);
response.setUniqueId(chatMessage.getUniqueId());
response.setSubjectId(chatMessage.getSubjectId());
response.setErrorCode(ChatConstant.ERROR_CODE_INVALID_DATA);
response.setErrorMessage(ChatConstant.ERROR_INVALID_DATA);
return response;
}
}
use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method handleMuteUnMuteCallParticipant.
public static ChatResponse<MuteUnMuteCallParticipantResult> handleMuteUnMuteCallParticipant(ChatMessage chatMessage) {
ChatResponse<MuteUnMuteCallParticipantResult> response = new ChatResponse<>();
try {
ArrayList<CallParticipantVO> mutedParticipants = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
}.getType());
MuteUnMuteCallParticipantResult result = new MuteUnMuteCallParticipantResult(mutedParticipants);
result.setCallId(chatMessage.getSubjectId());
response.setResult(result);
response.setCache(false);
response.setSubjectId(chatMessage.getSubjectId());
response.setUniqueId(chatMessage.getUniqueId());
response.setHasError(false);
return response;
} catch (Exception e) {
response.setCache(false);
response.setSubjectId(chatMessage.getSubjectId());
response.setUniqueId(chatMessage.getUniqueId());
response.setHasError(true);
response.setErrorMessage(e.getMessage());
response.setErrorCode(ChatConstant.ERROR_CODE_INVALID_DATA);
return response;
}
}
use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method reformatActiveCallParticipant.
public static ChatResponse<GetCallParticipantResult> reformatActiveCallParticipant(ChatMessage chatMessage) {
try {
ArrayList<CallParticipantVO> callParticipantVOS = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
}.getType());
ChatResponse<GetCallParticipantResult> response = new ChatResponse<>();
GetCallParticipantResult result = new GetCallParticipantResult(callParticipantVOS);
result.setThreadId(chatMessage.getSubjectId());
response.setResult(result);
response.setSubjectId(chatMessage.getSubjectId());
response.setUniqueId(chatMessage.getUniqueId());
response.setCache(false);
response.setHasError(false);
return response;
} catch (Exception e) {
e.printStackTrace();
ChatResponse<GetCallParticipantResult> response = new ChatResponse<>();
response.setErrorMessage(e.getMessage());
response.setErrorCode(ChatConstant.ERROR_CODE_UNKNOWN_EXCEPTION);
response.setHasError(true);
return response;
}
}
use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.
the class Chat method addVideoCallPartner.
private void addVideoCallPartner(ChatResponse<JoinCallParticipantResult> response) {
for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
if (callParticipant.getUserId().equals(CoreConfig.userId)) {
CallPartner.Builder lCallPartnerBuilder = new CallPartner.Builder();
lCallPartnerBuilder.setPartnerType(PartnerType.LOCAL);
lCallPartnerBuilder.setName("You");
if (localPartnerView != null) {
visibleView(localPartnerView);
localPartnerView.setPartnerId(CoreConfig.userId);
localPartnerView.setPartnerName("You");
lCallPartnerBuilder.setVideoTopic(callParticipant.getSendTopicVideo());
lCallPartnerBuilder.setVideoView(localPartnerView);
}
podVideoCall.addPartner(lCallPartnerBuilder.build());
// todo fire an event for local partner
} else {
Long userId = callParticipant.getUserId();
if (hasRemotePartnerView()) {
CallPartnerView view = assignCallPartnerView(callParticipant.getUserId());
if (view != null) {
view.setPartnerName(callParticipant.getParticipantVO() != null ? callParticipant.getParticipantVO().getName() : "");
visibleView(view);
podVideoCall.addPartnerVideo(userId, view);
listenerManager.callOnCallParticipantStartedVideo(response);
} else {
listenerManager.callOnNoViewToAddNewPartnerError();
}
}
}
}
}
Aggregations