Search in sources :

Example 1 with ResultBlock

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

the class ChatCore method handleUnBlock.

private void handleUnBlock(ChatMessage chatMessage, String messageUniqueId) {
    BlockedContact contact = gson.fromJson(chatMessage.getContent(), BlockedContact.class);
    ChatResponse<ResultBlock> chatResponse = new ChatResponse<>();
    ResultBlock resultBlock = new ResultBlock();
    resultBlock.setContact(contact);
    chatResponse.setResult(resultBlock);
    chatResponse.setErrorCode(0);
    chatResponse.setHasError(false);
    chatResponse.setUniqueId(chatMessage.getUniqueId());
    String jsonUnBlock = gson.toJson(chatResponse);
    if (sentryResponseLog) {
        showLog("RECEIVE_UN_BLOCK", jsonUnBlock);
    } else {
        showLog("RECEIVE_UN_BLOCK");
    }
    messageCallbacks.remove(messageUniqueId);
    if (cache) {
        dataSource.deleteBlockedContactById(contact.getBlockId());
    }
    listenerManager.callOnUnBlock(jsonUnBlock, chatResponse);
}
Also used : BlockedContact(com.fanap.podchat.mainmodel.BlockedContact) ChatResponse(com.fanap.podchat.model.ChatResponse) ResultBlock(com.fanap.podchat.model.ResultBlock)

Example 2 with ResultBlock

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

the class ChatCore method handleOutPutBlock.

private void handleOutPutBlock(ChatMessage chatMessage, String messageUniqueId) {
    BlockedContact contact = gson.fromJson(chatMessage.getContent(), BlockedContact.class);
    ChatResponse<ResultBlock> chatResponse = new ChatResponse<>();
    ResultBlock resultBlock = new ResultBlock();
    resultBlock.setContact(contact);
    chatResponse.setResult(resultBlock);
    chatResponse.setErrorCode(0);
    chatResponse.setHasError(false);
    chatResponse.setUniqueId(chatMessage.getUniqueId());
    String jsonBlock = gson.toJson(chatResponse);
    if (cache) {
        dataSource.saveBlockedContactResultFromServer(contact);
    }
    if (sentryResponseLog) {
        showLog("RECEIVE_BLOCK", jsonBlock);
    } else {
        showLog("RECEIVE_BLOCK");
    }
    messageCallbacks.remove(messageUniqueId);
    listenerManager.callOnBlock(jsonBlock, chatResponse);
}
Also used : BlockedContact(com.fanap.podchat.mainmodel.BlockedContact) ChatResponse(com.fanap.podchat.model.ChatResponse) ResultBlock(com.fanap.podchat.model.ResultBlock)

Aggregations

BlockedContact (com.fanap.podchat.mainmodel.BlockedContact)2 ChatResponse (com.fanap.podchat.model.ChatResponse)2 ResultBlock (com.fanap.podchat.model.ResultBlock)2