Search in sources :

Example 1 with CallWrapper

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

the class CallPresenter method removeActiveCallIfExist.

private void removeActiveCallIfExist(long endedCallId) {
    CallWrapper endedCallInList = null;
    for (CallWrapper callItem : callsList) {
        if (callItem.getId() == endedCallId) {
            endedCallInList = callItem;
            break;
        }
    }
    if (endedCallInList != null) {
        view.removeCallItem(endedCallInList);
        endedCallInList.setCallItemType(CallWrapper.CallItemType.HISTORY);
        view.onGetCallHistory(Collections.singletonList(endedCallInList));
    }
}
Also used : CallWrapper(com.fanap.podchat.call.history.CallWrapper)

Example 2 with CallWrapper

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

the class CallPresenter method onReceiveCallHistory.

@Override
public void onReceiveCallHistory(ChatResponse<GetCallHistoryResult> response) {
    List<CallWrapper> calls = new ArrayList<>();
    for (CallVO call : response.getResult().getCallsList()) {
        if (call.getPartnerParticipantVO() != null || call.getConversationVO() != null) {
            CallWrapper callWrapper = CallWrapper.fromCall(call);
            callWrapper.setCallItemType(CallWrapper.CallItemType.HISTORY);
            calls.add(callWrapper);
        }
    }
    if (callsList.size() > 0) {
        calls.removeAll(callsList);
    }
    callsList.addAll(calls);
    view.onGetCallHistory(calls);
}
Also used : ArrayList(java.util.ArrayList) CreateCallVO(com.fanap.podchat.call.model.CreateCallVO) CallVO(com.fanap.podchat.call.model.CallVO) CallWrapper(com.fanap.podchat.call.history.CallWrapper)

Example 3 with CallWrapper

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

the class CallPresenter method onReceiveActiveCalls.

@Override
public void onReceiveActiveCalls(ChatResponse<GetActiveCallsResult> response) {
    List<CallWrapper> calls = new ArrayList<>();
    for (CallVO call : response.getResult().getCallsList()) {
        if (call.getPartnerParticipantVO() != null || call.getConversationVO() != null) {
            CallWrapper callWrapper = CallWrapper.fromCall(call);
            callWrapper.setCallItemType(CallWrapper.CallItemType.ACTIVE);
            calls.add(callWrapper);
        }
    }
    calls.removeAll(callsList);
    callsList.addAll(calls);
    if (calls.size() > 0) {
        view.onGetActiveCalls(calls);
    }
}
Also used : ArrayList(java.util.ArrayList) CreateCallVO(com.fanap.podchat.call.model.CreateCallVO) CallVO(com.fanap.podchat.call.model.CallVO) CallWrapper(com.fanap.podchat.call.history.CallWrapper)

Aggregations

CallWrapper (com.fanap.podchat.call.history.CallWrapper)3 CallVO (com.fanap.podchat.call.model.CallVO)2 CreateCallVO (com.fanap.podchat.call.model.CreateCallVO)2 ArrayList (java.util.ArrayList)2