Default library updates to daily + wifi

This commit is contained in:
arkon 2020-04-30 20:27:02 -04:00
parent 8c0cafc793
commit c06928a7a5
3 changed files with 6 additions and 4 deletions

View File

@ -29,11 +29,12 @@ object Migrations {
// Fresh install
if (oldVersion == 0) {
// Set up default app updater task
// Set up default background tasks
if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask(context)
}
ExtensionUpdateJob.setupTask(context)
LibraryUpdateJob.setupTask(context)
return false
}

View File

@ -191,9 +191,9 @@ class PreferencesHelper(val context: Context) {
fun removeAfterMarkedAsRead() = prefs.getBoolean(Keys.removeAfterMarkedAsRead, false)
fun libraryUpdateInterval() = flowPrefs.getInt(Keys.libraryUpdateInterval, 0)
fun libraryUpdateInterval() = flowPrefs.getInt(Keys.libraryUpdateInterval, 24)
fun libraryUpdateRestriction() = prefs.getStringSet(Keys.libraryUpdateRestriction, emptySet())
fun libraryUpdateRestriction() = prefs.getStringSet(Keys.libraryUpdateRestriction, setOf("wifi"))
fun libraryUpdateCategories() = flowPrefs.getStringSet(Keys.libraryUpdateCategories, emptySet())

View File

@ -89,7 +89,7 @@ class SettingsLibraryController : SettingsController() {
R.string.update_12hour, R.string.update_24hour, R.string.update_48hour
)
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
defaultValue = "0"
defaultValue = "24"
summary = "%s"
onChange { newValue ->
@ -104,6 +104,7 @@ class SettingsLibraryController : SettingsController() {
entriesRes = arrayOf(R.string.wifi, R.string.charging)
entryValues = arrayOf("wifi", "ac")
summaryRes = R.string.pref_library_update_restriction_summary
defaultValue = setOf("wifi")
preferences.libraryUpdateInterval().asImmediateFlow { isVisible = it > 0 }
.launchIn(scope)