mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-10 08:18:34 +00:00
Rename the UUID flag to be more explicit.
This commit is contained in:
parent
9ac142688a
commit
5605fde777
@ -307,7 +307,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActivity implement
|
|||||||
byte[] localId;
|
byte[] localId;
|
||||||
byte[] remoteId;
|
byte[] remoteId;
|
||||||
|
|
||||||
if (FeatureFlags.uuids() && recipient.resolve().getUuid().isPresent()) {
|
if (FeatureFlags.uuidOnlyContacts() && recipient.resolve().getUuid().isPresent()) {
|
||||||
Log.i(TAG, "Using UUID (version 2).");
|
Log.i(TAG, "Using UUID (version 2).");
|
||||||
version = 2;
|
version = 2;
|
||||||
localId = UuidUtil.toByteArray(TextSecurePreferences.getLocalUuid(requireContext()));
|
localId = UuidUtil.toByteArray(TextSecurePreferences.getLocalUuid(requireContext()));
|
||||||
|
@ -57,7 +57,6 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
|
|||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -1832,7 +1831,7 @@ public class RecipientDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static ContentValues validateContactValuesForInsert(ContentValues values) {
|
private static ContentValues validateContactValuesForInsert(ContentValues values) {
|
||||||
if (!FeatureFlags.uuids() &&
|
if (!FeatureFlags.uuidOnlyContacts() &&
|
||||||
values.getAsString(UUID) != null &&
|
values.getAsString(UUID) != null &&
|
||||||
values.getAsString(PHONE) == null)
|
values.getAsString(PHONE) == null)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ public class Recipient {
|
|||||||
} else if (!recipient.isRegistered()) {
|
} else if (!recipient.isRegistered()) {
|
||||||
db.markRegistered(recipient.getId());
|
db.markRegistered(recipient.getId());
|
||||||
|
|
||||||
if (FeatureFlags.uuids()) {
|
if (FeatureFlags.cds()) {
|
||||||
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
||||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ public class Recipient {
|
|||||||
|
|
||||||
return resolved(recipient.getId());
|
return resolved(recipient.getId());
|
||||||
} else if (uuid != null) {
|
} else if (uuid != null) {
|
||||||
if (FeatureFlags.uuids() || e164 != null) {
|
if (FeatureFlags.uuidOnlyContacts() || e164 != null) {
|
||||||
RecipientId id = db.getOrInsertFromUuid(uuid);
|
RecipientId id = db.getOrInsertFromUuid(uuid);
|
||||||
db.markRegistered(id, uuid);
|
db.markRegistered(id, uuid);
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ public class Recipient {
|
|||||||
|
|
||||||
return resolved(id);
|
return resolved(id);
|
||||||
} else {
|
} else {
|
||||||
if (!FeatureFlags.uuids() && FeatureFlags.groupsV2()) {
|
if (!FeatureFlags.uuidOnlyContacts() && FeatureFlags.groupsV2()) {
|
||||||
throw new RuntimeException(new UuidRecipientError());
|
throw new RuntimeException(new UuidRecipientError());
|
||||||
} else {
|
} else {
|
||||||
throw new UuidRecipientError();
|
throw new UuidRecipientError();
|
||||||
@ -209,7 +209,7 @@ public class Recipient {
|
|||||||
if (!recipient.isRegistered()) {
|
if (!recipient.isRegistered()) {
|
||||||
db.markRegistered(recipient.getId());
|
db.markRegistered(recipient.getId());
|
||||||
|
|
||||||
if (FeatureFlags.uuids()) {
|
if (FeatureFlags.cds()) {
|
||||||
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
Log.i(TAG, "No UUID! Scheduling a fetch.");
|
||||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(recipient, false));
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ public class Recipient {
|
|||||||
if (UuidUtil.isUuid(identifier)) {
|
if (UuidUtil.isUuid(identifier)) {
|
||||||
UUID uuid = UuidUtil.parseOrThrow(identifier);
|
UUID uuid = UuidUtil.parseOrThrow(identifier);
|
||||||
|
|
||||||
if (FeatureFlags.uuids()) {
|
if (FeatureFlags.uuidOnlyContacts()) {
|
||||||
id = db.getOrInsertFromUuid(uuid);
|
id = db.getOrInsertFromUuid(uuid);
|
||||||
} else {
|
} else {
|
||||||
Optional<RecipientId> possibleId = db.getByUuid(uuid);
|
Optional<RecipientId> possibleId = db.getByUuid(uuid);
|
||||||
@ -280,7 +280,7 @@ public class Recipient {
|
|||||||
if (possibleId.isPresent()) {
|
if (possibleId.isPresent()) {
|
||||||
id = possibleId.get();
|
id = possibleId.get();
|
||||||
} else {
|
} else {
|
||||||
if (!FeatureFlags.uuids() && FeatureFlags.groupsV2()) {
|
if (!FeatureFlags.uuidOnlyContacts() && FeatureFlags.groupsV2()) {
|
||||||
throw new RuntimeException(new UuidRecipientError());
|
throw new RuntimeException(new UuidRecipientError());
|
||||||
} else {
|
} else {
|
||||||
throw new UuidRecipientError();
|
throw new UuidRecipientError();
|
||||||
@ -754,7 +754,7 @@ public class Recipient {
|
|||||||
if (FeatureFlags.usernames()) {
|
if (FeatureFlags.usernames()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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!");
|
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...");
|
Log.i(TAG, recipient.getId() + " is missing a UUID...");
|
||||||
try {
|
try {
|
||||||
RegisteredState state = DirectoryHelper.refreshDirectoryFor(context, recipient, false);
|
RegisteredState state = DirectoryHelper.refreshDirectoryFor(context, recipient, false);
|
||||||
|
@ -441,7 +441,7 @@ public final class StorageSyncHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidContact(@NonNull SignalContactRecord contact) {
|
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 {
|
public static final class KeyDifferenceResult {
|
||||||
|
@ -187,15 +187,15 @@ public final class FeatureFlags {
|
|||||||
Log.i(TAG, "[Disk] After : " + result.getDisk().toString());
|
Log.i(TAG, "[Disk] After : " + result.getDisk().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** UUID-related stuff that shouldn't be activated until the user-facing launch. */
|
/** Whether or not we allow UUID-only contacts. */
|
||||||
public static synchronized boolean uuids() {
|
public static synchronized boolean uuidOnlyContacts() {
|
||||||
return getBoolean(UUIDS, false);
|
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() {
|
public static synchronized boolean usernames() {
|
||||||
boolean value = getBoolean(USERNAMES, false);
|
boolean value = getBoolean(USERNAMES, false);
|
||||||
if (value && !uuids()) throw new MissingFlagRequirementError();
|
if (value && !uuidOnlyContacts()) throw new MissingFlagRequirementError();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ public final class FeatureFlags {
|
|||||||
return groupsV2() && getBoolean(GROUPS_V2_INTERNAL_TEST, false);
|
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() {
|
public static boolean cds() {
|
||||||
return getBoolean(CDS, false);
|
return getBoolean(CDS, false);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public final class StorageSyncHelperTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resolveConflict_complex() {
|
public void resolveConflict_complex() {
|
||||||
when(FeatureFlags.uuids()).thenReturn(true);
|
when(FeatureFlags.uuidOnlyContacts()).thenReturn(true);
|
||||||
|
|
||||||
SignalContactRecord remote1 = contact(1, UUID_A, null, "a");
|
SignalContactRecord remote1 = contact(1, UUID_A, null, "a");
|
||||||
SignalContactRecord local1 = contact(2, UUID_A, E164_A, "a");
|
SignalContactRecord local1 = contact(2, UUID_A, E164_A, "a");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user