Rename the UUID flag to be more explicit.
This commit is contained in:
parent
9ac142688a
commit
5605fde777
7 changed files with 17 additions and 18 deletions
|
@ -307,7 +307,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActivity implement
|
|||
byte[] localId;
|
||||
byte[] remoteId;
|
||||
|
||||
if (FeatureFlags.uuids() && recipient.resolve().getUuid().isPresent()) {
|
||||
if (FeatureFlags.uuidOnlyContacts() && recipient.resolve().getUuid().isPresent()) {
|
||||
Log.i(TAG, "Using UUID (version 2).");
|
||||
version = 2;
|
||||
localId = UuidUtil.toByteArray(TextSecurePreferences.getLocalUuid(requireContext()));
|
||||
|
|
|
@ -57,7 +57,6 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
|
|||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -1832,7 +1831,7 @@ public class RecipientDatabase extends Database {
|
|||
}
|
||||
|
||||
private static ContentValues validateContactValuesForInsert(ContentValues values) {
|
||||
if (!FeatureFlags.uuids() &&
|
||||
if (!FeatureFlags.uuidOnlyContacts() &&
|
||||
values.getAsString(UUID) != null &&
|
||||
values.getAsString(PHONE) == null)
|
||||
{
|
||||
|
|
|
@ -179,7 +179,7 @@ public class Recipient {
|
|||
} else if (!recipient.isRegistered()) {
|
||||
db.markRegistered(recipient.getId());
|
||||
|
||||
if (FeatureFlags.uuids()) {
|
||||
if (FeatureFlags.cds()) {
|
||||
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class Recipient {
|
|||
|
||||
return resolved(recipient.getId());
|
||||
} else if (uuid != null) {
|
||||
if (FeatureFlags.uuids() || e164 != null) {
|
||||
if (FeatureFlags.uuidOnlyContacts() || e164 != null) {
|
||||
RecipientId id = db.getOrInsertFromUuid(uuid);
|
||||
db.markRegistered(id, uuid);
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class Recipient {
|
|||
|
||||
return resolved(id);
|
||||
} else {
|
||||
if (!FeatureFlags.uuids() && FeatureFlags.groupsV2()) {
|
||||
if (!FeatureFlags.uuidOnlyContacts() && FeatureFlags.groupsV2()) {
|
||||
throw new RuntimeException(new UuidRecipientError());
|
||||
} else {
|
||||
throw new UuidRecipientError();
|
||||
|
@ -209,7 +209,7 @@ public class Recipient {
|
|||
if (!recipient.isRegistered()) {
|
||||
db.markRegistered(recipient.getId());
|
||||
|
||||
if (FeatureFlags.uuids()) {
|
||||
if (FeatureFlags.cds()) {
|
||||
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public class Recipient {
|
|||
if (UuidUtil.isUuid(identifier)) {
|
||||
UUID uuid = UuidUtil.parseOrThrow(identifier);
|
||||
|
||||
if (FeatureFlags.uuids()) {
|
||||
if (FeatureFlags.uuidOnlyContacts()) {
|
||||
id = db.getOrInsertFromUuid(uuid);
|
||||
} else {
|
||||
Optional<RecipientId> possibleId = db.getByUuid(uuid);
|
||||
|
@ -280,7 +280,7 @@ public class Recipient {
|
|||
if (possibleId.isPresent()) {
|
||||
id = possibleId.get();
|
||||
} else {
|
||||
if (!FeatureFlags.uuids() && FeatureFlags.groupsV2()) {
|
||||
if (!FeatureFlags.uuidOnlyContacts() && FeatureFlags.groupsV2()) {
|
||||
throw new RuntimeException(new UuidRecipientError());
|
||||
} else {
|
||||
throw new UuidRecipientError();
|
||||
|
@ -754,7 +754,7 @@ public class Recipient {
|
|||
if (FeatureFlags.usernames()) {
|
||||
return true;
|
||||
} else {
|
||||
return FeatureFlags.uuids() && uuidCapability == Capability.SUPPORTED;
|
||||
return FeatureFlags.uuidOnlyContacts() && uuidCapability == Capability.SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class RecipientUtil {
|
|||
throw new AssertionError(recipient.getId() + " - No UUID or phone number!");
|
||||
}
|
||||
|
||||
if (FeatureFlags.uuids() && !recipient.getUuid().isPresent()) {
|
||||
if (FeatureFlags.cds() && !recipient.getUuid().isPresent()) {
|
||||
Log.i(TAG, recipient.getId() + " is missing a UUID...");
|
||||
try {
|
||||
RegisteredState state = DirectoryHelper.refreshDirectoryFor(context, recipient, false);
|
||||
|
|
|
@ -441,7 +441,7 @@ public final class StorageSyncHelper {
|
|||
}
|
||||
|
||||
private static boolean isValidContact(@NonNull SignalContactRecord contact) {
|
||||
return FeatureFlags.uuids() || contact.getAddress().getNumber().isPresent();
|
||||
return FeatureFlags.uuidOnlyContacts() || contact.getAddress().getNumber().isPresent();
|
||||
}
|
||||
|
||||
public static final class KeyDifferenceResult {
|
||||
|
|
|
@ -187,15 +187,15 @@ public final class FeatureFlags {
|
|||
Log.i(TAG, "[Disk] After : " + result.getDisk().toString());
|
||||
}
|
||||
|
||||
/** UUID-related stuff that shouldn't be activated until the user-facing launch. */
|
||||
public static synchronized boolean uuids() {
|
||||
/** Whether or not we allow UUID-only contacts. */
|
||||
public static synchronized boolean uuidOnlyContacts() {
|
||||
return getBoolean(UUIDS, false);
|
||||
}
|
||||
|
||||
/** Creating usernames, sending messages by username. Requires {@link #uuids()}. */
|
||||
/** Creating usernames, sending messages by username. Requires {@link #uuidOnlyContacts()}. */
|
||||
public static synchronized boolean usernames() {
|
||||
boolean value = getBoolean(USERNAMES, false);
|
||||
if (value && !uuids()) throw new MissingFlagRequirementError();
|
||||
if (value && !uuidOnlyContacts()) throw new MissingFlagRequirementError();
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ public final class FeatureFlags {
|
|||
return groupsV2() && getBoolean(GROUPS_V2_INTERNAL_TEST, false);
|
||||
}
|
||||
|
||||
/** Whether or not to use the new contact discovery service endpoint. */
|
||||
/** Whether or not to use the new contact discovery service endpoint, which supports UUIDs. */
|
||||
public static boolean cds() {
|
||||
return getBoolean(CDS, false);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public final class StorageSyncHelperTest {
|
|||
|
||||
@Test
|
||||
public void resolveConflict_complex() {
|
||||
when(FeatureFlags.uuids()).thenReturn(true);
|
||||
when(FeatureFlags.uuidOnlyContacts()).thenReturn(true);
|
||||
|
||||
SignalContactRecord remote1 = contact(1, UUID_A, null, "a");
|
||||
SignalContactRecord local1 = contact(2, UUID_A, E164_A, "a");
|
||||
|
|
Loading…
Add table
Reference in a new issue