Search in sources :

Example 1 with GetCallParticipantResult

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

the class CallAsyncRequestsManager method reformatActiveCallParticipant.

public static ChatResponse<GetCallParticipantResult> reformatActiveCallParticipant(ChatMessage chatMessage) {
    try {
        ArrayList<CallParticipantVO> callParticipantVOS = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
        }.getType());
        ChatResponse<GetCallParticipantResult> response = new ChatResponse<>();
        GetCallParticipantResult result = new GetCallParticipantResult(callParticipantVOS);
        result.setThreadId(chatMessage.getSubjectId());
        response.setResult(result);
        response.setSubjectId(chatMessage.getSubjectId());
        response.setUniqueId(chatMessage.getUniqueId());
        response.setCache(false);
        response.setHasError(false);
        return response;
    } catch (Exception e) {
        e.printStackTrace();
        ChatResponse<GetCallParticipantResult> response = new ChatResponse<>();
        response.setErrorMessage(e.getMessage());
        response.setErrorCode(ChatConstant.ERROR_CODE_UNKNOWN_EXCEPTION);
        response.setHasError(true);
        return response;
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException) GetCallParticipantResult(com.fanap.podchat.call.result_model.GetCallParticipantResult)

Aggregations

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