From 50505574e88fec43a298f24247ed14be0411d71f Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 15 Dec 2023 18:43:48 -0500 Subject: [PATCH] Remove redundant job setup calls in migrations We always set them up earlier in the migrations anyway. (cherry picked from commit dd1a19745a0a9df3814f22dd597585e44d3cba35) --- .../main/java/eu/kanade/tachiyomi/Migrations.kt | 15 --------------- app/src/main/java/exh/EXHMigrations.kt | 17 ----------------- 2 files changed, 32 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index f9dd8e716..b1b57720c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -68,10 +68,6 @@ object Migrations { val prefs = PreferenceManager.getDefaultSharedPreferences(context) - if (oldVersion < 14) { - // Restore jobs after upgrading to Evernote's job scheduler. - LibraryUpdateJob.setupTask(context) - } if (oldVersion < 15) { // Delete internal chapter cache dir. 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) { // Reset sorting preference if using removed sort by source val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0) @@ -262,9 +253,6 @@ object Migrations { basePreferences.extensionInstaller().set(BasePreferences.ExtensionInstaller.LEGACY) } } - if (oldVersion < 76) { - BackupCreateJob.setupTask(context) - } if (oldVersion < 77) { val oldReaderTap = prefs.getBoolean("reader_tap", false) if (!oldReaderTap) { @@ -377,9 +365,6 @@ object Migrations { } } } - if (oldVersion < 100) { - BackupCreateJob.setupTask(context) - } if (oldVersion < 105) { val pref = libraryPreferences.autoUpdateDeviceRestrictions() if (pref.isSet() && "battery_not_low" in pref.get()) { diff --git a/app/src/main/java/exh/EXHMigrations.kt b/app/src/main/java/exh/EXHMigrations.kt index a0903797c..a5e9ff902 100644 --- a/app/src/main/java/exh/EXHMigrations.kt +++ b/app/src/main/java/exh/EXHMigrations.kt @@ -298,7 +298,6 @@ object EXHMigrations { val updateInterval = libraryPreferences.autoUpdateInterval().get() if (updateInterval == 1 || updateInterval == 2) { libraryPreferences.autoUpdateInterval().set(3) - LibraryUpdateJob.setupTask(context, 3) } } if (oldVersion under 20) { @@ -338,20 +337,11 @@ object EXHMigrations { 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) { // Handle removed every 3, 4, 6, and 8 hour library updates val updateInterval = libraryPreferences.autoUpdateInterval().get() if (updateInterval in listOf(3, 4, 6, 8)) { libraryPreferences.autoUpdateInterval().set(12) - LibraryUpdateJob.setupTask(context, 12) } } if (oldVersion under 23) { @@ -407,9 +397,6 @@ object EXHMigrations { } } } - if (oldVersion under 30) { - BackupCreateJob.setupTask(context) - } if (oldVersion under 31) { runBlocking { val savedSearch = prefs.getStringSet("eh_saved_searches", emptySet())?.mapNotNull { @@ -492,7 +479,6 @@ object EXHMigrations { if (oldVersion under 40) { if (backupPreferences.backupInterval().get() == 0) { backupPreferences.backupInterval().set(12) - BackupCreateJob.setupTask(context) } } if (oldVersion under 41) { @@ -543,8 +529,6 @@ object EXHMigrations { trackerManager.mdList.logout() } if (oldVersion under 52) { - LibraryUpdateJob.cancelAllWorks(context) - LibraryUpdateJob.setupTask(context) // Removed background jobs context.workManager.cancelAllWorkByTag("UpdateChecker") context.workManager.cancelAllWorkByTag("ExtensionUpdate") @@ -574,7 +558,6 @@ object EXHMigrations { preferenceStore.getEnum("${key}_v2", TriState.DISABLED).set(newValue) } } - BackupCreateJob.setupTask(context) } // if (oldVersion under 53) { // // This was accidentally visible from the reader settings sheet, but should always