mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Improve network reliability.
This commit is contained in:
@@ -19,7 +19,7 @@ public final class InternalValues extends SignalStoreValues {
|
||||
public static final String GV2_DISABLE_AUTOMIGRATE_INITIATION = "internal.gv2.disable_automigrate_initiation";
|
||||
public static final String GV2_DISABLE_AUTOMIGRATE_NOTIFICATION = "internal.gv2.disable_automigrate_notification";
|
||||
public static final String RECIPIENT_DETAILS = "internal.recipient_details";
|
||||
public static final String FORCE_CENSORSHIP = "internal.force_censorship";
|
||||
public static final String ALLOW_CENSORSHIP_SETTING = "internal.force_censorship";
|
||||
public static final String FORCE_BUILT_IN_EMOJI = "internal.force_built_in_emoji";
|
||||
public static final String REMOVE_SENDER_KEY_MINIMUM = "internal.remove_sender_key_minimum";
|
||||
public static final String DELAY_RESENDS = "internal.delay_resends";
|
||||
@@ -84,10 +84,10 @@ public final class InternalValues extends SignalStoreValues {
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the app to behave as if it is in a country where Signal is censored.
|
||||
* Allow changing the censorship circumvention setting regardless of network status.
|
||||
*/
|
||||
public synchronized boolean forcedCensorship() {
|
||||
return FeatureFlags.internalUser() && getBoolean(FORCE_CENSORSHIP, false);
|
||||
public synchronized boolean allowChangingCensorshipSetting() {
|
||||
return FeatureFlags.internalUser() && getBoolean(ALLOW_CENSORSHIP_SETTING, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,7 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
private static final String DEFAULT_SMS = "settings.default_sms";
|
||||
private static final String UNIVERSAL_EXPIRE_TIMER = "settings.universal.expire.timer";
|
||||
private static final String SENT_MEDIA_QUALITY = "settings.sentMediaQuality";
|
||||
private static final String CENSORSHIP_CIRCUMVENTION_ENABLED = "settings.censorshipCircumventionEnabled";
|
||||
|
||||
private final SingleLiveEvent<String> onConfigurationSettingChanged = new SingleLiveEvent<>();
|
||||
|
||||
@@ -390,6 +391,14 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
return SentMediaQuality.fromCode(getInteger(SENT_MEDIA_QUALITY, SentMediaQuality.STANDARD.getCode()));
|
||||
}
|
||||
|
||||
public @NonNull CensorshipCircumventionEnabled getCensorshipCircumventionEnabled() {
|
||||
return CensorshipCircumventionEnabled.deserialize(getInteger(CENSORSHIP_CIRCUMVENTION_ENABLED, CensorshipCircumventionEnabled.DEFAULT.serialize()));
|
||||
}
|
||||
|
||||
public void setCensorshipCircumventionEnabled(boolean enabled) {
|
||||
putInteger(CENSORSHIP_CIRCUMVENTION_ENABLED, enabled ? CensorshipCircumventionEnabled.ENABLED.serialize() : CensorshipCircumventionEnabled.DISABLED.serialize());
|
||||
}
|
||||
|
||||
private @Nullable Uri getUri(@NonNull String key) {
|
||||
String uri = getString(key, "");
|
||||
|
||||
@@ -399,4 +408,27 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
return Uri.parse(uri);
|
||||
}
|
||||
}
|
||||
|
||||
public enum CensorshipCircumventionEnabled {
|
||||
DEFAULT(0), ENABLED(1), DISABLED(2);
|
||||
|
||||
private final int value;
|
||||
|
||||
CensorshipCircumventionEnabled(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static CensorshipCircumventionEnabled deserialize(int value) {
|
||||
switch (value) {
|
||||
case 0: return DEFAULT;
|
||||
case 1: return ENABLED;
|
||||
case 2: return DISABLED;
|
||||
default: throw new IllegalArgumentException("Bad value: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
public int serialize() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user