Only show automatically refresh trackers setting if logged in to some trackers
This commit is contained in:
parent
9299a4beff
commit
36e14b951a
2 changed files with 11 additions and 6 deletions
|
@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.preference.CHARGING
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.UNMETERED_NETWORK
|
import eu.kanade.tachiyomi.data.preference.UNMETERED_NETWORK
|
||||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
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.DialogController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||||
|
@ -39,11 +40,13 @@ import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
|
|
||||||
class SettingsLibraryController : SettingsController() {
|
class SettingsLibraryController : SettingsController() {
|
||||||
|
|
||||||
private val db: DatabaseHelper = Injekt.get()
|
private val db: DatabaseHelper = Injekt.get()
|
||||||
|
private val trackManager: TrackManager by injectLazy()
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||||
titleRes = R.string.pref_category_library
|
titleRes = R.string.pref_category_library
|
||||||
|
@ -265,11 +268,13 @@ class SettingsLibraryController : SettingsController() {
|
||||||
summaryRes = R.string.pref_library_update_refresh_metadata_summary
|
summaryRes = R.string.pref_library_update_refresh_metadata_summary
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
switchPreference {
|
if (trackManager.hasLoggedServices()) {
|
||||||
key = Keys.autoUpdateTrackers
|
switchPreference {
|
||||||
titleRes = R.string.pref_library_update_refresh_trackers
|
key = Keys.autoUpdateTrackers
|
||||||
summaryRes = R.string.pref_library_update_refresh_trackers_summary
|
titleRes = R.string.pref_library_update_refresh_trackers
|
||||||
defaultValue = false
|
summaryRes = R.string.pref_library_update_refresh_trackers_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.showLibraryUpdateErrors
|
key = Keys.showLibraryUpdateErrors
|
||||||
|
|
|
@ -210,7 +210,7 @@
|
||||||
<string name="pref_update_only_non_completed">Only update ongoing manga</string>
|
<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">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_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_refresh_trackers_summary">Update trackers when updating library</string>
|
||||||
<string name="pref_library_update_error_notification">Show update errors notifications</string>
|
<string name="pref_library_update_error_notification">Show update errors notifications</string>
|
||||||
|
|
||||||
|
|
Reference in a new issue