AutoUpdaterJob -> AutoAppUpdaterJob

This was missed before
This commit is contained in:
Jays2Kings 2021-10-31 01:44:06 -04:00
parent 9f033cbac0
commit 579c79d7f4
6 changed files with 15 additions and 15 deletions

View file

@ -11,7 +11,7 @@ import com.tfcporciuncula.flow.Preference
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.updater.AutoUpdaterJob import eu.kanade.tachiyomi.data.updater.AutoAppUpdaterJob
import eu.kanade.tachiyomi.extension.model.InstalledExtensionsOrder import eu.kanade.tachiyomi.extension.model.InstalledExtensionsOrder
import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet
import eu.kanade.tachiyomi.ui.reader.settings.OrientationType import eu.kanade.tachiyomi.ui.reader.settings.OrientationType
@ -101,7 +101,7 @@ class PreferencesHelper(val context: Context) {
fun themeDarkAmoled() = flowPrefs.getBoolean(Keys.themeDarkAmoled, false) fun themeDarkAmoled() = flowPrefs.getBoolean(Keys.themeDarkAmoled, false)
val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S private val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
fun lightTheme() = flowPrefs.getEnum(Keys.lightTheme, if (isOnA12) Themes.MONET else Themes.DEFAULT) fun lightTheme() = flowPrefs.getEnum(Keys.lightTheme, if (isOnA12) Themes.MONET else Themes.DEFAULT)
fun darkTheme() = flowPrefs.getEnum(Keys.darkTheme, if (isOnA12) Themes.MONET else Themes.DEFAULT) fun darkTheme() = flowPrefs.getEnum(Keys.darkTheme, if (isOnA12) Themes.MONET else Themes.DEFAULT)
@ -418,9 +418,9 @@ class PreferencesHelper(val context: Context) {
fun sideNavMode() = flowPrefs.getInt(Keys.sideNavMode, 0) fun sideNavMode() = flowPrefs.getInt(Keys.sideNavMode, 0)
fun appShouldAutoUpdate() = prefs.getInt(Keys.shouldAutoUpdate, AutoUpdaterJob.ONLY_ON_UNMETERED) fun appShouldAutoUpdate() = prefs.getInt(Keys.shouldAutoUpdate, AutoAppUpdaterJob.ONLY_ON_UNMETERED)
fun autoUpdateExtensions() = prefs.getInt(Keys.autoUpdateExtensions, AutoUpdaterJob.ONLY_ON_UNMETERED) fun autoUpdateExtensions() = prefs.getInt(Keys.autoUpdateExtensions, AutoAppUpdaterJob.ONLY_ON_UNMETERED)
fun filterChapterByRead() = flowPrefs.getInt(Keys.defaultChapterFilterByRead, Manga.SHOW_ALL) fun filterChapterByRead() = flowPrefs.getInt(Keys.defaultChapterFilterByRead, Manga.SHOW_ALL)

View file

@ -26,9 +26,9 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
val result = AppUpdateChecker.getUpdateChecker().checkForUpdate() val result = AppUpdateChecker.getUpdateChecker().checkForUpdate()
if (result is AppUpdateResult.NewUpdate<*>) { if (result is AppUpdateResult.NewUpdate<*>) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
preferences.appShouldAutoUpdate() != AutoUpdaterJob.NEVER preferences.appShouldAutoUpdate() != AutoAppUpdaterJob.NEVER
) { ) {
AutoUpdaterJob.setupTask(context) AutoAppUpdaterJob.setupTask(context)
} }
AppUpdateNotifier(context).promptUpdate( AppUpdateNotifier(context).promptUpdate(
result.release.info, result.release.info,

View file

@ -14,7 +14,7 @@ import kotlinx.coroutines.coroutineScope
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
class AutoUpdaterJob(private val context: Context, workerParams: WorkerParameters) : class AutoAppUpdaterJob(private val context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) { CoroutineWorker(context, workerParams) {
override suspend fun doWork(): Result = coroutineScope { override suspend fun doWork(): Result = coroutineScope {
@ -57,7 +57,7 @@ class AutoUpdaterJob(private val context: Context, workerParams: WorkerParameter
.setRequiresDeviceIdle(true) .setRequiresDeviceIdle(true)
.build() .build()
val request = OneTimeWorkRequestBuilder<AutoUpdaterJob>() val request = OneTimeWorkRequestBuilder<AutoAppUpdaterJob>()
.addTag(TAG) .addTag(TAG)
.setConstraints(constraints) .setConstraints(constraints)
.build() .build()

View file

@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.data.library.LibraryUpdateService
import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.updater.AutoUpdaterJob import eu.kanade.tachiyomi.data.updater.AutoAppUpdaterJob
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.util.system.connectivityManager import eu.kanade.tachiyomi.util.system.connectivityManager
@ -61,7 +61,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
inputData.getBoolean(RUN_AUTO, true) && inputData.getBoolean(RUN_AUTO, true) &&
preferences.autoUpdateExtensions() != AutoUpdaterJob.NEVER && preferences.autoUpdateExtensions() != AutoAppUpdaterJob.NEVER &&
!ExtensionInstallService.isRunning() && !ExtensionInstallService.isRunning() &&
extensionsInstalledByApp.isNotEmpty() extensionsInstalledByApp.isNotEmpty()
) { ) {
@ -69,7 +69,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
val libraryServiceRunning = LibraryUpdateService.isRunning() val libraryServiceRunning = LibraryUpdateService.isRunning()
if ( if (
( (
preferences.autoUpdateExtensions() == AutoUpdaterJob.ALWAYS || preferences.autoUpdateExtensions() == AutoAppUpdaterJob.ALWAYS ||
!cm.isActiveNetworkMetered !cm.isActiveNetworkMetered
) && !libraryServiceRunning ) && !libraryServiceRunning
) { ) {

View file

@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferenceKeys import eu.kanade.tachiyomi.data.preference.PreferenceKeys
import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn
import eu.kanade.tachiyomi.data.updater.AutoUpdaterJob import eu.kanade.tachiyomi.data.updater.AutoAppUpdaterJob
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
@ -51,7 +51,7 @@ class SettingsBrowseController : SettingsController() {
R.string.over_wifi_only, R.string.over_wifi_only,
R.string.dont_auto_update R.string.dont_auto_update
) )
defaultValue = AutoUpdaterJob.ONLY_ON_UNMETERED defaultValue = AutoAppUpdaterJob.ONLY_ON_UNMETERED
} }
val infoPref = infoPreference(R.string.some_extensions_may_not_update) val infoPref = infoPreference(R.string.some_extensions_may_not_update)
val switchPref = switchPreference { val switchPref = switchPreference {

View file

@ -6,7 +6,7 @@ import android.view.View
import androidx.preference.PreferenceScreen 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.updater.AutoUpdaterJob import eu.kanade.tachiyomi.data.updater.AutoAppUpdaterJob
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsGeneralController : SettingsController() { class SettingsGeneralController : SettingsController() {
@ -97,7 +97,7 @@ class SettingsGeneralController : SettingsController() {
titleRes = R.string.auto_update_app titleRes = R.string.auto_update_app
entryRange = 0..2 entryRange = 0..2
entriesRes = arrayOf(R.string.over_any_network, R.string.over_wifi_only, R.string.dont_auto_update) entriesRes = arrayOf(R.string.over_any_network, R.string.over_wifi_only, R.string.dont_auto_update)
defaultValue = AutoUpdaterJob.ONLY_ON_UNMETERED defaultValue = AutoAppUpdaterJob.ONLY_ON_UNMETERED
} }
} }
} }