Search in sources :

Example 1 with MuteUnMuteCallParticipantResult

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

the class CallAsyncRequestsManager method handleMuteUnMuteCallParticipant.

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

Aggregations

CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)1 MuteUnMuteCallParticipantResult (com.fanap.podchat.call.result_model.MuteUnMuteCallParticipantResult)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