Search in sources :

Example 1 with GetCallHistoryResult

use of com.fanap.podchat.call.result_model.GetCallHistoryResult 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 2 with GetCallHistoryResult

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

the class CallAsyncRequestsManager method handleOnGetCallHistoryFromCache.

public static ChatResponse<GetCallHistoryResult> handleOnGetCallHistoryFromCache(String uniqueId, ArrayList<CallVO> calls, long contentCount, long offset) {
    ChatResponse<GetCallHistoryResult> response = new ChatResponse<>();
    response.setUniqueId(uniqueId);
    response.setResult(new GetCallHistoryResult(calls, contentCount, (calls.size() + offset < contentCount), (calls.size() + offset)));
    response.setCache(true);
    return response;
}
Also used : ChatResponse(com.fanap.podchat.model.ChatResponse) GetCallHistoryResult(com.fanap.podchat.call.result_model.GetCallHistoryResult)

Aggregations

GetCallHistoryResult (com.fanap.podchat.call.result_model.GetCallHistoryResult)2 ChatResponse (com.fanap.podchat.model.ChatResponse)2 CallVO (com.fanap.podchat.call.model.CallVO)1 CreateCallVO (com.fanap.podchat.call.model.CreateCallVO)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 ArrayList (java.util.ArrayList)1