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
Родитель b4662b78ec
Коммит 8dba5aa889
4 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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());

Просмотреть файл

@ -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() {