use of com.fanap.podchat.cachemodel.queue.SendingQueueCache in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method moveFromSendingQueueToWaitQueue.
private void moveFromSendingQueueToWaitQueue(String uniqueId) {
SendingQueueCache queueCache;
if (cache) {
// messageDatabaseHelper.moveFromSendQueueToWaitQueue(uniqueId);
dataSource.moveFromSendingToWaitingQueue(uniqueId);
} else {
queueCache = sendingQList.get(uniqueId);
if (queueCache != null) {
WaitQueueCache waitMessageQueue = getWaitQueueCacheFromSendQueue(queueCache, uniqueId);
waitQList.put(uniqueId, waitMessageQueue);
}
}
}
use of com.fanap.podchat.cachemodel.queue.SendingQueueCache in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method getSendingFromWaitingMessage.
public static SendingQueueCache getSendingFromWaitingMessage(WaitQueueCache waitQueueCache) {
SendingQueueCache sendingQueueCache = new SendingQueueCache();
sendingQueueCache.setAsyncContent(waitQueueCache.getAsyncContent());
sendingQueueCache.setId(waitQueueCache.getId());
sendingQueueCache.setMessage(waitQueueCache.getMessage());
sendingQueueCache.setMetadata(waitQueueCache.getMetadata());
sendingQueueCache.setThreadId(waitQueueCache.getThreadId());
sendingQueueCache.setUniqueId(waitQueueCache.getUniqueId());
sendingQueueCache.setSystemMetadata(waitQueueCache.getSystemMetadata());
return sendingQueueCache;
}
use of com.fanap.podchat.cachemodel.queue.SendingQueueCache in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method getSendingFromSendingCache.
public static List<Sending> getSendingFromSendingCache(List<SendingQueueCache> listCaches) {
List<Sending> listQueues = new ArrayList<>();
for (SendingQueueCache queueCache : listCaches) {
Sending sending = new Sending();
sending.setThreadId(queueCache.getThreadId());
MessageVO messageVO = new MessageVO();
messageVO.setId(queueCache.getId());
messageVO.setMessage(queueCache.getMessage());
messageVO.setMessageType(queueCache.getMessageType());
messageVO.setMetadata(queueCache.getMetadata());
messageVO.setSystemMetadata(queueCache.getSystemMetadata());
sending.setMessageVo(messageVO);
sending.setUniqueId(queueCache.getUniqueId());
listQueues.add(sending);
}
return listQueues;
}
use of com.fanap.podchat.cachemodel.queue.SendingQueueCache in project pod-chat-android-sdk by FanapSoft.
the class TextMessagesQueueTest method checkSendingQueue.
@Test
public void checkSendingQueue() {
populateThreadsListFromServerOnly();
assert threads.size() > 0;
Thread thread = threads.get(0);
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.setListener(mTestListener);
chat.closeChat();
sleep(2000);
Assert.assertNotEquals(chat.getChatState(), CHAT_READY);
RequestMessage request = new RequestMessage.Builder("Android Test " + new Date(), thread.getId()).messageType(TextMessageType.Constants.TEXT).build();
String uniqueId = chat.sendTextMessage(request, null);
List<SendingQueueCache> sendQ = chat.getSendingQ();
Assert.assertTrue(sendQ.stream().anyMatch(sendingQueueCache -> sendingQueueCache.getUniqueId().equals(uniqueId)));
}
Aggregations