use of com.fanap.podchat.cachemodel.queue.WaitQueueCache 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.WaitQueueCache in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method getFailedFromWaiting.
public static List<Failed> getFailedFromWaiting(List<WaitQueueCache> listCaches) {
List<Failed> listQueues = new ArrayList<>();
for (WaitQueueCache queueCache : listCaches) {
Failed failed = new Failed();
MessageVO messageVO = new MessageVO();
messageVO.setId(queueCache.getId());
messageVO.setMessage(queueCache.getMessage());
messageVO.setMessageType(queueCache.getMessageType());
messageVO.setMetadata(queueCache.getMetadata());
messageVO.setSystemMetadata(queueCache.getSystemMetadata());
failed.setMessageVo(messageVO);
failed.setThreadId(queueCache.getThreadId());
failed.setUniqueId(queueCache.getUniqueId());
listQueues.add(failed);
}
return listQueues;
}
use of com.fanap.podchat.cachemodel.queue.WaitQueueCache in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method getWaitingFromSendingMessage.
public static WaitQueueCache getWaitingFromSendingMessage(@NonNull SendingQueueCache sendingQueue) {
WaitQueueCache waitMessageQueue = new WaitQueueCache();
waitMessageQueue.setUniqueId(sendingQueue.getUniqueId());
waitMessageQueue.setId(sendingQueue.getId());
waitMessageQueue.setAsyncContent(sendingQueue.getAsyncContent());
waitMessageQueue.setMessage(sendingQueue.getMessage());
waitMessageQueue.setThreadId(sendingQueue.getThreadId());
waitMessageQueue.setMessageType(sendingQueue.getMessageType());
waitMessageQueue.setSystemMetadata(sendingQueue.getSystemMetadata());
waitMessageQueue.setMetadata(sendingQueue.getMetadata());
return waitMessageQueue;
}
use of com.fanap.podchat.cachemodel.queue.WaitQueueCache in project pod-chat-android-sdk by FanapSoft.
the class MemoryDataSource method insertToWaitingQueue.
private void insertToWaitingQueue(SendingQueueCache sendingMessage) {
WaitQueueCache waitingMessage = MessageManager.getWaitingFromSendingMessage(sendingMessage);
insert(waitQueue, waitingMessage);
}
use of com.fanap.podchat.cachemodel.queue.WaitQueueCache in project pod-chat-android-sdk by FanapSoft.
the class TextMessagesQueueTest method movingMessageFromWaitingQToSendingQ.
@Test
public void movingMessageFromWaitingQToSendingQ() {
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.setListener(mTestListener);
List<WaitQueueCache> waitList = chat.getWaitingQ();
WaitQueueCache wToSend = waitList.remove(0);
chat.resendMessage(wToSend.getUniqueId());
sleep(1000);
Assert.assertTrue(chat.getWaitingQ().stream().noneMatch(waitQueueCache -> waitQueueCache.getUniqueId().equals(wToSend.getUniqueId())));
}
Aggregations