Search in sources :

Example 1 with JoinCallParticipantResult

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

the class CallAsyncRequestsManager method handleOnParticipantJoined.

public static ChatResponse<JoinCallParticipantResult> handleOnParticipantJoined(ChatMessage chatMessage) {
    ChatResponse<JoinCallParticipantResult> response = null;
    try {
        response = new ChatResponse<>();
        response.setUniqueId(chatMessage.getUniqueId());
        response.setSubjectId(chatMessage.getSubjectId());
        ArrayList<CallParticipantVO> callParticipantVOS = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
        }.getType());
        JoinCallParticipantResult result = new JoinCallParticipantResult();
        result.setCallId(chatMessage.getSubjectId());
        result.setJoinedParticipants(callParticipantVOS);
        response.setResult(result);
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
    return response;
}
Also used : JoinCallParticipantResult(com.fanap.podchat.call.result_model.JoinCallParticipantResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) TypeToken(com.google.gson.reflect.TypeToken) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 2 with JoinCallParticipantResult

use of com.fanap.podchat.call.result_model.JoinCallParticipantResult 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)

Aggregations

CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)2 JoinCallParticipantResult (com.fanap.podchat.call.result_model.JoinCallParticipantResult)2 PodCallBuilder (com.fanap.podcall.PodCallBuilder)1 CallPartner (com.fanap.podcall.model.CallPartner)1 CallPartnerView (com.fanap.podcall.view.CallPartnerView)1 PodChatException (com.fanap.podchat.util.PodChatException)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 TypeToken (com.google.gson.reflect.TypeToken)1