diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index 0ae8faac1..03d97d51f 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -1059,6 +1059,7 @@ public class CallController extends BaseController { } ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId); + ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomToken(roomToken); ApplicationWideCurrentRoomHolder.getInstance().setInCall(true); ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(userEntity); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index 7180336b5..c4f1b8831 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java @@ -445,6 +445,7 @@ public class ChatController extends BaseController implements MessagesListAdapte } ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId); + ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomToken(roomId); ApplicationWideCurrentRoomHolder.getInstance().setInCall(false); ApplicationWideCurrentRoomHolder.getInstance().setUserInRoom(conversationUser); diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationJob.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationJob.java index 4d3caaa1a..6a74eccbe 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationJob.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationJob.java @@ -126,8 +126,10 @@ public class NotificationJob extends Job { boolean hasChatSupport = signatureVerification.getUserEntity().hasSpreedCapabilityWithName ("chat-v2"); - boolean isInTheSameRoomAsNotification = ApplicationWideCurrentRoomHolder.getInstance(). - getCurrentRoomId().equals(decryptedPushMessage.getId()) && + boolean isInTheSameRoomAsNotification = (ApplicationWideCurrentRoomHolder.getInstance(). + getCurrentRoomId().equals(decryptedPushMessage.getId()) || + ApplicationWideCurrentRoomHolder.getInstance() + .getCurrentRoomToken().equals(decryptedPushMessage.getId())) && signatureVerification.getUserEntity().equals(ApplicationWideCurrentRoomHolder .getInstance().getUserInRoom()); diff --git a/app/src/main/java/com/nextcloud/talk/utils/singletons/ApplicationWideCurrentRoomHolder.java b/app/src/main/java/com/nextcloud/talk/utils/singletons/ApplicationWideCurrentRoomHolder.java index 76ed34595..f4ac91c34 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/singletons/ApplicationWideCurrentRoomHolder.java +++ b/app/src/main/java/com/nextcloud/talk/utils/singletons/ApplicationWideCurrentRoomHolder.java @@ -24,6 +24,7 @@ import com.nextcloud.talk.models.database.UserEntity; public class ApplicationWideCurrentRoomHolder { private String currentRoomId = ""; + private String currentRoomToken = ""; private UserEntity userInRoom = new UserEntity(); private boolean inCall = false; @@ -37,6 +38,15 @@ public class ApplicationWideCurrentRoomHolder { currentRoomId = ""; userInRoom = new UserEntity(); inCall = false; + currentRoomToken = ""; + } + + public String getCurrentRoomToken() { + return currentRoomToken; + } + + public void setCurrentRoomToken(String currentRoomToken) { + this.currentRoomToken = currentRoomToken; } public String getCurrentRoomId() {