mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-30 13:36:29 +00:00
Improve network reliability during resumable uploads.
This commit is contained in:
@@ -216,16 +216,6 @@ public class ApplicationDependencies {
|
||||
return frameRateTracker;
|
||||
}
|
||||
|
||||
public static synchronized @NonNull KeyValueStore getKeyValueStore() {
|
||||
assertInitialization();
|
||||
|
||||
if (keyValueStore == null) {
|
||||
keyValueStore = provider.provideKeyValueStore();
|
||||
}
|
||||
|
||||
return keyValueStore;
|
||||
}
|
||||
|
||||
public static synchronized @NonNull MegaphoneRepository getMegaphoneRepository() {
|
||||
assertInitialization();
|
||||
|
||||
@@ -283,7 +273,6 @@ public class ApplicationDependencies {
|
||||
@NonNull LiveRecipientCache provideRecipientCache();
|
||||
@NonNull JobManager provideJobManager();
|
||||
@NonNull FrameRateTracker provideFrameRateTracker();
|
||||
@NonNull KeyValueStore provideKeyValueStore();
|
||||
@NonNull MegaphoneRepository provideMegaphoneRepository();
|
||||
@NonNull EarlyMessageCache provideEarlyMessageCache();
|
||||
@NonNull MessageNotifier provideMessageNotifier();
|
||||
|
||||
@@ -153,12 +153,6 @@ public class ApplicationDependencyProvider implements ApplicationDependencies.Pr
|
||||
return new FrameRateTracker(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull KeyValueStore provideKeyValueStore() {
|
||||
return new KeyValueStore(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MegaphoneRepository provideMegaphoneRepository() {
|
||||
return new MegaphoneRepository(context);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public final class InternalValues extends SignalStoreValues {
|
||||
public static final String GV2_IGNORE_SERVER_CHANGES = "internal.gv2.ignore_server_changes";
|
||||
public static final String GV2_IGNORE_P2P_CHANGES = "internal.gv2.ignore_p2p_changes";
|
||||
public static final String RECIPIENT_DETAILS = "internal.recipient_details";
|
||||
public static final String FORCE_CENSORSHIP = "internal.force_censorship";
|
||||
|
||||
InternalValues(KeyValueStore store) {
|
||||
super(store);
|
||||
@@ -59,4 +60,11 @@ public final class InternalValues extends SignalStoreValues {
|
||||
public synchronized boolean recipientDetails() {
|
||||
return FeatureFlags.internalUser() && getBoolean(RECIPIENT_DETAILS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the app to behave as if it is in a country where Signal is censored.
|
||||
*/
|
||||
public synchronized boolean forcedCensorship() {
|
||||
return FeatureFlags.internalUser() && getBoolean(FORCE_CENSORSHIP, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class SignalStore {
|
||||
private final PhoneNumberPrivacyValues phoneNumberPrivacyValues;
|
||||
|
||||
private SignalStore() {
|
||||
this.store = ApplicationDependencies.getKeyValueStore();
|
||||
this.store = new KeyValueStore(ApplicationDependencies.getApplication());
|
||||
this.kbsValues = new KbsValues(store);
|
||||
this.registrationValues = new RegistrationValues(store);
|
||||
this.pinValues = new PinValues(store);
|
||||
|
||||
@@ -39,6 +39,7 @@ public class InternalOptionsPreferenceFragment extends CorrectedPreferenceFragme
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_FORCE_INVITES, SignalStore.internalValues().gv2ForceInvites());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_IGNORE_SERVER_CHANGES, SignalStore.internalValues().gv2IgnoreServerChanges());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_IGNORE_P2P_CHANGES, SignalStore.internalValues().gv2IgnoreP2PChanges());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.FORCE_CENSORSHIP, SignalStore.internalValues().forcedCensorship());
|
||||
|
||||
findPreference("pref_refresh_attributes").setOnPreferenceClickListener(preference -> {
|
||||
ApplicationDependencies.getJobManager()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.net.CustomDns;
|
||||
import org.thoughtcrime.securesms.net.RemoteDeprecationDetectorInterceptor;
|
||||
import org.thoughtcrime.securesms.net.DeprecatedClientPreventionInterceptor;
|
||||
@@ -239,6 +240,10 @@ public class SignalServiceNetworkAccess {
|
||||
public SignalServiceConfiguration getConfiguration(@Nullable String localNumber) {
|
||||
if (localNumber == null) return this.uncensoredConfiguration;
|
||||
|
||||
if (SignalStore.internalValues().forcedCensorship()) {
|
||||
return this.censorshipConfiguration.get(COUNTRY_CODE_QATAR);
|
||||
}
|
||||
|
||||
for (String censoredRegion : this.censoredCountries) {
|
||||
if (localNumber.startsWith(censoredRegion)) {
|
||||
return this.censorshipConfiguration.get(censoredRegion);
|
||||
|
||||
Reference in New Issue
Block a user