Search in sources :

Example 11 with CallParticipantVO

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

the class CallPresenter method onCallParticipantLeft.

@Override
public void onCallParticipantLeft(ChatResponse<LeaveCallResult> response) {
    for (CallParticipantVO c : response.getResult().getCallParticipants()) {
        view.showMessage(c.getParticipantVO().getName() + " تماس رو ترک کرد");
    }
    activity.runOnUiThread(() -> {
        try {
            if (cpvManager != null) {
                cpvManager.releasePartnerView(response.getResult().getCallParticipants().get(0).getUserId());
            } else {
                CallPartnerView pw = findParticipantView(response.getResult().getCallParticipants().get(0).getUserId());
                if (pw != null) {
                    pw.setId(0);
                    pw.setPartnerName("");
                    pw.setDisplayName(false);
                    pw.setDisplayIsMuteIcon(false);
                    pw.setDisplayCameraIsOffIcon(false);
                    pw.reset();
                    chat.addPartnerView(pw, 0);
                }
            }
        } catch (Exception e) {
            view.onError(e.getMessage());
        }
    });
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 12 with CallParticipantVO

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

the class CallPresenter method onCallParticipantStartedVideo.

@Override
public void onCallParticipantStartedVideo(ChatResponse<JoinCallParticipantResult> response) {
    try {
        if (cpvManager != null) {
            CallParticipantVO callParticipant = response.getResult().getJoinedParticipants().get(0);
            new MainThreadExecutor().execute(() -> {
                try {
                    Objects.requireNonNull(cpvManager.getPartnerAssignedView(callParticipant.getUserId())).setVisibility(View.VISIBLE);
                    cpvManager.showPartnerName(callParticipant.getUserId(), callParticipant.getParticipantVO().getName());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            });
        }
        view.showMessage(response.getResult().getJoinedParticipants().get(0).getParticipantVO().getName() + " الان تصویر داره!");
    } catch (Exception e) {
        view.onError(e.getMessage());
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) MainThreadExecutor(com.fanap.podchat.chat.MainThreadExecutor)

Example 13 with CallParticipantVO

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

the class CallAsyncRequestsManager method handleOnScreenIsSharing.

public static ChatResponse<ScreenShareResult> handleOnScreenIsSharing(ChatResponse<StartedCallModel> info) {
    ChatResponse<ScreenShareResult> response = null;
    try {
        response = new ChatResponse<>();
        response.setUniqueId(info.getUniqueId());
        response.setSubjectId(info.getSubjectId());
        ScreenShareResult scr = new ScreenShareResult();
        scr.setScreenshare(info.getResult().getChatDataDTO().getScreenShare());
        CallParticipantVO callParticipantVO = new CallParticipantVO();
        callParticipantVO.setUserId(Long.valueOf(info.getResult().getChatDataDTO().getScreenShareUser()));
        scr.setScreenOwner(callParticipantVO);
        response.setResult(scr);
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
    return response;
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 14 with CallParticipantVO

use of com.fanap.podchat.call.model.CallParticipantVO 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 15 with CallParticipantVO

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

the class CallAsyncRequestsManager method handleOnCallDelivered.

public static ChatResponse<CallDeliverResult> handleOnCallDelivered(ChatMessage chatMessage) {
    CallParticipantVO participant = App.getGson().fromJson(chatMessage.getContent(), CallParticipantVO.class);
    CallDeliverResult result = new CallDeliverResult(participant);
    ChatResponse<CallDeliverResult> response = new ChatResponse<>();
    response.setResult(result);
    response.setSubjectId(chatMessage.getSubjectId());
    response.setUniqueId(chatMessage.getUniqueId());
    return response;
}
Also used : CallDeliverResult(com.fanap.podchat.call.result_model.CallDeliverResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) ChatResponse(com.fanap.podchat.model.ChatResponse)

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