From 6ff684f63805b31816f5929f168bbaffdd7615eb Mon Sep 17 00:00:00 2001 From: NerdNumber9 Date: Tue, 13 Aug 2019 01:43:07 -0400 Subject: [PATCH] Migrate old update jobs --- app/src/main/java/exh/EXHMigrations.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/exh/EXHMigrations.kt b/app/src/main/java/exh/EXHMigrations.kt index 8558691248be..2a4fa3647c9c 100644 --- a/app/src/main/java/exh/EXHMigrations.kt +++ b/app/src/main/java/exh/EXHMigrations.kt @@ -1,6 +1,7 @@ package exh import android.content.Context +import android.os.Build import com.elvishew.xlog.XLog import com.pushtorefresh.storio.sqlite.queries.Query import com.pushtorefresh.storio.sqlite.queries.RawQuery @@ -14,6 +15,7 @@ import eu.kanade.tachiyomi.data.database.resolvers.MangaUrlPutResolver import eu.kanade.tachiyomi.data.database.tables.MangaTable import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.util.jobScheduler import exh.source.BlacklistedSources import rx.Observable import uy.kohesive.injekt.injectLazy @@ -77,7 +79,6 @@ object EXHMigrations { backupDatabase(context, oldVersion) } - // Backup database in next release if (oldVersion < 8405) { db.inTransaction { // Migrate HBrowse source IDs @@ -90,6 +91,11 @@ object EXHMigrations { .affectsTables(MangaTable.TABLE) .build()) } + + // Cancel old scheduler jobs with old ids + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + context.jobScheduler.cancelAll() + } } // TODO BE CAREFUL TO NOT FUCK UP MergedSources IF CHANGING URLs