Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Migrate old update jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
NerdNumber9 committed Aug 13, 2019
1 parent 6857c8c commit 6ff684f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/exh/EXHMigrations.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -77,7 +79,6 @@ object EXHMigrations {
backupDatabase(context, oldVersion)
}

// Backup database in next release
if (oldVersion < 8405) {
db.inTransaction {
// Migrate HBrowse source IDs
Expand All @@ -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
Expand Down

0 comments on commit 6ff684f

Please sign in to comment.