Remove redundant job setup calls in migrations

We always set them up earlier in the migrations anyway.

(cherry picked from commit dd1a19745a0a9df3814f22dd597585e44d3cba35)
This commit is contained in:
arkon 2023-12-15 18:43:48 -05:00 committed by Jobobby04
parent 9eb99fb10f
commit 50505574e8
2 changed files with 0 additions and 32 deletions

View File

@ -68,10 +68,6 @@ object Migrations {
val prefs = PreferenceManager.getDefaultSharedPreferences(context) val prefs = PreferenceManager.getDefaultSharedPreferences(context)
if (oldVersion < 14) {
// Restore jobs after upgrading to Evernote's job scheduler.
LibraryUpdateJob.setupTask(context)
}
if (oldVersion < 15) { if (oldVersion < 15) {
// Delete internal chapter cache dir. // Delete internal chapter cache dir.
File(context.cacheDir, "chapter_disk_cache").deleteRecursively() File(context.cacheDir, "chapter_disk_cache").deleteRecursively()
@ -98,11 +94,6 @@ object Migrations {
} }
} }
} }
if (oldVersion < 43) {
// Restore jobs after migrating from Evernote's job scheduler to WorkManager.
LibraryUpdateJob.setupTask(context)
BackupCreateJob.setupTask(context)
}
if (oldVersion < 44) { if (oldVersion < 44) {
// Reset sorting preference if using removed sort by source // Reset sorting preference if using removed sort by source
val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0) val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0)
@ -262,9 +253,6 @@ object Migrations {
basePreferences.extensionInstaller().set(BasePreferences.ExtensionInstaller.LEGACY) basePreferences.extensionInstaller().set(BasePreferences.ExtensionInstaller.LEGACY)
} }
} }
if (oldVersion < 76) {
BackupCreateJob.setupTask(context)
}
if (oldVersion < 77) { if (oldVersion < 77) {
val oldReaderTap = prefs.getBoolean("reader_tap", false) val oldReaderTap = prefs.getBoolean("reader_tap", false)
if (!oldReaderTap) { if (!oldReaderTap) {
@ -377,9 +365,6 @@ object Migrations {
} }
} }
} }
if (oldVersion < 100) {
BackupCreateJob.setupTask(context)
}
if (oldVersion < 105) { if (oldVersion < 105) {
val pref = libraryPreferences.autoUpdateDeviceRestrictions() val pref = libraryPreferences.autoUpdateDeviceRestrictions()
if (pref.isSet() && "battery_not_low" in pref.get()) { if (pref.isSet() && "battery_not_low" in pref.get()) {

View File

@ -298,7 +298,6 @@ object EXHMigrations {
val updateInterval = libraryPreferences.autoUpdateInterval().get() val updateInterval = libraryPreferences.autoUpdateInterval().get()
if (updateInterval == 1 || updateInterval == 2) { if (updateInterval == 1 || updateInterval == 2) {
libraryPreferences.autoUpdateInterval().set(3) libraryPreferences.autoUpdateInterval().set(3)
LibraryUpdateJob.setupTask(context, 3)
} }
} }
if (oldVersion under 20) { if (oldVersion under 20) {
@ -338,20 +337,11 @@ object EXHMigrations {
logcat(throwable = e) { "Already done migration" } logcat(throwable = e) { "Already done migration" }
} }
} }
if (oldVersion under 21) {
// Setup EH updater task after migrating to WorkManager
EHentaiUpdateWorker.scheduleBackground(context)
// if (preferences.lang().get() in listOf("en-US", "en-GB")) {
// preferences.lang().set("en")
// }
}
if (oldVersion under 22) { if (oldVersion under 22) {
// Handle removed every 3, 4, 6, and 8 hour library updates // Handle removed every 3, 4, 6, and 8 hour library updates
val updateInterval = libraryPreferences.autoUpdateInterval().get() val updateInterval = libraryPreferences.autoUpdateInterval().get()
if (updateInterval in listOf(3, 4, 6, 8)) { if (updateInterval in listOf(3, 4, 6, 8)) {
libraryPreferences.autoUpdateInterval().set(12) libraryPreferences.autoUpdateInterval().set(12)
LibraryUpdateJob.setupTask(context, 12)
} }
} }
if (oldVersion under 23) { if (oldVersion under 23) {
@ -407,9 +397,6 @@ object EXHMigrations {
} }
} }
} }
if (oldVersion under 30) {
BackupCreateJob.setupTask(context)
}
if (oldVersion under 31) { if (oldVersion under 31) {
runBlocking { runBlocking {
val savedSearch = prefs.getStringSet("eh_saved_searches", emptySet())?.mapNotNull { val savedSearch = prefs.getStringSet("eh_saved_searches", emptySet())?.mapNotNull {
@ -492,7 +479,6 @@ object EXHMigrations {
if (oldVersion under 40) { if (oldVersion under 40) {
if (backupPreferences.backupInterval().get() == 0) { if (backupPreferences.backupInterval().get() == 0) {
backupPreferences.backupInterval().set(12) backupPreferences.backupInterval().set(12)
BackupCreateJob.setupTask(context)
} }
} }
if (oldVersion under 41) { if (oldVersion under 41) {
@ -543,8 +529,6 @@ object EXHMigrations {
trackerManager.mdList.logout() trackerManager.mdList.logout()
} }
if (oldVersion under 52) { if (oldVersion under 52) {
LibraryUpdateJob.cancelAllWorks(context)
LibraryUpdateJob.setupTask(context)
// Removed background jobs // Removed background jobs
context.workManager.cancelAllWorkByTag("UpdateChecker") context.workManager.cancelAllWorkByTag("UpdateChecker")
context.workManager.cancelAllWorkByTag("ExtensionUpdate") context.workManager.cancelAllWorkByTag("ExtensionUpdate")
@ -574,7 +558,6 @@ object EXHMigrations {
preferenceStore.getEnum("${key}_v2", TriState.DISABLED).set(newValue) preferenceStore.getEnum("${key}_v2", TriState.DISABLED).set(newValue)
} }
} }
BackupCreateJob.setupTask(context)
} }
// if (oldVersion under 53) { // if (oldVersion under 53) {
// // This was accidentally visible from the reader settings sheet, but should always // // This was accidentally visible from the reader settings sheet, but should always