use of com.fanap.podchat.model.ResultParticipant in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleOutPutDeliveredMessageList.
private void handleOutPutDeliveredMessageList(ChatMessage chatMessage, Callback callback) {
try {
ChatResponse<ResultParticipant> chatResponse = new ChatResponse<>();
chatResponse.setUniqueId(chatMessage.getUniqueId());
ResultParticipant resultParticipant = new ResultParticipant();
List<Participant> participants = gson.fromJson(chatMessage.getContent(), new TypeToken<ArrayList<Participant>>() {
}.getType());
resultParticipant.setParticipants(participants);
resultParticipant.setContentCount(chatMessage.getContentCount());
resultParticipant.setNextOffset(callback.getOffset() + participants.size());
resultParticipant.setContentCount(chatMessage.getContentCount());
resultParticipant.setHasNext(participants.size() + callback.getOffset() < chatMessage.getContentCount());
chatResponse.setResult(resultParticipant);
String content = gson.toJson(chatResponse);
if (sentryResponseLog) {
showLog("RECEIVE_DELIVERED_MESSAGE_LIST", content);
} else {
showLog("RECEIVE_DELIVERED_MESSAGE_LIST");
}
listenerManager.callOnDeliveredMessageList(content, chatResponse);
} catch (Exception e) {
showErrorLog(e.getMessage());
onUnknownException(chatMessage.getUniqueId(), e);
}
}
use of com.fanap.podchat.model.ResultParticipant in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method populateParticipantList.
@Test
public void populateParticipantList() {
populateThreadsListFromServerOnly();
assert threads.size() > 0;
Thread thread = getValidGroupThread();
chatListeners = new ChatListener() {
@Override
public void onGetThreadParticipant(String content, ChatResponse<ResultParticipant> response) {
System.out.println("Received Participant, Cache: " + response.isCache() + " Content: " + content);
if (response.getResult().getParticipants().size() > 1) {
threadParticipant.addAll(response.getResult().getParticipants());
chat.removeListener(chatListeners);
resumeProcess();
} else {
threads.remove(thread);
Thread t2 = getValidGroupThread();
print("try again changing thread...");
RequestThreadParticipant request = new RequestThreadParticipant.Builder().threadId(t2.getId()).build();
chat.getThreadParticipants(request, null);
}
}
};
chat.addListener(chatListeners);
RequestThreadParticipant request = new RequestThreadParticipant.Builder().threadId(thread.getId()).build();
chat.getThreadParticipants(request, null);
pauseProcess();
}
Aggregations