use of com.fanap.podchat.model.ResultHistory in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method publishChatHistoryServerResult.
private void publishChatHistoryServerResult(Callback callback, ChatMessage chatMessage, List<MessageVO> messageVOS) {
ResultHistory resultHistory = new ResultHistory();
if (cache) {
//
// Observable.just(resultHistory)
// .asObservable()
// .map(resultHistoryEMP -> {
// resultHistoryEMP.setSending(dataSource.getAllSendingQueueByThreadId(chatMessage.getSubjectId()));
// return resultHistoryEMP;
// })
// .map(resultHistoryWithSending -> {
//
// resultHistoryWithSending.setUploadingQueue(dataSource.getAllUploadingQueueByThreadId(chatMessage.getSubjectId()));
// return resultHistoryWithSending;
//
// })
// .map(resultHistoryWithUploading -> {
//
// resultHistoryWithUploading.setFailed(dataSource.getAllWaitQueueCacheByThreadId(chatMessage.getSubjectId()));
// return resultHistoryWithUploading;
//
// });
// resultHistory.setSending(messageDatabaseHelper.getAllSendingQueueByThreadId(chatMessage.getSubjectId()));
// resultHistory.setUploadingQueue(messageDatabaseHelper.getAllUploadingQueueByThreadId(chatMessage.getSubjectId()));
// resultHistory.setFailed(messageDatabaseHelper.getAllWaitQueueCacheByThreadId(chatMessage.getSubjectId()));
//
resultHistory.setSending(dataSource.getAllSendingQueueByThreadId(chatMessage.getSubjectId()));
resultHistory.setUploadingQueue(dataSource.getAllUploadingQueueByThreadId(chatMessage.getSubjectId()));
resultHistory.setFailed(dataSource.getAllWaitQueueCacheByThreadId(chatMessage.getSubjectId()));
}
ChatResponse<ResultHistory> chatResponse = new ChatResponse<>();
resultHistory.setNextOffset(callback.getOffset() + messageVOS.size());
resultHistory.setContentCount(chatMessage.getContentCount());
resultHistory.setHasNext(messageVOS.size() + callback.getOffset() < chatMessage.getContentCount());
chatResponse.setSubjectId(chatMessage.getSubjectId());
resultHistory.setHistory(messageVOS);
chatResponse.setErrorCode(0);
chatResponse.setHasError(false);
chatResponse.setErrorMessage("");
chatResponse.setResult(resultHistory);
chatResponse.setUniqueId(chatMessage.getUniqueId());
String json = gson.toJson(chatResponse);
if (sentryResponseLog) {
showLog("RECEIVE_GET_HISTORY", json);
} else {
showLog("RECEIVE_GET_HISTORY");
}
messageCallbacks.remove(chatMessage.getUniqueId());
listenerManager.callOnGetThreadHistory(json, chatResponse);
}
use of com.fanap.podchat.model.ResultHistory in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method notifyChatHistoryReceived.
private void notifyChatHistoryReceived(Callback callback, ChatMessage chatMessage, List<MessageVO> messageVOS) {
ChatResponse<ResultHistory> chr = new ChatResponse<>();
ResultHistory rh = new ResultHistory();
rh.setHistory(messageVOS);
chr.setResult(rh);
chr.setSubjectId(chatMessage.getSubjectId());
chr.setUniqueId(chatMessage.getUniqueId());
Objects.requireNonNull(handlerSend.get(chatMessage.getUniqueId())).onGetHistory(chr, chatMessage, callback);
}
use of com.fanap.podchat.model.ResultHistory in project pod-chat-android-sdk by FanapSoft.
the class Mention method getHashTagListCacheResponse.
public static ChatResponse<ResultHistory> getHashTagListCacheResponse(RequestGetHashTagList request, List<MessageVO> messageVOS, String uniqueId, long contentCount) {
ResultHistory resultHistory = new ResultHistory();
resultHistory.setContentCount(contentCount);
resultHistory.setHistory(messageVOS);
ChatResponse<ResultHistory> finalResponse = new ChatResponse<>();
finalResponse.setResult(resultHistory);
finalResponse.setUniqueId(uniqueId);
finalResponse.setSubjectId(request.getThreadId());
finalResponse.setCache(true);
return finalResponse;
}
use of com.fanap.podchat.model.ResultHistory in project pod-chat-android-sdk by FanapSoft.
the class Mention method getMentionListCacheResponse.
public static ChatResponse<ResultHistory> getMentionListCacheResponse(RequestGetMentionList request, List<MessageVO> messageVOS, String uniqueId, long contentCount) {
ResultHistory resultHistory = new ResultHistory();
resultHistory.setContentCount(contentCount);
resultHistory.setHistory(messageVOS);
ChatResponse<ResultHistory> finalResponse = new ChatResponse<>();
finalResponse.setResult(resultHistory);
finalResponse.setUniqueId(uniqueId);
finalResponse.setSubjectId(request.getThreadId());
finalResponse.setCache(true);
return finalResponse;
}
use of com.fanap.podchat.model.ResultHistory in project pod-chat-android-sdk by FanapSoft.
the class HashTagManager method getMentionListCacheResponse.
public static ChatResponse<ResultHistory> getMentionListCacheResponse(RequestGetMentionList request, List<MessageVO> messageVOS, String uniqueId, long contentCount) {
ResultHistory resultHistory = new ResultHistory();
resultHistory.setContentCount(contentCount);
resultHistory.setHistory(messageVOS);
ChatResponse<ResultHistory> finalResponse = new ChatResponse<>();
finalResponse.setResult(resultHistory);
finalResponse.setUniqueId(uniqueId);
finalResponse.setSubjectId(request.getThreadId());
finalResponse.setCache(true);
return finalResponse;
}
Aggregations