Search in sources :

Example 1 with CallCancelResult

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

the class CallAsyncRequestsManager method handleOnCallCanceled.

public static ChatResponse<CallCancelResult> handleOnCallCanceled(ChatMessage chatMessage) {
    ChatResponse<CallCancelResult> response = new ChatResponse<>();
    try {
        CallParticipantVO participantVO = App.getGson().fromJson(chatMessage.getContent(), CallParticipantVO.class);
        CallCancelResult result = new CallCancelResult(participantVO);
        response.setResult(result);
        response.setHasError(false);
        response.setUniqueId(chatMessage.getUniqueId());
        response.setSubjectId(chatMessage.getSubjectId());
        response.setCache(false);
        return response;
    } catch (Exception e) {
        e.printStackTrace();
        response.setCache(false);
        response.setHasError(true);
        response.setUniqueId(chatMessage.getUniqueId());
        response.setSubjectId(chatMessage.getSubjectId());
        response.setErrorCode(ChatConstant.ERROR_CODE_INVALID_DATA);
        response.setErrorMessage(ChatConstant.ERROR_INVALID_DATA);
        return response;
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) ChatResponse(com.fanap.podchat.model.ChatResponse) CallCancelResult(com.fanap.podchat.call.result_model.CallCancelResult) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Aggregations

CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)1 CallCancelResult (com.fanap.podchat.call.result_model.CallCancelResult)1 ChatResponse (com.fanap.podchat.model.ChatResponse)1 PodChatException (com.fanap.podchat.util.PodChatException)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1