From c06928a7a54d67af683eef871b2e9202de6d7369 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 30 Apr 2020 20:27:02 -0400 Subject: [PATCH] Default library updates to daily + wifi --- app/src/main/java/eu/kanade/tachiyomi/Migrations.kt | 3 ++- .../eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt | 4 ++-- .../kanade/tachiyomi/ui/setting/SettingsLibraryController.kt | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 07116f30d..22f7a7f90 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 213c1b240..8b93cec08 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -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()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index d89022558..f33d9a239 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -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)