Search in sources :

Example 1 with GetActiveCallsResult

use of com.fanap.podchat.call.result_model.GetActiveCallsResult 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)1 CreateCallVO (com.fanap.podchat.call.model.CreateCallVO)1 GetActiveCallsResult (com.fanap.podchat.call.result_model.GetActiveCallsResult)1 ChatResponse (com.fanap.podchat.model.ChatResponse)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 ArrayList (java.util.ArrayList)1