From 36e14b951a2e36c42fa49fcadd503a4f01952c49 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 1 Jun 2021 17:49:04 -0400 Subject: [PATCH] Only show automatically refresh trackers setting if logged in to some trackers --- .../ui/setting/SettingsLibraryController.kt | 15 ++++++++++----- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) 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 0619788759..17c433e33c 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 @@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.preference.CHARGING import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.UNMETERED_NETWORK import eu.kanade.tachiyomi.data.preference.asImmediateFlow +import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.category.CategoryController @@ -39,11 +40,13 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get +import uy.kohesive.injekt.injectLazy import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsLibraryController : SettingsController() { private val db: DatabaseHelper = Injekt.get() + private val trackManager: TrackManager by injectLazy() override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { titleRes = R.string.pref_category_library @@ -265,11 +268,13 @@ class SettingsLibraryController : SettingsController() { summaryRes = R.string.pref_library_update_refresh_metadata_summary defaultValue = false } - switchPreference { - key = Keys.autoUpdateTrackers - titleRes = R.string.pref_library_update_refresh_trackers - summaryRes = R.string.pref_library_update_refresh_trackers_summary - defaultValue = false + if (trackManager.hasLoggedServices()) { + switchPreference { + key = Keys.autoUpdateTrackers + titleRes = R.string.pref_library_update_refresh_trackers + summaryRes = R.string.pref_library_update_refresh_trackers_summary + defaultValue = false + } } switchPreference { key = Keys.showLibraryUpdateErrors diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cdd15cf658..95a98b0a8b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -210,7 +210,7 @@ Only update ongoing manga Automatically refresh metadata Check for new cover and details when updating library - Automatically update trackers + Automatically refresh trackers Update trackers when updating library Show update errors notifications