kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add internal preference to disable storage syncing.
Added to help debug certain scenarios, particularly around working with emulator snapshots, since storage sync will often bring in state from earlier snapshots you weren't expecting.fork-5.53.8
rodzic
5d5063ef5f
commit
6c3e1b6a29
|
@ -107,6 +107,15 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
|||
|
||||
sectionHeaderPref(R.string.preferences__internal_storage_service)
|
||||
|
||||
switchPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__internal_disable_storage_service),
|
||||
summary = DSLSettingsText.from(R.string.preferences__internal_disable_storage_service_description),
|
||||
isChecked = state.disableStorageService,
|
||||
onClick = {
|
||||
viewModel.setDisableStorageService(!state.disableStorageService)
|
||||
}
|
||||
)
|
||||
|
||||
clickPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__internal_force_storage_service_sync),
|
||||
summary = DSLSettingsText.from(R.string.preferences__internal_force_storage_service_sync_description),
|
||||
|
|
|
@ -17,4 +17,5 @@ data class InternalSettingsState(
|
|||
val emojiVersion: EmojiFiles.Version?,
|
||||
val removeSenderKeyMinimium: Boolean,
|
||||
val delayResends: Boolean,
|
||||
val disableStorageService: Boolean,
|
||||
)
|
||||
|
|
|
@ -30,6 +30,11 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
|||
refresh()
|
||||
}
|
||||
|
||||
fun setDisableStorageService(enabled: Boolean) {
|
||||
preferenceDataStore.putBoolean(InternalValues.DISABLE_STORAGE_SERVICE, enabled)
|
||||
refresh()
|
||||
}
|
||||
|
||||
fun setGv2DoNotCreateGv2Groups(enabled: Boolean) {
|
||||
preferenceDataStore.putBoolean(InternalValues.GV2_DO_NOT_CREATE_GV2, enabled)
|
||||
refresh()
|
||||
|
@ -103,7 +108,8 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
|||
useBuiltInEmojiSet = SignalStore.internalValues().forceBuiltInEmoji(),
|
||||
emojiVersion = null,
|
||||
removeSenderKeyMinimium = SignalStore.internalValues().removeSenderKeyMinimum(),
|
||||
delayResends = SignalStore.internalValues().delayResends()
|
||||
delayResends = SignalStore.internalValues().delayResends(),
|
||||
disableStorageService = SignalStore.internalValues().storageServiceDisabled()
|
||||
)
|
||||
|
||||
class Factory(private val repository: InternalSettingsRepository) : ViewModelProvider.Factory {
|
||||
|
|
|
@ -171,6 +171,11 @@ public class StorageSyncJob extends BaseJob {
|
|||
return;
|
||||
}
|
||||
|
||||
if (SignalStore.internalValues().storageServiceDisabled()) {
|
||||
Log.w(TAG, "Storage service has been manually disabled. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
boolean needsMultiDeviceSync = performSync();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ public final class InternalValues extends SignalStoreValues {
|
|||
public static final String DELAY_RESENDS = "internal.delay_resends";
|
||||
public static final String CALLING_SERVER = "internal.calling_server";
|
||||
public static final String SHAKE_TO_REPORT = "internal.shake_to_report";
|
||||
public static final String DISABLE_STORAGE_SERVICE = "internal.disable_storage_service";
|
||||
|
||||
InternalValues(KeyValueStore store) {
|
||||
super(store);
|
||||
|
@ -131,6 +132,13 @@ public final class InternalValues extends SignalStoreValues {
|
|||
return FeatureFlags.internalUser() && getBoolean(SHAKE_TO_REPORT, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not storage service is manually disabled.
|
||||
*/
|
||||
public synchronized boolean storageServiceDisabled() {
|
||||
return FeatureFlags.internalUser() && getBoolean(DISABLE_STORAGE_SERVICE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The selected group calling server to use.
|
||||
* <p>
|
||||
|
|
|
@ -2505,6 +2505,8 @@
|
|||
<string name="preferences__internal_shake_to_report" translatable="false">Shake to Report</string>
|
||||
<string name="preferences__internal_shake_to_report_description" translatable="false">Shake your phone to easily submit and share a debug log.</string>
|
||||
<string name="preferences__internal_storage_service" translatable="false">Storage service</string>
|
||||
<string name="preferences__internal_disable_storage_service" translatable="false">Disable syncing</string>
|
||||
<string name="preferences__internal_disable_storage_service_description" translatable="false">Prevent syncing any data to/from storage service.</string>
|
||||
<string name="preferences__internal_force_storage_service_sync" translatable="false">Overwrite remote data</string>
|
||||
<string name="preferences__internal_force_storage_service_sync_description" translatable="false">Forces remote storage to match the local device state.</string>
|
||||
<string name="preferences__internal_network" translatable="false">Network</string>
|
||||
|
|
Ładowanie…
Reference in New Issue