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