mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Tweak WorkManager task cancellation, add flex times
This commit is contained in:
@@ -105,13 +105,8 @@ class SettingsBackupController : SettingsController() {
|
||||
summary = "%s"
|
||||
|
||||
onChange { newValue ->
|
||||
// Always cancel the previous task, it seems that sometimes they are not updated
|
||||
BackupCreatorJob.cancelTask()
|
||||
|
||||
val interval = (newValue as String).toInt()
|
||||
if (interval > 0) {
|
||||
BackupCreatorJob.setupTask(interval)
|
||||
}
|
||||
BackupCreatorJob.setupTask(interval)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,13 +86,8 @@ class SettingsLibraryController : SettingsController() {
|
||||
summary = "%s"
|
||||
|
||||
onChange { newValue ->
|
||||
// Always cancel the previous task, it seems that sometimes they are not updated.
|
||||
LibraryUpdateJob.cancelTask()
|
||||
|
||||
val interval = (newValue as String).toInt()
|
||||
if (interval > 0) {
|
||||
LibraryUpdateJob.setupTask(interval)
|
||||
}
|
||||
LibraryUpdateJob.setupTask(interval)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user