Skip to content

Commit

Permalink
Add a flag for recipientTrust.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Jul 21, 2020
1 parent 0e4a19c commit 2a13358
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ public RecipientDatabase(Context context, SQLCipherOpenHelper databaseHelper) {
throw new IllegalArgumentException("Must provide a UUID or E164!");
}

if (!FeatureFlags.recipientTrust()) {
highTrust = true;
}

RecipientId recipientNeedingRefresh = null;
Pair<RecipientId, RecipientId> remapped = null;
boolean transactionSuccessful = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class FeatureFlags {
private static final String GROUPS_V2_CREATE = "android.groupsv2.create.2";
private static final String GROUPS_V2_CAPACITY = "android.groupsv2.capacity";
private static final String CDS = "android.cds";
private static final String RECIPIENT_TRUST = "android.recipientTrust";
private static final String INTERNAL_USER = "android.internalUser";

/**
Expand All @@ -69,6 +70,7 @@ public final class FeatureFlags {
GROUPS_V2,
GROUPS_V2_CREATE,
GROUPS_V2_CAPACITY,
RECIPIENT_TRUST,
INTERNAL_USER
);

Expand All @@ -91,15 +93,17 @@ public final class FeatureFlags {
*/
private static final Set<String> HOT_SWAPPABLE = Sets.newHashSet(
ATTACHMENTS_V3,
GROUPS_V2_CREATE
GROUPS_V2_CREATE,
RECIPIENT_TRUST
);

/**
* Flags in this set will stay true forever once they receive a true value from a remote config.
*/
private static final Set<String> STICKY = Sets.newHashSet(
GROUPS_V2,
GROUPS_V2_OLD
GROUPS_V2_OLD,
RECIPIENT_TRUST
);

/**
Expand Down Expand Up @@ -212,6 +216,11 @@ public static boolean cds() {
return getBoolean(CDS, false);
}

/** Whether or not we allow different trust levels for recipient address sources. */
public static boolean recipientTrust() {
return getBoolean(RECIPIENT_TRUST, false);
}

/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);
Expand Down

0 comments on commit 2a13358

Please sign in to comment.