switching automaticExtUpdates to flow

This commit is contained in:
Jays2Kings 2021-08-11 21:59:08 -04:00
parent 0d9f32b96f
commit fa80fa94a0
2 changed files with 2 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import android.net.Uri
import android.os.Build
import android.os.Environment
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.f2prateek.rx.preferences.Preference
import com.f2prateek.rx.preferences.RxSharedPreferences
@ -296,7 +295,7 @@ class PreferencesHelper(val context: Context) {
fun librarySortingAscending() = rxPrefs.getBoolean("library_sorting_ascending", true)
fun automaticExtUpdates() = rxPrefs.getBoolean(Keys.automaticExtUpdates, true)
fun automaticExtUpdates() = flowPrefs.getBoolean(Keys.automaticExtUpdates, true)
fun collapsedCategories() = rxPrefs.getStringSet("collapsed_categories", mutableSetOf())

View File

@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.updater.AutoUpdaterJob
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.extension.model.Extension
@ -152,7 +151,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
fun setupTask(context: Context, forceAutoUpdateJob: Boolean? = null) {
val preferences = Injekt.get<PreferencesHelper>()
val autoUpdateJob = forceAutoUpdateJob ?: preferences.automaticExtUpdates().getOrDefault()
val autoUpdateJob = forceAutoUpdateJob ?: preferences.automaticExtUpdates().get()
if (autoUpdateJob) {
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)