Add a second-generation GV2 capability and ignore the old capability for iOS devices.

This commit is contained in:
Jon Chambers
2020-09-21 18:11:50 -04:00
committed by Jon Chambers
parent 5756be7d36
commit 5986145282
6 changed files with 47 additions and 13 deletions

View File

@@ -140,7 +140,13 @@ public class Account implements Principal {
public boolean isGroupsV2Supported() {
return devices.stream()
.filter(Device::isEnabled)
.allMatch(device -> device.getCapabilities() != null && device.getCapabilities().isGv2());
.allMatch(device -> {
if (device.getApnId() != null || device.getVoipApnId() != null) {
return device.getCapabilities() != null && device.getCapabilities().isGv2_2();
} else {
return device.getCapabilities() != null && (device.getCapabilities().isGv2() || device.getCapabilities().isGv2_2());
}
});
}
public boolean isStorageSupported() {

View File

@@ -19,12 +19,10 @@ package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.whispersystems.textsecuregcm.auth.AuthenticationCredentials;
import org.whispersystems.textsecuregcm.entities.UserCapabilities;
import org.whispersystems.textsecuregcm.entities.SignedPreKey;
import org.whispersystems.textsecuregcm.util.Util;
import javax.annotation.Nullable;
import javax.validation.constraints.Null;
import java.util.concurrent.TimeUnit;
public class Device {
@@ -270,6 +268,9 @@ public class Device {
@JsonProperty
private boolean gv2;
@JsonProperty("gv2-2")
private boolean gv2_2;
@JsonProperty
private boolean storage;
@@ -278,8 +279,9 @@ public class Device {
public DeviceCapabilities() {}
public DeviceCapabilities(boolean gv2, boolean storage, boolean transfer) {
public DeviceCapabilities(boolean gv2, final boolean gv2_2, boolean storage, boolean transfer) {
this.gv2 = gv2;
this.gv2_2 = gv2_2;
this.storage = storage;
this.transfer = transfer;
}
@@ -288,6 +290,10 @@ public class Device {
return gv2;
}
public boolean isGv2_2() {
return gv2_2;
}
public boolean isStorage() {
return storage;
}