Search in sources :

Example 1 with CallParticipantVO

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

the class CallPresenter method onCallParticipantJoined.

@Override
public void onCallParticipantJoined(ChatResponse<JoinCallParticipantResult> response) {
    for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
        try {
            activity.runOnUiThread(() -> {
                if (cpvManager != null) {
                    cpvManager.showPartnerName(callParticipant.getUserId(), callParticipant.getParticipantVO().getName());
                    return;
                }
                CallPartnerView pw = findParticipantView(callParticipant.getUserId());
                pw.setDisplayName(true);
                pw.setPartnerName(callParticipant.getParticipantVO().getName());
            });
        } catch (Exception exc) {
            exc.printStackTrace();
        }
        view.showMessage(callParticipant.getParticipantVO().getName() + " وارد تماس شد!");
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 2 with CallParticipantVO

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

the class CallPresenter method onVoiceCallStarted.

@Override
public void onVoiceCallStarted(ChatResponse<CallStartResult> response) {
    isInCall = true;
    if (Util.isNotNullOrEmpty(response.getResult().getCallPartners())) {
        if (response.getResult().getCallPartners().size() == 1) {
            CallParticipantVO rp = response.getResult().getCallPartners().get(0);
            if (!rp.hasVideo()) {
                view.hideRemoteViews();
            } else {
                view.showRemoteViews();
            }
        }
    }
    view.onVoiceCallStarted(" " + response.getUniqueId(), "");
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO)

Example 3 with CallParticipantVO

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

the class CallPresenter method setNameOnView.

private void setNameOnView(List<CallParticipantVO> callParticipantVOArrayList) {
    try {
        activity.runOnUiThread(() -> {
            for (CallParticipantVO cp : callParticipantVOArrayList) {
                if (cp.hasVideo()) {
                    if (cpvManager != null) {
                        cpvManager.showPartnerName(cp.getUserId(), cp.getParticipantVO().getContactName());
                    } else {
                        CallPartnerView pw = findParticipantView(cp.getUserId());
                        pw.setPartnerName(cp.getParticipantVO().getContactName());
                        pw.setDisplayName(true);
                    }
                }
            }
        });
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 4 with CallParticipantVO

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

the class CallPresenter method onCallParticipantUnMuted.

@Override
public void onCallParticipantUnMuted(ChatResponse<MuteUnMuteCallParticipantResult> response) {
    for (CallParticipantVO participant : response.getResult().getCallParticipants()) {
        Long userId = participant.getUserId();
        if (cpvManager != null) {
            activity.runOnUiThread(() -> cpvManager.hideMuteIcon(userId));
        } else {
            CallPartnerView partnerView = null;
            if (userId != null) {
                partnerView = findParticipantView(userId);
            }
            String name = Util.isNotNullOrEmpty(participant.getParticipantVO().getContactName()) ? participant.getParticipantVO().getContactName() : participant.getParticipantVO().getName();
            view.showMessage(name + " میکروفنش رو باز کرد 😍");
            view.callParticipantUnMuted(participant, partnerView);
        }
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 5 with CallParticipantVO

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

the class CallPresenter method onCallParticipantMuted.

@Override
public void onCallParticipantMuted(ChatResponse<MuteUnMuteCallParticipantResult> response) {
    for (CallParticipantVO participant : response.getResult().getCallParticipants()) {
        Long userId = participant.getUserId();
        if (cpvManager != null) {
            activity.runOnUiThread(() -> cpvManager.showMuteIcon(userId));
        } else {
            CallPartnerView partnerView = null;
            if (userId != null) {
                partnerView = findParticipantView(userId);
            }
            String name = Util.isNotNullOrEmpty(participant.getParticipantVO().getContactName()) ? participant.getParticipantVO().getContactName() : participant.getParticipantVO().getName();
            view.showMessage(name + " میکروفنش رو بست 🤐");
            view.callParticipantMuted(participant, partnerView);
        }
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

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