mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:01:51 +01:00
Fix library update interval not being updated properly
This commit is contained in:
parent
8e3ffe87b8
commit
08e26aa30d
@ -19,9 +19,9 @@ class LibraryUpdateTrigger : GcmTaskService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun setupTask(context: Context) {
|
fun setupTask(context: Context, prefInterval: Int? = null) {
|
||||||
val preferences = Injekt.get<PreferencesHelper>()
|
val preferences = Injekt.get<PreferencesHelper>()
|
||||||
val interval = preferences.libraryUpdateInterval().getOrDefault()
|
val interval = prefInterval ?: preferences.libraryUpdateInterval().getOrDefault()
|
||||||
if (interval > 0) {
|
if (interval > 0) {
|
||||||
val restrictions = preferences.libraryUpdateRestriction()
|
val restrictions = preferences.libraryUpdateRestriction()
|
||||||
val acRestriction = "ac" in restrictions
|
val acRestriction = "ac" in restrictions
|
||||||
|
@ -67,9 +67,9 @@ class SettingsGeneralFragment : SettingsFragment(),
|
|||||||
.subscribe { updateColumnsSummary(it.first, it.second) }
|
.subscribe { updateColumnsSummary(it.first, it.second) }
|
||||||
|
|
||||||
updateInterval.setOnPreferenceChangeListener { preference, newValue ->
|
updateInterval.setOnPreferenceChangeListener { preference, newValue ->
|
||||||
val enabled = (newValue as String).toInt() > 0
|
val interval = (newValue as String).toInt()
|
||||||
if (enabled)
|
if (interval > 0)
|
||||||
LibraryUpdateTrigger.setupTask(context)
|
LibraryUpdateTrigger.setupTask(context, interval)
|
||||||
else
|
else
|
||||||
LibraryUpdateTrigger.cancelTask(context)
|
LibraryUpdateTrigger.cancelTask(context)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user