Fix in-the-same-conversation detection

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-07-29 20:42:13 +02:00
parent b4662b78ec
commit 8dba5aa889
4 changed files with 16 additions and 2 deletions

View file

@ -1059,6 +1059,7 @@ public class CallController extends BaseController {
} }
ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId); ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId);
ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomToken(roomToken);
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true); ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(userEntity); ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(userEntity);

View file

@ -445,6 +445,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
} }
ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId); ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId);
ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomToken(roomId);
ApplicationWideCurrentRoomHolder.getInstance().setInCall(false); ApplicationWideCurrentRoomHolder.getInstance().setInCall(false);
ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(conversationUser); ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(conversationUser);

View file

@ -126,8 +126,10 @@ public class NotificationJob extends Job {
boolean hasChatSupport = signatureVerification.getUserEntity().hasSpreedCapabilityWithName boolean hasChatSupport = signatureVerification.getUserEntity().hasSpreedCapabilityWithName
("chat-v2"); ("chat-v2");
boolean isInTheSameRoomAsNotification = ApplicationWideCurrentRoomHolder.getInstance(). boolean isInTheSameRoomAsNotification = (ApplicationWideCurrentRoomHolder.getInstance().
getCurrentRoomId().equals(decryptedPushMessage.getId()) && getCurrentRoomId().equals(decryptedPushMessage.getId()) ||
ApplicationWideCurrentRoomHolder.getInstance()
.getCurrentRoomToken().equals(decryptedPushMessage.getId())) &&
signatureVerification.getUserEntity().equals(ApplicationWideCurrentRoomHolder signatureVerification.getUserEntity().equals(ApplicationWideCurrentRoomHolder
.getInstance().getUserInRoom()); .getInstance().getUserInRoom());

View file

@ -24,6 +24,7 @@ import com.nextcloud.talk.models.database.UserEntity;
public class ApplicationWideCurrentRoomHolder { public class ApplicationWideCurrentRoomHolder {
private String currentRoomId = ""; private String currentRoomId = "";
private String currentRoomToken = "";
private UserEntity userInRoom = new UserEntity(); private UserEntity userInRoom = new UserEntity();
private boolean inCall = false; private boolean inCall = false;
@ -37,6 +38,15 @@ public class ApplicationWideCurrentRoomHolder {
currentRoomId = ""; currentRoomId = "";
userInRoom = new UserEntity(); userInRoom = new UserEntity();
inCall = false; inCall = false;
currentRoomToken = "";
}
public String getCurrentRoomToken() {
return currentRoomToken;
}
public void setCurrentRoomToken(String currentRoomToken) {
this.currentRoomToken = currentRoomToken;
} }
public String getCurrentRoomId() { public String getCurrentRoomId() {