Fix issued with unread messages

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-07-23 11:41:04 +02:00
parent 0c73a75990
commit 893c014cb8

View File

@ -167,6 +167,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private String roomId; private String roomId;
private boolean voiceOnly; private boolean voiceOnly;
private boolean isFirstMessagesProcessing = true; private boolean isFirstMessagesProcessing = true;
private boolean havePulledFutureBefore = false;
private boolean isLeavingForConversation; private boolean isLeavingForConversation;
private boolean isLinkPreviewAllowed; private boolean isLinkPreviewAllowed;
private boolean wasDetached; private boolean wasDetached;
@ -681,6 +682,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
currentCall = callOverall.getOcs().getData(); currentCall = callOverall.getOcs().getData();
ApplicationWideCurrentRoomHolder.getInstance().setSession(currentCall.getSessionId()); ApplicationWideCurrentRoomHolder.getInstance().setSession(currentCall.getSessionId());
startPing(); startPing();
havePulledFutureBefore = false;
if (isFirstMessagesProcessing) { if (isFirstMessagesProcessing) {
pullChatMessages(0); pullChatMessages(0);
} else { } else {
@ -739,6 +742,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
@Override @Override
public void onNext(GenericOverall genericOverall) { public void onNext(GenericOverall genericOverall) {
dispose(); dispose();
if (magicWebSocketInstance != null && currentCall != null) {
magicWebSocketInstance.joinRoomWithRoomTokenAndSession("", currentCall.getSessionId());
}
if (!isDestroyed() && !isBeingDestroyed() && !wasDetached) { if (!isDestroyed() && !isBeingDestroyed() && !wasDetached) {
getRouter().popCurrentController(); getRouter().popCurrentController();
} }
@ -843,16 +851,14 @@ public class ChatController extends BaseController implements MessagesListAdapte
return; return;
} }
if (lookIntoFuture == 1 && magicWebSocketInstance != null) { if (havePulledFutureBefore && lookIntoFuture == 1 && magicWebSocketInstance != null ) {
return; return;
} }
if (!lookingIntoFuture && lookIntoFuture > 0) { if (!lookingIntoFuture && lookIntoFuture > 0) {
lookingIntoFuture = true; lookingIntoFuture = true;
}
if (lookIntoFuture > 1) {
lookIntoFuture = 1; lookIntoFuture = 1;
havePulledFutureBefore = true;
} }
Map<String, Integer> fieldMap = new HashMap<>(); Map<String, Integer> fieldMap = new HashMap<>();