Remove option to disabled auto checks for updates

This commit is contained in:
Jays2Kings 2021-05-08 16:12:49 -04:00
parent d9fcf8f3f7
commit 2f192f4c4d
5 changed files with 9 additions and 30 deletions

View File

@ -33,7 +33,7 @@ object Migrations {
preferences.lastVersionCode().set(BuildConfig.VERSION_CODE) preferences.lastVersionCode().set(BuildConfig.VERSION_CODE)
if (oldVersion == 0) { if (oldVersion == 0) {
if (BuildConfig.INCLUDE_UPDATER && preferences.automaticUpdates()) { if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask() UpdaterJob.setupTask()
} }
ExtensionUpdateJob.setupTask() ExtensionUpdateJob.setupTask()
@ -43,7 +43,7 @@ object Migrations {
if (oldVersion < 14) { if (oldVersion < 14) {
// Restore jobs after upgrading to evernote's job scheduler. // Restore jobs after upgrading to evernote's job scheduler.
if (BuildConfig.INCLUDE_UPDATER && preferences.automaticUpdates()) { if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask() UpdaterJob.setupTask()
} }
LibraryUpdateJob.setupTask() LibraryUpdateJob.setupTask()
@ -80,7 +80,7 @@ object Migrations {
if (oldVersion < 62) { if (oldVersion < 62) {
LibraryPresenter.updateDB() LibraryPresenter.updateDB()
// Restore jobs after migrating from Evernote's job scheduler to WorkManager. // Restore jobs after migrating from Evernote's job scheduler to WorkManager.
if (BuildConfig.INCLUDE_UPDATER && preferences.automaticUpdates()) { if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask() UpdaterJob.setupTask()
} }
LibraryUpdateJob.setupTask() LibraryUpdateJob.setupTask()
@ -115,6 +115,12 @@ object Migrations {
// Reset rotation to Free after replacing Lock // Reset rotation to Free after replacing Lock
preferences.rotation().set(1) preferences.rotation().set(1)
} }
if (oldVersion < 74) {
// Turn on auto updates for all users
if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask()
}
}
return true return true
} }
return false return false

View File

@ -140,8 +140,6 @@ object PreferenceKeys {
const val librarySortingMode = "library_sorting_mode" const val librarySortingMode = "library_sorting_mode"
const val automaticUpdates = "automatic_updates"
const val automaticExtUpdates = "automatic_ext_updates" const val automaticExtUpdates = "automatic_ext_updates"
const val autoHideHopper = "autohide_hopper" const val autoHideHopper = "autohide_hopper"

View File

@ -280,8 +280,6 @@ class PreferencesHelper(val context: Context) {
fun librarySortingAscending() = rxPrefs.getBoolean("library_sorting_ascending", true) fun librarySortingAscending() = rxPrefs.getBoolean("library_sorting_ascending", true)
fun automaticUpdates() = prefs.getBoolean(Keys.automaticUpdates, true)
fun automaticExtUpdates() = rxPrefs.getBoolean(Keys.automaticExtUpdates, true) fun automaticExtUpdates() = rxPrefs.getBoolean(Keys.automaticExtUpdates, true)
fun collapsedCategories() = rxPrefs.getStringSet("collapsed_categories", mutableSetOf()) fun collapsedCategories() = rxPrefs.getStringSet("collapsed_categories", mutableSetOf())

View File

@ -7,7 +7,6 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.asImmediateFlow import eu.kanade.tachiyomi.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.data.updater.UpdaterJob
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.system.appDelegateNightMode import eu.kanade.tachiyomi.util.system.appDelegateNightMode
import eu.kanade.tachiyomi.util.system.getPrefTheme import eu.kanade.tachiyomi.util.system.getPrefTheme
@ -84,27 +83,6 @@ class SettingsGeneralController : SettingsController() {
defaultValue = true defaultValue = true
} }
switchPreference {
key = Keys.automaticUpdates
titleRes = R.string.check_for_updates
summaryRes = R.string.auto_check_for_app_versions
defaultValue = true
if (isUpdaterEnabled) {
onChange { newValue ->
val checked = newValue as Boolean
if (checked) {
UpdaterJob.setupTask()
} else {
UpdaterJob.cancelTask()
}
true
}
} else {
isVisible = false
}
}
preferenceCategory { preferenceCategory {
titleRes = R.string.display titleRes = R.string.display

View File

@ -608,7 +608,6 @@
<string name="date_format">Date format</string> <string name="date_format">Date format</string>
<string name="check_for_updates">Check for updates</string> <string name="check_for_updates">Check for updates</string>
<string name="updated_to_">Updated to v%1$s</string> <string name="updated_to_">Updated to v%1$s</string>
<string name="auto_check_for_app_versions">Automatically check for new app versions</string>
<string name="secure_screen">Secure screen</string> <string name="secure_screen">Secure screen</string>
<string name="hide_bottom_nav">Auto-hide bottom navigation</string> <string name="hide_bottom_nav">Auto-hide bottom navigation</string>
<string name="app_shortcuts">App shortcuts</string> <string name="app_shortcuts">App shortcuts</string>