Search in sources :

Example 1 with CallVO

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

the class CacheCall method toCallVo.

public CallVO toCallVo() {
    CallVO callVO = new CallVO();
    callVO.setPartnerParticipantVO(this.partnerParticipantVO);
    callVO.setCallParticipants(this.callParticipants);
    callVO.setCreateTime(this.createTime);
    callVO.setCreatorId(this.creatorId);
    callVO.setEndTime(this.endTime);
    callVO.setGroup(this.isGroup);
    callVO.setType(this.type);
    callVO.setId(this.id);
    callVO.setStartTime(this.startTime);
    callVO.setStatus(this.status);
    return callVO;
}
Also used : CallVO(com.fanap.podchat.call.model.CallVO)

Example 2 with CallVO

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

the class CallAsyncRequestsManager method handleOnGetCallHistory.

public static ChatResponse<GetCallHistoryResult> handleOnGetCallHistory(ChatMessage chatMessage, Callback callback) {
    ChatResponse<GetCallHistoryResult> response = new ChatResponse<>();
    response.setUniqueId(chatMessage.getUniqueId());
    ArrayList<CallVO> calls = new ArrayList<>();
    long offset = callback != null ? callback.getOffset() : 0;
    try {
        calls = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallVO>>() {
        }.getType());
    } catch (JsonSyntaxException ignored) {
    }
    response.setResult(new GetCallHistoryResult(calls, chatMessage.getContentCount(), (calls.size() + offset < chatMessage.getContentCount()), (calls.size() + offset)));
    return response;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) ChatResponse(com.fanap.podchat.model.ChatResponse) ArrayList(java.util.ArrayList) CreateCallVO(com.fanap.podchat.call.model.CreateCallVO) CallVO(com.fanap.podchat.call.model.CallVO) GetCallHistoryResult(com.fanap.podchat.call.result_model.GetCallHistoryResult)

Example 3 with CallVO

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

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

Example 5 with CallVO

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

the class CallAsyncRequestsManager method handleOnGetActiveCalls.

public static ChatResponse<GetActiveCallsResult> handleOnGetActiveCalls(ChatMessage chatMessage, Callback callback) {
    ChatResponse<GetActiveCallsResult> response = new ChatResponse<>();
    response.setUniqueId(chatMessage.getUniqueId());
    ArrayList<CallVO> calls = new ArrayList<>();
    long offset = callback != null ? callback.getOffset() : 0;
    try {
        calls = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallVO>>() {
        }.getType());
    } catch (JsonSyntaxException ignored) {
    }
    response.setResult(new GetActiveCallsResult(calls, chatMessage.getContentCount(), (calls.size() + offset < chatMessage.getContentCount()), (calls.size() + offset)));
    return response;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) ChatResponse(com.fanap.podchat.model.ChatResponse) ArrayList(java.util.ArrayList) CreateCallVO(com.fanap.podchat.call.model.CreateCallVO) CallVO(com.fanap.podchat.call.model.CallVO) GetActiveCallsResult(com.fanap.podchat.call.result_model.GetActiveCallsResult)

Aggregations

CallVO (com.fanap.podchat.call.model.CallVO)7 ArrayList (java.util.ArrayList)6 CreateCallVO (com.fanap.podchat.call.model.CreateCallVO)4 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)2 CacheThreadParticipant (com.fanap.podchat.cachemodel.CacheThreadParticipant)2 CallWrapper (com.fanap.podchat.call.history.CallWrapper)2 CacheCall (com.fanap.podchat.call.persist.CacheCall)2 CacheCallParticipant (com.fanap.podchat.call.persist.CacheCallParticipant)2 Participant (com.fanap.podchat.mainmodel.Participant)2 ChatResponse (com.fanap.podchat.model.ChatResponse)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)2 Nullable (android.support.annotation.Nullable)1 ThreadVo (com.fanap.podchat.cachemodel.ThreadVo)1 GetActiveCallsResult (com.fanap.podchat.call.result_model.GetActiveCallsResult)1 GetCallHistoryResult (com.fanap.podchat.call.result_model.GetCallHistoryResult)1 ChatProfileVO (com.fanap.podchat.chat.user.profile.ChatProfileVO)1 Thread (com.fanap.podchat.mainmodel.Thread)1