mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 11:51:10 +01:00
Phone number privacy settings and certificate support behind feature flag.
This commit is contained in:
committed by
Cody Henthorne
parent
abd3d4b546
commit
7b24e66ed3
@@ -49,20 +49,21 @@ public final class FeatureFlags {
|
||||
|
||||
private static final long FETCH_INTERVAL = TimeUnit.HOURS.toMillis(2);
|
||||
|
||||
private static final String USERNAMES = "android.usernames";
|
||||
private static final String ATTACHMENTS_V3 = "android.attachmentsV3.2";
|
||||
private static final String REMOTE_DELETE = "android.remoteDelete";
|
||||
private static final String GROUPS_V2_OLD_1 = "android.groupsv2";
|
||||
private static final String GROUPS_V2_OLD_2 = "android.groupsv2.2";
|
||||
private static final String GROUPS_V2 = "android.groupsv2.3";
|
||||
private static final String GROUPS_V2_CREATE = "android.groupsv2.create.3";
|
||||
private static final String GROUPS_V2_JOIN_VERSION = "android.groupsv2.joinVersion";
|
||||
private static final String GROUPS_V2_LINKS_VERSION = "android.groupsv2.manageGroupLinksVersion";
|
||||
private static final String GROUPS_V2_CAPACITY = "global.groupsv2.maxGroupSize";
|
||||
private static final String CDS_VERSION = "android.cdsVersion";
|
||||
private static final String INTERNAL_USER = "android.internalUser";
|
||||
private static final String MENTIONS = "android.mentions";
|
||||
private static final String VERIFY_V2 = "android.verifyV2";
|
||||
private static final String USERNAMES = "android.usernames";
|
||||
private static final String ATTACHMENTS_V3 = "android.attachmentsV3.2";
|
||||
private static final String REMOTE_DELETE = "android.remoteDelete";
|
||||
private static final String GROUPS_V2_OLD_1 = "android.groupsv2";
|
||||
private static final String GROUPS_V2_OLD_2 = "android.groupsv2.2";
|
||||
private static final String GROUPS_V2 = "android.groupsv2.3";
|
||||
private static final String GROUPS_V2_CREATE = "android.groupsv2.create.3";
|
||||
private static final String GROUPS_V2_JOIN_VERSION = "android.groupsv2.joinVersion";
|
||||
private static final String GROUPS_V2_LINKS_VERSION = "android.groupsv2.manageGroupLinksVersion";
|
||||
private static final String GROUPS_V2_CAPACITY = "global.groupsv2.maxGroupSize";
|
||||
private static final String CDS_VERSION = "android.cdsVersion";
|
||||
private static final String INTERNAL_USER = "android.internalUser";
|
||||
private static final String MENTIONS = "android.mentions";
|
||||
private static final String VERIFY_V2 = "android.verifyV2";
|
||||
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -279,6 +280,14 @@ public final class FeatureFlags {
|
||||
return getBoolean(VERIFY_V2, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the user can choose phone number privacy settings, and;
|
||||
* Whether to fetch and store the secondary certificate
|
||||
*/
|
||||
public static boolean phoneNumberPrivacy() {
|
||||
return getVersionFlag(PHONE_NUMBER_PRIVACY_VERSION) == VersionFlag.ON;
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
||||
@@ -182,7 +182,6 @@ public class TextSecurePreferences {
|
||||
private static final String NEEDS_MESSAGE_PULL = "pref_needs_message_pull";
|
||||
|
||||
private static final String UNIDENTIFIED_ACCESS_CERTIFICATE_ROTATION_TIME_PREF = "pref_unidentified_access_certificate_rotation_time";
|
||||
private static final String UNIDENTIFIED_ACCESS_CERTIFICATE = "pref_unidentified_access_certificate_uuid";
|
||||
public static final String UNIVERSAL_UNIDENTIFIED_ACCESS = "pref_universal_unidentified_access";
|
||||
public static final String SHOW_UNIDENTIFIED_DELIVERY_INDICATORS = "pref_show_unidentifed_delivery_indicators";
|
||||
private static final String UNIDENTIFIED_DELIVERY_ENABLED = "pref_unidentified_delivery_enabled";
|
||||
@@ -598,26 +597,6 @@ public class TextSecurePreferences {
|
||||
setLongPreference(context, UNIDENTIFIED_ACCESS_CERTIFICATE_ROTATION_TIME_PREF, value);
|
||||
}
|
||||
|
||||
public static void setUnidentifiedAccessCertificate(Context context, byte[] value) {
|
||||
setStringPreference(context, UNIDENTIFIED_ACCESS_CERTIFICATE, Base64.encodeBytes(value));
|
||||
}
|
||||
|
||||
public static byte[] getUnidentifiedAccessCertificate(Context context) {
|
||||
return parseCertificate(getStringPreference(context, UNIDENTIFIED_ACCESS_CERTIFICATE, null));
|
||||
}
|
||||
|
||||
private static byte[] parseCertificate(String raw) {
|
||||
try {
|
||||
if (raw != null) {
|
||||
return Base64.decode(raw);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isUniversalUnidentifiedAccess(Context context) {
|
||||
return getBooleanPreference(context, UNIVERSAL_UNIDENTIFIED_ACCESS, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user