Search in sources :

Example 1 with ResultAddParticipant

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

the class ChatCore method handleAddParticipant.

private void handleAddParticipant(ChatMessage chatMessage, String messageUniqueId) {
    Thread thread = gson.fromJson(chatMessage.getContent(), Thread.class);
    if (cache) {
        ThreadVo threadVo = gson.fromJson(chatMessage.getContent(), ThreadVo.class);
        List<CacheParticipant> cacheParticipants = threadVo.getParticipants();
        if (!Util.isNullOrEmpty(cacheParticipants))
            messageDatabaseHelper.saveParticipants(cacheParticipants, thread.getId(), getExpireAmount());
    }
    ChatResponse<ResultAddParticipant> chatResponse = ParticipantsManager.prepareAddParticipantResponse(chatMessage, thread);
    String jsonAddParticipant = gson.toJson(chatResponse);
    if (sentryResponseLog) {
        showLog("RECEIVE_ADD_PARTICIPANT", jsonAddParticipant);
    } else {
        showLog("RECEIVE_ADD_PARTICIPANT");
    }
    messageCallbacks.remove(messageUniqueId);
    listenerManager.callOnThreadAddParticipant(jsonAddParticipant, chatResponse);
}
Also used : ThreadVo(com.fanap.podchat.cachemodel.ThreadVo) ResultAddParticipant(com.fanap.podchat.model.ResultAddParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) RequestCreateThread(com.fanap.podchat.requestobject.RequestCreateThread) ResultPinThread(com.fanap.podchat.chat.pin.pin_thread.model.ResultPinThread) Thread(com.fanap.podchat.mainmodel.Thread) RequestLeaveThread(com.fanap.podchat.requestobject.RequestLeaveThread) HandlerThread(android.os.HandlerThread) PinThread(com.fanap.podchat.chat.pin.pin_thread.PinThread) ResultLeaveThread(com.fanap.podchat.model.ResultLeaveThread) RequestMuteThread(com.fanap.podchat.requestobject.RequestMuteThread) ResultJoinPublicThread(com.fanap.podchat.chat.thread.public_thread.ResultJoinPublicThread) RequestJoinPublicThread(com.fanap.podchat.chat.thread.public_thread.RequestJoinPublicThread) PublicThread(com.fanap.podchat.chat.thread.public_thread.PublicThread) RequestThread(com.fanap.podchat.requestobject.RequestThread) ResultThread(com.fanap.podchat.model.ResultThread) RequestPinThread(com.fanap.podchat.chat.pin.pin_thread.model.RequestPinThread)

Example 2 with ResultAddParticipant

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

the class ParticipantsManager method prepareAddParticipantResponse.

public static ChatResponse<ResultAddParticipant> prepareAddParticipantResponse(ChatMessage chatMessage, Thread thread) {
    ChatResponse<ResultAddParticipant> chatResponse = new ChatResponse<>();
    ResultAddParticipant resultAddParticipant = new ResultAddParticipant();
    resultAddParticipant.setThread(thread);
    chatResponse.setErrorCode(0);
    chatResponse.setErrorMessage("");
    chatResponse.setHasError(false);
    chatResponse.setResult(resultAddParticipant);
    chatResponse.setUniqueId(chatMessage.getUniqueId());
    return chatResponse;
}
Also used : ResultAddParticipant(com.fanap.podchat.model.ResultAddParticipant) ChatResponse(com.fanap.podchat.model.ChatResponse)

Aggregations

ResultAddParticipant (com.fanap.podchat.model.ResultAddParticipant)2 HandlerThread (android.os.HandlerThread)1 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)1 ThreadVo (com.fanap.podchat.cachemodel.ThreadVo)1 PinThread (com.fanap.podchat.chat.pin.pin_thread.PinThread)1 RequestPinThread (com.fanap.podchat.chat.pin.pin_thread.model.RequestPinThread)1 ResultPinThread (com.fanap.podchat.chat.pin.pin_thread.model.ResultPinThread)1 PublicThread (com.fanap.podchat.chat.thread.public_thread.PublicThread)1 RequestJoinPublicThread (com.fanap.podchat.chat.thread.public_thread.RequestJoinPublicThread)1 ResultJoinPublicThread (com.fanap.podchat.chat.thread.public_thread.ResultJoinPublicThread)1 Thread (com.fanap.podchat.mainmodel.Thread)1 ChatResponse (com.fanap.podchat.model.ChatResponse)1 ResultLeaveThread (com.fanap.podchat.model.ResultLeaveThread)1 ResultThread (com.fanap.podchat.model.ResultThread)1 RequestCreateThread (com.fanap.podchat.requestobject.RequestCreateThread)1 RequestLeaveThread (com.fanap.podchat.requestobject.RequestLeaveThread)1 RequestMuteThread (com.fanap.podchat.requestobject.RequestMuteThread)1 RequestThread (com.fanap.podchat.requestobject.RequestThread)1