mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Add GV2 recipient capability.
This commit is contained in:
committed by
Greyson Parrelli
parent
82305ce2b3
commit
172a43679d
@@ -91,6 +91,7 @@ public class Recipient {
|
||||
private final UnidentifiedAccessMode unidentifiedAccessMode;
|
||||
private final boolean forceSmsSelection;
|
||||
private final boolean uuidSupported;
|
||||
private final Capability groupsV2Capability;
|
||||
private final InsightsBannerTier insightsBannerTier;
|
||||
private final byte[] storageKey;
|
||||
private final byte[] identityKey;
|
||||
@@ -324,6 +325,7 @@ public class Recipient {
|
||||
this.unidentifiedAccessMode = UnidentifiedAccessMode.DISABLED;
|
||||
this.forceSmsSelection = false;
|
||||
this.uuidSupported = false;
|
||||
this.groupsV2Capability = Capability.UNKNOWN;
|
||||
this.storageKey = null;
|
||||
this.identityKey = null;
|
||||
this.identityStatus = VerifiedStatus.DEFAULT;
|
||||
@@ -364,6 +366,7 @@ public class Recipient {
|
||||
this.unidentifiedAccessMode = details.unidentifiedAccessMode;
|
||||
this.forceSmsSelection = details.forceSmsSelection;
|
||||
this.uuidSupported = details.uuidSuported;
|
||||
this.groupsV2Capability = details.groupsV2Capability;
|
||||
this.storageKey = details.storageKey;
|
||||
this.identityKey = details.identityKey;
|
||||
this.identityStatus = details.identityStatus;
|
||||
@@ -687,6 +690,10 @@ public class Recipient {
|
||||
}
|
||||
}
|
||||
|
||||
public Capability getGroupsV2Capability() {
|
||||
return groupsV2Capability;
|
||||
}
|
||||
|
||||
public @Nullable byte[] getProfileKey() {
|
||||
return profileKey;
|
||||
}
|
||||
@@ -762,6 +769,34 @@ public class Recipient {
|
||||
return id.equals(recipient.id);
|
||||
}
|
||||
|
||||
public enum Capability {
|
||||
UNKNOWN(0),
|
||||
SUPPORTED(1),
|
||||
NOT_SUPPORTED(-1);
|
||||
|
||||
private final int value;
|
||||
|
||||
Capability(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int serialize() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Capability deserialize(int value) {
|
||||
switch (value) {
|
||||
case 1 : return SUPPORTED;
|
||||
case -1 : return NOT_SUPPORTED;
|
||||
default : return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public static Capability fromBoolean(boolean supported) {
|
||||
return supported ? SUPPORTED : NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
|
||||
@@ -56,6 +56,7 @@ public class RecipientDetails {
|
||||
final UnidentifiedAccessMode unidentifiedAccessMode;
|
||||
final boolean forceSmsSelection;
|
||||
final boolean uuidSuported;
|
||||
final Recipient.Capability groupsV2Capability;
|
||||
final InsightsBannerTier insightsBannerTier;
|
||||
final byte[] storageKey;
|
||||
final byte[] identityKey;
|
||||
@@ -100,6 +101,7 @@ public class RecipientDetails {
|
||||
this.unidentifiedAccessMode = settings.getUnidentifiedAccessMode();
|
||||
this.forceSmsSelection = settings.isForceSmsSelection();
|
||||
this.uuidSuported = settings.isUuidSupported();
|
||||
this.groupsV2Capability = settings.getGroupsV2Capability();
|
||||
this.insightsBannerTier = settings.getInsightsBannerTier();
|
||||
this.storageKey = settings.getStorageKey();
|
||||
this.identityKey = settings.getIdentityKey();
|
||||
@@ -146,6 +148,7 @@ public class RecipientDetails {
|
||||
this.forceSmsSelection = false;
|
||||
this.name = null;
|
||||
this.uuidSuported = false;
|
||||
this.groupsV2Capability = Recipient.Capability.UNKNOWN;
|
||||
this.storageKey = null;
|
||||
this.identityKey = null;
|
||||
this.identityStatus = VerifiedStatus.DEFAULT;
|
||||
|
||||
Reference in New Issue
Block a user