Search in sources :

Example 16 with CallParticipantVO

use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.

the class Chat method handleOnNewCallParticipantJoined.

@Override
void handleOnNewCallParticipantJoined(ChatMessage chatMessage) {
    if (deviceIsInCall) {
        if (sentryResponseLog) {
            showLog("RECEIVE_PARTICIPANT_JOINED", gson.toJson(chatMessage));
        } else {
            showLog("RECEIVE_PARTICIPANT_JOINED");
        }
        ChatResponse<JoinCallParticipantResult> response = CallAsyncRequestsManager.handleOnParticipantJoined(chatMessage);
        if (podVideoCall != null) {
            for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
                if (callParticipant.getUserId() == 0)
                    continue;
                if (!callParticipant.getUserId().equals(CoreConfig.userId)) {
                    CallPartner.Builder rPartnerBuilder = new CallPartner.Builder();
                    rPartnerBuilder.setId(callParticipant.getUserId());
                    rPartnerBuilder.setPartnerType(PartnerType.REMOTE).setName("" + callParticipant.getUserId());
                    rPartnerBuilder.setVideoTopic(callParticipant.getSendTopicVideo());
                    rPartnerBuilder.setHasVideo(Util.isNotNullOrEmpty(callParticipant.getSendTopicVideo()));
                    rPartnerBuilder.setVideoOn(callParticipant.hasVideo());
                    if (callParticipant.hasVideo() && hasRemotePartnerView()) {
                        CallPartnerView view = assignCallPartnerView(callParticipant.getUserId());
                        if (view != null) {
                            visibleView(view);
                            view.setPartnerName(callParticipant.getParticipantVO() != null ? callParticipant.getParticipantVO().getName() : "");
                            rPartnerBuilder.setVideoView(view);
                        } else {
                            rPartnerBuilder.setVideoOn(false);
                        }
                    }
                    rPartnerBuilder.setAudioTopic(callParticipant.getSendTopicAudio());
                    rPartnerBuilder.setHasAudio(Util.isNotNullOrEmpty(callParticipant.getSendTopicAudio()));
                    rPartnerBuilder.setAudioOn(!callParticipant.isMute());
                    CallPartner rPartner = rPartnerBuilder.build();
                    podVideoCall.addPartner(rPartner);
                }
            }
        }
        listenerManager.callOnCallParticipantJoined(response);
    }
}
Also used : JoinCallParticipantResult(com.fanap.podchat.call.result_model.JoinCallParticipantResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 17 with CallParticipantVO

use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnParticipantLeft.

public static ChatResponse<LeaveCallResult> handleOnParticipantLeft(ChatMessage chatMessage) {
    ChatResponse<LeaveCallResult> response = new ChatResponse<>();
    ArrayList<CallParticipantVO> participantsLeft = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
    }.getType());
    LeaveCallResult result = new LeaveCallResult();
    result.setCallId(chatMessage.getSubjectId());
    result.setCallParticipants(participantsLeft);
    response.setResult(result);
    response.setSubjectId(chatMessage.getSubjectId());
    response.setUniqueId(chatMessage.getUniqueId());
    return response;
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse) LeaveCallResult(com.fanap.podchat.call.result_model.LeaveCallResult)

Example 18 with CallParticipantVO

use of com.fanap.podchat.call.model.CallParticipantVO in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method fillResult.

public static ChatResponse<CallStartResult> fillResult(ChatResponse<StartedCallModel> callResponse) {
    ChatResponse<CallStartResult> response = new ChatResponse<>();
    ArrayList<CallParticipantVO> callPartners = new ArrayList<>();
    if (Util.isNotNullOrEmpty(callResponse.getResult().getOtherClientDtoList())) {
        for (ClientDTO client : callResponse.getResult().getOtherClientDtoList()) {
            if (!client.getUserId().equals(CoreConfig.userId)) {
                CallParticipantVO partner = new CallParticipantVO();
                partner.setUserId(client.getUserId());
                partner.setMute(client.getMute());
                partner.setVideo(client.getVideo());
                callPartners.add(partner);
            }
        }
    }
    CallStartResult result = new CallStartResult(callResponse.getResult().getCallName(), callResponse.getResult().getCallImage(), callPartners);
    response.setResult(result);
    response.setSubjectId(callResponse.getSubjectId());
    response.setUniqueId(callResponse.getUniqueId());
    return response;
}
Also used : CallStartResult(com.fanap.podchat.call.result_model.CallStartResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) ChatResponse(com.fanap.podchat.model.ChatResponse) ClientDTO(com.fanap.podchat.call.model.ClientDTO) SendClientDTO(com.fanap.podchat.call.model.SendClientDTO) ArrayList(java.util.ArrayList)

Aggregations

CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)18 CallPartnerView (com.fanap.podcall.view.CallPartnerView)7 ChatResponse (com.fanap.podchat.model.ChatResponse)7 PodChatException (com.fanap.podchat.util.PodChatException)5 JsonSyntaxException (com.google.gson.JsonSyntaxException)5 TypeToken (com.google.gson.reflect.TypeToken)5 PodCallBuilder (com.fanap.podcall.PodCallBuilder)2 CallPartner (com.fanap.podcall.model.CallPartner)2 JoinCallParticipantResult (com.fanap.podchat.call.result_model.JoinCallParticipantResult)2 ClientDTO (com.fanap.podchat.call.model.ClientDTO)1 SendClientDTO (com.fanap.podchat.call.model.SendClientDTO)1 ScreenShareResult (com.fanap.podchat.call.request_model.screen_share.ScreenShareResult)1 CallCancelResult (com.fanap.podchat.call.result_model.CallCancelResult)1 CallDeliverResult (com.fanap.podchat.call.result_model.CallDeliverResult)1 CallStartResult (com.fanap.podchat.call.result_model.CallStartResult)1 GetCallParticipantResult (com.fanap.podchat.call.result_model.GetCallParticipantResult)1 LeaveCallResult (com.fanap.podchat.call.result_model.LeaveCallResult)1 MuteUnMuteCallParticipantResult (com.fanap.podchat.call.result_model.MuteUnMuteCallParticipantResult)1 RemoveFromCallResult (com.fanap.podchat.call.result_model.RemoveFromCallResult)1 MainThreadExecutor (com.fanap.podchat.chat.MainThreadExecutor)1