From fa80fa94a0c218809f20c5a631ce1b9ae3123c09 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Wed, 11 Aug 2021 21:59:08 -0400 Subject: [PATCH] switching automaticExtUpdates to flow --- .../eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt | 3 +-- .../java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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 e2d830e176..1673a22993 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 @@ -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()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt index ead9117990..2e5b3e9861 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt @@ -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() - val autoUpdateJob = forceAutoUpdateJob ?: preferences.automaticExtUpdates().getOrDefault() + val autoUpdateJob = forceAutoUpdateJob ?: preferences.automaticExtUpdates().get() if (autoUpdateJob) { val constraints = Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED)