Only show automatically refresh trackers setting if logged in to some trackers

This commit is contained in:
arkon 2021-06-01 17:49:04 -04:00
parent 9299a4beff
commit 36e14b951a
2 changed files with 11 additions and 6 deletions

View File

@ -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

View File

@ -210,7 +210,7 @@
<string name="pref_update_only_non_completed">Only update ongoing manga</string>
<string name="pref_library_update_refresh_metadata">Automatically refresh metadata</string>
<string name="pref_library_update_refresh_metadata_summary">Check for new cover and details when updating library</string>
<string name="pref_library_update_refresh_trackers">Automatically update trackers</string>
<string name="pref_library_update_refresh_trackers">Automatically refresh trackers</string>
<string name="pref_library_update_refresh_trackers_summary">Update trackers when updating library</string>
<string name="pref_library_update_error_notification">Show update errors notifications</string>