Procházet zdrojové kódy

Fix in-the-same-conversation detection

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic před 6 roky
rodič
revize
8dba5aa889

+ 1 - 0
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);
 

+ 1 - 0
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);
 

+ 4 - 2
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());
 

+ 10 - 0
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() {