add option to disable update caching

This commit is contained in:
Chloe committed 2026-02-15 04:16:51 -07:00
1 parent 9b7d174704
commit eab0de3a34
4 files changed
+13

No files matched your search

@@ -210,6 +210,11 @@ fun DeveloperSettingsScreen(onBackPressedDispatcher: OnBackPressedDispatcher?) {
.setLong(PreferenceUtils.Key.LAST_UPDATE_CHECK_TIME, 0L)
}
)
SettingsCard(
title = stringResource(R.string.preference_disable_update_cache),
preferenceKey = PreferenceUtils.Key.DISABLE_UPDATE_CACHE
)
}
OptionsGroup(title = stringResource(R.string.preference_category_testing)) {
@@ -285,6 +285,10 @@ class ReleaseManager private constructor(
fun shouldUseCache(): Boolean {
val sharedPreferences = PreferenceUtils.get(applicationContext)
if (sharedPreferences.getBoolean(PreferenceUtils.Key.DISABLE_UPDATE_CACHE)) {
return false
}
val lastCheckTime = sharedPreferences.getLong(PreferenceUtils.Key.LAST_UPDATE_CHECK_TIME)
// only check for updates if it's been over 15 minutes since last check
@@ -153,6 +153,7 @@ class PreferenceUtils(private val sharedPreferences: SharedPreferences) {
WAIT_PERIOD,
LAST_UPDATE_CHECK_TIME,
LAST_LAUNCHER_UPDATE,
DISABLE_UPDATE_CACHE,
}
private fun defaultValueForBooleanKey(key: Key): Boolean {
@@ -207,6 +208,7 @@ class PreferenceUtils(private val sharedPreferences: SharedPreferences) {
Key.WAIT_PERIOD -> "PreferenceWaitPeriod"
Key.LAST_UPDATE_CHECK_TIME -> "PreferenceLastUpdateCheckTime"
Key.LAST_LAUNCHER_UPDATE -> "PreferenceLastLauncherUpdate"
Key.DISABLE_UPDATE_CACHE -> "PreferenceDisableUpdateCache"
}
}
+2
View File
@@ -271,6 +271,8 @@
<string name="preference_launch_arguments_set_title">Set launch arguments</string>
<string name="preference_text_clear">Clear</string>
<string name="preference_disable_update_cache">Disable update cache</string>
<string name="preference_open_developer_options">Open developer options</string>
<string name="preference_developer_options_dialog_title">Enable developer options?</string>