use of com.fanap.podchat.requestobject.RequestGetHistory in project pod-chat-android-sdk by FanapSoft.
the class TextMessagesQueueTest method populateMessagesFromServer.
public void populateMessagesFromServer() {
populateThreadsListFromServerOnly();
assert threads.size() > 0;
Thread thread = threads.get(0);
chatListeners = new ChatListener() {
@Override
public void onGetHistory(String content, ChatResponse<ResultHistory> history) {
if (!history.isCache()) {
System.out.println("Received Message List Server: " + content);
threadMessagesList.addAll(history.getResult().getHistory().stream().filter(messageVO -> messageVO.getMessage() != null).collect(Collectors.toList()));
chat.removeListener(chatListeners);
resumeProcess();
}
}
};
chat.addListener(chatListeners);
RequestGetHistory requestGetHistory = new RequestGetHistory.Builder(thread.getId()).withNoCache().build();
chat.getHistory(requestGetHistory, null);
pauseProcess();
}
use of com.fanap.podchat.requestobject.RequestGetHistory in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method getThreadHistory.
public void getThreadHistory() {
if (TEST_THREAD_LAST_SEEN_MESSAGE_TIME > 0) {
showToast("Get History to time " + TEST_THREAD_LAST_SEEN_MESSAGE_TIME);
RequestGetHistory request = new RequestGetHistory.Builder(TEST_THREAD_ID).offset(0).count(50).order(// .order("asc")
"desc").toTime(TEST_THREAD_LAST_SEEN_MESSAGE_TIME).build();
presenter.getHistory(request, null);
showToast("Get History from time " + TEST_THREAD_LAST_SEEN_MESSAGE_TIME);
request = new RequestGetHistory.Builder(TEST_THREAD_ID).offset(0).count(50).order(// .order("asc")
"asc").fromTime(TEST_THREAD_LAST_SEEN_MESSAGE_TIME).build();
presenter.getHistory(request, null);
}
}
Aggregations