Always re-setup background jobs on migration runs
(cherry picked from commit 7d67450e5800c90a6bb3f2d401b048e1acc5b0d0)
This commit is contained in:
parent
cde6f127b1
commit
c69bb5b33d
@ -34,23 +34,20 @@ object Migrations {
|
|||||||
fun upgrade(preferences: PreferencesHelper): Boolean {
|
fun upgrade(preferences: PreferencesHelper): Boolean {
|
||||||
val context = preferences.context
|
val context = preferences.context
|
||||||
|
|
||||||
// Cancel app updater job for debug builds that don't include it
|
|
||||||
if (BuildConfig.DEBUG && !BuildConfig.INCLUDE_UPDATER) {
|
|
||||||
UpdaterJob.cancelTask(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
val oldVersion = preferences.lastVersionCode().get()
|
val oldVersion = preferences.lastVersionCode().get()
|
||||||
if (oldVersion < BuildConfig.VERSION_CODE) {
|
if (oldVersion < BuildConfig.VERSION_CODE) {
|
||||||
preferences.lastVersionCode().set(BuildConfig.VERSION_CODE)
|
preferences.lastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||||
|
|
||||||
// Fresh install
|
// Always set up background tasks to ensure they're running
|
||||||
if (oldVersion == 0) {
|
|
||||||
// Set up default background tasks
|
|
||||||
if (BuildConfig.INCLUDE_UPDATER) {
|
if (BuildConfig.INCLUDE_UPDATER) {
|
||||||
UpdaterJob.setupTask(context)
|
UpdaterJob.setupTask(context)
|
||||||
}
|
}
|
||||||
ExtensionUpdateJob.setupTask(context)
|
ExtensionUpdateJob.setupTask(context)
|
||||||
LibraryUpdateJob.setupTask(context)
|
LibraryUpdateJob.setupTask(context)
|
||||||
|
BackupCreatorJob.setupTask(context)
|
||||||
|
|
||||||
|
// Fresh install
|
||||||
|
if (oldVersion == 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +226,7 @@ object Migrations {
|
|||||||
putString(PreferenceKeys.librarySortingDirection, newSortingDirection.name)
|
putString(PreferenceKeys.librarySortingDirection, newSortingDirection.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.pushtorefresh.storio.sqlite.queries.DeleteQuery
|
|||||||
import com.pushtorefresh.storio.sqlite.queries.Query
|
import com.pushtorefresh.storio.sqlite.queries.Query
|
||||||
import com.pushtorefresh.storio.sqlite.queries.RawQuery
|
import com.pushtorefresh.storio.sqlite.queries.RawQuery
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
|
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -70,14 +71,16 @@ object EXHMigrations {
|
|||||||
if (oldVersion < BuildConfig.VERSION_CODE) {
|
if (oldVersion < BuildConfig.VERSION_CODE) {
|
||||||
preferences.ehLastVersionCode().set(BuildConfig.VERSION_CODE)
|
preferences.ehLastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||||
|
|
||||||
// Fresh install
|
|
||||||
if (oldVersion == 0) {
|
|
||||||
// Set up default background tasks
|
|
||||||
if (BuildConfig.INCLUDE_UPDATER) {
|
if (BuildConfig.INCLUDE_UPDATER) {
|
||||||
UpdaterJob.setupTask(context)
|
UpdaterJob.setupTask(context)
|
||||||
}
|
}
|
||||||
ExtensionUpdateJob.setupTask(context)
|
ExtensionUpdateJob.setupTask(context)
|
||||||
LibraryUpdateJob.setupTask(context)
|
LibraryUpdateJob.setupTask(context)
|
||||||
|
BackupCreatorJob.setupTask(context)
|
||||||
|
EHentaiUpdateWorker.scheduleBackground(context)
|
||||||
|
|
||||||
|
// Fresh install
|
||||||
|
if (oldVersion == 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (oldVersion under 4) {
|
if (oldVersion under 4) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user