From 3c34d54ca932dd4489dac537b83eaf498a43542b Mon Sep 17 00:00:00 2001 From: Secozzi Date: Sat, 9 Nov 2024 13:56:33 +0100 Subject: [PATCH] Fix migrations not getting context correctly --- .../migration/migrations/CombineUpdateRestrictionMigration.kt | 4 ++-- .../core/migration/migrations/CoverToExternalFileMigration.kt | 4 ++-- .../main/java/mihon/core/migration/migrations/DOHMigration.kt | 4 ++-- .../migrations/DeleteExternalChapterCacheDirMigration.kt | 4 ++-- .../core/migration/migrations/EnableAutoBackupMigration.kt | 4 ++-- .../java/mihon/core/migration/migrations/EnumsMigration.kt | 4 ++-- .../migration/migrations/InternalChapterCacheDirMigration.kt | 4 ++-- .../migration/migrations/MergeSortTypeDirectionMigration.kt | 4 ++-- .../migrations/MigrateRotationViewerValuesMigration.kt | 4 ++-- .../core/migration/migrations/MigrateSecureScreenMigration.kt | 4 ++-- .../core/migration/migrations/MigrateSortingModeMigration.kt | 4 ++-- .../core/migration/migrations/MigrateToTriStateMigration.kt | 4 ++-- .../core/migration/migrations/MigrateTriStateMigration.kt | 4 ++-- .../migration/migrations/MoveChapterPreferencesMigration.kt | 4 ++-- .../migration/migrations/MovePlayerPreferencesMigration.kt | 4 ++-- .../core/migration/migrations/NavigationOptionsMigration.kt | 4 ++-- .../mihon/core/migration/migrations/NoAppStateMigration.kt | 4 ++-- .../migration/migrations/PermaTrustExtensionsMigration.kt | 4 ++-- .../core/migration/migrations/PlayerPreferenceMigration.kt | 4 ++-- .../migration/migrations/RemoveBackgroundJobsMigration.kt | 4 ++-- .../migration/migrations/RemoveOneTwoHourUpdateMigration.kt | 4 ++-- .../core/migration/migrations/RemoveQuickUpdateMigration.kt | 4 ++-- .../core/migration/migrations/RemoveReaderTapMigration.kt | 4 ++-- .../mihon/core/migration/migrations/RenameEnumMigration.kt | 4 ++-- .../mihon/core/migration/migrations/ResetRotationMigration.kt | 4 ++-- .../migrations/ResetSortPreferenceRemovedMigration.kt | 4 ++-- .../migration/migrations/SetupBackgroundTasksMigration.kt | 4 ++-- .../core/migration/migrations/SplitPreferencesMigration.kt | 4 ++-- .../core/migration/migrations/UseWorkManagerMigration.kt | 4 ++-- 29 files changed, 58 insertions(+), 58 deletions(-) diff --git a/app/src/main/java/mihon/core/migration/migrations/CombineUpdateRestrictionMigration.kt b/app/src/main/java/mihon/core/migration/migrations/CombineUpdateRestrictionMigration.kt index 58ac0d06ec..ad6567dfbc 100644 --- a/app/src/main/java/mihon/core/migration/migrations/CombineUpdateRestrictionMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/CombineUpdateRestrictionMigration.kt @@ -1,7 +1,7 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.core.common.preference.minusAssign @@ -13,7 +13,7 @@ class CombineUpdateRestrictionMigration : Migration { // Combine global update item restrictions override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/CoverToExternalFileMigration.kt b/app/src/main/java/mihon/core/migration/migrations/CoverToExternalFileMigration.kt index 5113c911fa..303e6fdc97 100644 --- a/app/src/main/java/mihon/core/migration/migrations/CoverToExternalFileMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/CoverToExternalFileMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import java.io.File @@ -10,7 +10,7 @@ class CoverToExternalFileMigration : Migration { // Move covers to external files dir. override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val oldDir = File(context.externalCacheDir, "cover_disk_cache") if (oldDir.exists()) { diff --git a/app/src/main/java/mihon/core/migration/migrations/DOHMigration.kt b/app/src/main/java/mihon/core/migration/migrations/DOHMigration.kt index 4bc603f80f..0a50dba127 100644 --- a/app/src/main/java/mihon/core/migration/migrations/DOHMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/DOHMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.network.NetworkPreferences import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE import mihon.core.migration.Migration @@ -13,7 +13,7 @@ class DOHMigration : Migration { // Migrate DNS over HTTPS setting override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val networkPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/DeleteExternalChapterCacheDirMigration.kt b/app/src/main/java/mihon/core/migration/migrations/DeleteExternalChapterCacheDirMigration.kt index bf4ab7cb42..ecfa3805c2 100644 --- a/app/src/main/java/mihon/core/migration/migrations/DeleteExternalChapterCacheDirMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/DeleteExternalChapterCacheDirMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import java.io.File @@ -10,7 +10,7 @@ class DeleteExternalChapterCacheDirMigration : Migration { // Delete external chapter cache dir. override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val extCache = context.externalCacheDir if (extCache != null) { diff --git a/app/src/main/java/mihon/core/migration/migrations/EnableAutoBackupMigration.kt b/app/src/main/java/mihon/core/migration/migrations/EnableAutoBackupMigration.kt index 3249a29890..8f9e3c2ce4 100644 --- a/app/src/main/java/mihon/core/migration/migrations/EnableAutoBackupMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/EnableAutoBackupMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import eu.kanade.tachiyomi.data.backup.create.BackupCreateJob import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -11,7 +11,7 @@ class EnableAutoBackupMigration : Migration { // Always attempt automatic backup creation override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val backupPreferences = migrationContext.get() ?: return false if (backupPreferences.backupInterval().get() == 0) { diff --git a/app/src/main/java/mihon/core/migration/migrations/EnumsMigration.kt b/app/src/main/java/mihon/core/migration/migrations/EnumsMigration.kt index 3ba7e2b94f..06bfc406c4 100644 --- a/app/src/main/java/mihon/core/migration/migrations/EnumsMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/EnumsMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.ui.player.viewer.AspectState import eu.kanade.tachiyomi.ui.player.viewer.HwDecState import eu.kanade.tachiyomi.ui.player.viewer.InvertedPlayback @@ -17,7 +17,7 @@ class EnumsMigration : Migration { // refactor(player): Implement more enums override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val preferenceStore = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/InternalChapterCacheDirMigration.kt b/app/src/main/java/mihon/core/migration/migrations/InternalChapterCacheDirMigration.kt index 6fbf39d0e3..9fe355ee51 100644 --- a/app/src/main/java/mihon/core/migration/migrations/InternalChapterCacheDirMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/InternalChapterCacheDirMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import java.io.File @@ -10,7 +10,7 @@ class InternalChapterCacheDirMigration : Migration { // Delete internal chapter cache dir. override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false File(context.cacheDir, "chapter_disk_cache").deleteRecursively() diff --git a/app/src/main/java/mihon/core/migration/migrations/MergeSortTypeDirectionMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MergeSortTypeDirectionMigration.kt index a0d015e8ef..de77589271 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MergeSortTypeDirectionMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MergeSortTypeDirectionMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -12,7 +12,7 @@ class MergeSortTypeDirectionMigration : Migration { // Merge Sort Type and Direction into one class override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MigrateRotationViewerValuesMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MigrateRotationViewerValuesMigration.kt index 877624cae9..d526da547c 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MigrateRotationViewerValuesMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MigrateRotationViewerValuesMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -12,7 +12,7 @@ class MigrateRotationViewerValuesMigration : Migration { // Migrate Rotation and Viewer values to default values for viewer_flags override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) val newOrientation = when (prefs.getInt("pref_rotation_type_key", 1)) { diff --git a/app/src/main/java/mihon/core/migration/migrations/MigrateSecureScreenMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MigrateSecureScreenMigration.kt index 43985a29eb..9230b2933d 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MigrateSecureScreenMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MigrateSecureScreenMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.preference.PreferenceManager import eu.kanade.domain.base.BasePreferences -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.core.security.SecurityPreferences import eu.kanade.tachiyomi.util.system.DeviceUtil import mihon.core.migration.Migration @@ -13,7 +13,7 @@ class MigrateSecureScreenMigration : Migration { // Allow disabling secure screen when incognito mode is on override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val securityPreferences = migrationContext.get() ?: return false val basePreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MigrateSortingModeMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MigrateSortingModeMigration.kt index 41dcf24685..1e3027167d 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MigrateSortingModeMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MigrateSortingModeMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -12,7 +12,7 @@ class MigrateSortingModeMigration : Migration { // Switch to sort per category override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MigrateToTriStateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MigrateToTriStateMigration.kt index b3f747879a..f0ac0bde5a 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MigrateToTriStateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MigrateToTriStateMigration.kt @@ -1,9 +1,9 @@ package mihon.core.migration.migrations +import android.app.Application import android.content.SharedPreferences import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -13,7 +13,7 @@ class MigrateToTriStateMigration : Migration { // Migrate library filters to tri-state versions override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MigrateTriStateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MigrateTriStateMigration.kt index 60cd238d58..6340872e88 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MigrateTriStateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MigrateTriStateMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.data.track.TrackerManager import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -15,7 +15,7 @@ class MigrateTriStateMigration : Migration { // Migrate TriState usages to TriStateFilter enum override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val trackerManager = migrationContext.get() ?: return false val preferenceStore = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MoveChapterPreferencesMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MoveChapterPreferencesMigration.kt index 088b15b33f..c8d9431296 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MoveChapterPreferencesMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MoveChapterPreferencesMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -12,7 +12,7 @@ class MoveChapterPreferencesMigration : Migration { // Move chapter preferences from PreferencesHelper to LibraryPrefrences override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/MovePlayerPreferencesMigration.kt b/app/src/main/java/mihon/core/migration/migrations/MovePlayerPreferencesMigration.kt index 7d54cf31c1..de277be69a 100644 --- a/app/src/main/java/mihon/core/migration/migrations/MovePlayerPreferencesMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/MovePlayerPreferencesMigration.kt @@ -1,9 +1,9 @@ package mihon.core.migration.migrations +import android.app.Application import android.content.Context import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -14,7 +14,7 @@ class MovePlayerPreferencesMigration : Migration { // more migrations for player prefs @Suppress("SwallowedException") override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val playerPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/NavigationOptionsMigration.kt b/app/src/main/java/mihon/core/migration/migrations/NavigationOptionsMigration.kt index bfaef758b0..fd54f89b6a 100644 --- a/app/src/main/java/mihon/core/migration/migrations/NavigationOptionsMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/NavigationOptionsMigration.kt @@ -1,10 +1,10 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager import eu.kanade.domain.ui.model.NavStyle import eu.kanade.domain.ui.model.StartScreen -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.core.common.preference.PreferenceStore @@ -15,7 +15,7 @@ class NavigationOptionsMigration : Migration { // Bring back navigation options override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val preferenceStore = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/NoAppStateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/NoAppStateMigration.kt index 26ad8e376f..74383d224b 100644 --- a/app/src/main/java/mihon/core/migration/migrations/NoAppStateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/NoAppStateMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.core.common.preference.Preference @@ -11,7 +11,7 @@ class NoAppStateMigration : Migration { // Don't include "app state" preferences in backups override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val preferenceStore = migrationContext.get() ?: return false val prefsToReplace = listOf( diff --git a/app/src/main/java/mihon/core/migration/migrations/PermaTrustExtensionsMigration.kt b/app/src/main/java/mihon/core/migration/migrations/PermaTrustExtensionsMigration.kt index 7e4adef6d5..c9a6528f09 100644 --- a/app/src/main/java/mihon/core/migration/migrations/PermaTrustExtensionsMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/PermaTrustExtensionsMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.core.common.preference.Preference @@ -12,7 +12,7 @@ class PermaTrustExtensionsMigration : Migration { // Allow permanently trusting unofficial extensions by version code + signature override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) prefs.edit { diff --git a/app/src/main/java/mihon/core/migration/migrations/PlayerPreferenceMigration.kt b/app/src/main/java/mihon/core/migration/migrations/PlayerPreferenceMigration.kt index b8967a5038..54e6a78926 100644 --- a/app/src/main/java/mihon/core/migration/migrations/PlayerPreferenceMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/PlayerPreferenceMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -13,7 +13,7 @@ class PlayerPreferenceMigration : Migration { // add migration for player preference @Suppress("SwallowedException") override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val playerPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/RemoveBackgroundJobsMigration.kt b/app/src/main/java/mihon/core/migration/migrations/RemoveBackgroundJobsMigration.kt index d990cec007..2e2acd501c 100644 --- a/app/src/main/java/mihon/core/migration/migrations/RemoveBackgroundJobsMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/RemoveBackgroundJobsMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.util.system.workManager import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -12,7 +12,7 @@ class RemoveBackgroundJobsMigration : Migration { // Removed background jobs override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) context.workManager.cancelAllWorkByTag("UpdateChecker") diff --git a/app/src/main/java/mihon/core/migration/migrations/RemoveOneTwoHourUpdateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/RemoveOneTwoHourUpdateMigration.kt index 0787920f57..2a6d4b28fe 100644 --- a/app/src/main/java/mihon/core/migration/migrations/RemoveOneTwoHourUpdateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/RemoveOneTwoHourUpdateMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob import mihon.core.migration.Migration @@ -12,7 +12,7 @@ class RemoveOneTwoHourUpdateMigration : Migration { // Handle removed every 1 or 2 hour library updates override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val updateInterval = libraryPreferences.autoUpdateInterval().get() diff --git a/app/src/main/java/mihon/core/migration/migrations/RemoveQuickUpdateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/RemoveQuickUpdateMigration.kt index 06f1b10dd1..4f22332f66 100644 --- a/app/src/main/java/mihon/core/migration/migrations/RemoveQuickUpdateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/RemoveQuickUpdateMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob import mihon.core.migration.Migration @@ -12,7 +12,7 @@ class RemoveQuickUpdateMigration : Migration { // Handle removed every 3, 4, 6, and 8 hour library updates override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val updateInterval = libraryPreferences.autoUpdateInterval().get() diff --git a/app/src/main/java/mihon/core/migration/migrations/RemoveReaderTapMigration.kt b/app/src/main/java/mihon/core/migration/migrations/RemoveReaderTapMigration.kt index 0a11529282..045761f80b 100644 --- a/app/src/main/java/mihon/core/migration/migrations/RemoveReaderTapMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/RemoveReaderTapMigration.kt @@ -1,7 +1,7 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -11,7 +11,7 @@ class RemoveReaderTapMigration : Migration { // Remove reader tapping option in favor of disabled nav layouts override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val readerPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/RenameEnumMigration.kt b/app/src/main/java/mihon/core/migration/migrations/RenameEnumMigration.kt index 20fd959335..e5cb41dfb9 100644 --- a/app/src/main/java/mihon/core/migration/migrations/RenameEnumMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/RenameEnumMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -12,7 +12,7 @@ class RenameEnumMigration : Migration { // Handle renamed enum values override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/ResetRotationMigration.kt b/app/src/main/java/mihon/core/migration/migrations/ResetRotationMigration.kt index 6aaa8be611..ad12e5c51c 100644 --- a/app/src/main/java/mihon/core/migration/migrations/ResetRotationMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/ResetRotationMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -11,7 +11,7 @@ class ResetRotationMigration : Migration { // Reset rotation to Free after replacing Lock override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) if (prefs.contains("pref_rotation_type_key")) { diff --git a/app/src/main/java/mihon/core/migration/migrations/ResetSortPreferenceRemovedMigration.kt b/app/src/main/java/mihon/core/migration/migrations/ResetSortPreferenceRemovedMigration.kt index fdbca17351..62915769ad 100644 --- a/app/src/main/java/mihon/core/migration/migrations/ResetSortPreferenceRemovedMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/ResetSortPreferenceRemovedMigration.kt @@ -1,8 +1,8 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext import tachiyomi.domain.library.service.LibraryPreferences @@ -12,7 +12,7 @@ class ResetSortPreferenceRemovedMigration : Migration { // Reset sorting preference if using removed sort by source override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val libraryPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/SetupBackgroundTasksMigration.kt b/app/src/main/java/mihon/core/migration/migrations/SetupBackgroundTasksMigration.kt index b81336958b..b5c7766aa8 100644 --- a/app/src/main/java/mihon/core/migration/migrations/SetupBackgroundTasksMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/SetupBackgroundTasksMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob import mihon.core.migration.Migration @@ -11,7 +11,7 @@ class SetupBackgroundTasksMigration : Migration { // Set up background tasks override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false MangaLibraryUpdateJob.setupTask(context) AnimeLibraryUpdateJob.setupTask(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/SplitPreferencesMigration.kt b/app/src/main/java/mihon/core/migration/migrations/SplitPreferencesMigration.kt index b416e9c3d6..bc3a3d0532 100644 --- a/app/src/main/java/mihon/core/migration/migrations/SplitPreferencesMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/SplitPreferencesMigration.kt @@ -1,9 +1,9 @@ package mihon.core.migration.migrations +import android.app.Application import androidx.core.content.edit import androidx.preference.PreferenceManager import eu.kanade.domain.ui.UiPreferences -import eu.kanade.tachiyomi.App import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -12,7 +12,7 @@ class SplitPreferencesMigration : Migration { // Split the rest of the preferences in PreferencesHelper override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false val uiPreferences = migrationContext.get() ?: return false val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/mihon/core/migration/migrations/UseWorkManagerMigration.kt b/app/src/main/java/mihon/core/migration/migrations/UseWorkManagerMigration.kt index 6033a7b650..d4577eb73e 100644 --- a/app/src/main/java/mihon/core/migration/migrations/UseWorkManagerMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/UseWorkManagerMigration.kt @@ -1,6 +1,6 @@ package mihon.core.migration.migrations -import eu.kanade.tachiyomi.App +import android.app.Application import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob import mihon.core.migration.Migration @@ -11,7 +11,7 @@ class UseWorkManagerMigration : Migration { // Fully utilize WorkManager for library updates override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false MangaLibraryUpdateJob.cancelAllWorks(context) AnimeLibraryUpdateJob.cancelAllWorks(context)