Search in sources :

Example 31 with ChatResponse

use of com.fanap.podchat.model.ChatResponse in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnCallEnded.

public static ChatResponse<EndCallResult> handleOnCallEnded(ChatMessage chatMessage) {
    ChatResponse<EndCallResult> response = new ChatResponse<>();
    EndCallResult result = new EndCallResult();
    result.setTypeCode(chatMessage.getTypeCode());
    result.setCallId(chatMessage.getSubjectId());
    response.setResult(result);
    response.setSubjectId(chatMessage.getSubjectId());
    response.setUniqueId(chatMessage.getUniqueId());
    return response;
}
Also used : EndCallResult(com.fanap.podchat.call.result_model.EndCallResult) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 32 with ChatResponse

use of com.fanap.podchat.model.ChatResponse in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnParticipantRemoved.

public static ChatResponse<RemoveFromCallResult> handleOnParticipantRemoved(ChatMessage chatMessage) {
    ChatResponse<RemoveFromCallResult> response = new ChatResponse<>();
    ArrayList<CallParticipantVO> participantsLeft = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<ArrayList<CallParticipantVO>>() {
    }.getType());
    RemoveFromCallResult result = new RemoveFromCallResult();
    result.setCallId(chatMessage.getSubjectId());
    result.setCallParticipants(participantsLeft);
    if (Util.isNotNullOrEmpty(participantsLeft))
        result.setUserRemoved(isUserContains(participantsLeft));
    response.setResult(result);
    response.setSubjectId(chatMessage.getSubjectId());
    response.setUniqueId(chatMessage.getUniqueId());
    return response;
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) RemoveFromCallResult(com.fanap.podchat.call.result_model.RemoveFromCallResult) TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 33 with ChatResponse

use of com.fanap.podchat.model.ChatResponse in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleStartedRecordCallResponse.

public static ChatResponse<Participant> handleStartedRecordCallResponse(ChatMessage chatMessage) {
    ChatResponse<Participant> response = new ChatResponse<>();
    Participant result = App.getGson().fromJson(chatMessage.getContent(), new TypeToken<Participant>() {
    }.getType());
    response.setResult(result);
    response.setUniqueId(chatMessage.getUniqueId());
    response.setCache(false);
    return response;
}
Also used : Participant(com.fanap.podchat.mainmodel.Participant) TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 34 with ChatResponse

use of com.fanap.podchat.model.ChatResponse 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)

Example 35 with ChatResponse

use of com.fanap.podchat.model.ChatResponse in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnRejectCallRequest.

public static ChatResponse<CallRequestResult> handleOnRejectCallRequest(ChatMessage chatMessage) {
    CallRequestResult callRequestResult = App.getGson().fromJson(chatMessage.getContent(), CallRequestResult.class);
    callRequestResult.setThreadId(chatMessage.getSubjectId());
    ChatResponse<CallRequestResult> response = new ChatResponse<>();
    response.setResult(callRequestResult);
    response.setUniqueId(chatMessage.getUniqueId());
    response.setSubjectId(chatMessage.getSubjectId());
    return response;
}
Also used : CallRequestResult(com.fanap.podchat.call.result_model.CallRequestResult) ChatResponse(com.fanap.podchat.model.ChatResponse)

Aggregations

ChatResponse (com.fanap.podchat.model.ChatResponse)162 ChatListener (com.fanap.podchat.chat.ChatListener)38 Test (org.junit.Test)38 ArrayList (java.util.ArrayList)35 Thread (com.fanap.podchat.mainmodel.Thread)29 JsonSyntaxException (com.google.gson.JsonSyntaxException)29 ResultHistory (com.fanap.podchat.model.ResultHistory)28 LargeTest (android.support.test.filters.LargeTest)27 RequestThread (com.fanap.podchat.requestobject.RequestThread)27 PodChatException (com.fanap.podchat.util.PodChatException)26 MessageVO (com.fanap.podchat.mainmodel.MessageVO)25 RoomIntegrityException (com.fanap.podchat.persistance.RoomIntegrityException)23 IOException (java.io.IOException)23 JSONException (org.json.JSONException)22 ResultThreads (com.fanap.podchat.model.ResultThreads)21 RequestGetHistory (com.fanap.podchat.requestobject.RequestGetHistory)21 SentryException (io.sentry.core.protocol.SentryException)21 FlakyTest (android.support.test.filters.FlakyTest)19 MediumTest (android.support.test.filters.MediumTest)19 Activity (android.app.Activity)17