mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-23 13:23:28 +03:00
fix: Migrations not getting context correctly (#1820)
This commit is contained in:
parent
33c813792b
commit
8637207121
29 changed files with 58 additions and 58 deletions
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
|
||||
val oldDir = File(context.externalCacheDir, "cover_disk_cache")
|
||||
if (oldDir.exists()) {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val networkPreferences = migrationContext.get<NetworkPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
|
||||
val extCache = context.externalCacheDir
|
||||
if (extCache != null) {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val backupPreferences = migrationContext.get<BackupPreferences>() ?: return false
|
||||
|
||||
if (backupPreferences.backupInterval().get() == 0) {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val preferenceStore = migrationContext.get<PreferenceStore>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
|
||||
File(context.cacheDir, "chapter_disk_cache").deleteRecursively()
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val newOrientation = when (prefs.getInt("pref_rotation_type_key", 1)) {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val securityPreferences = migrationContext.get<SecurityPreferences>() ?: return false
|
||||
val basePreferences = migrationContext.get<BasePreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val trackerManager = migrationContext.get<TrackerManager>() ?: return false
|
||||
val preferenceStore = migrationContext.get<PreferenceStore>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val playerPreferences = migrationContext.get<PlayerPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val preferenceStore = migrationContext.get<PreferenceStore>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val preferenceStore = migrationContext.get<PreferenceStore>() ?: return false
|
||||
|
||||
val prefsToReplace = listOf(
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
prefs.edit {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val playerPreferences = migrationContext.get<PlayerPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
context.workManager.cancelAllWorkByTag("UpdateChecker")
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
|
||||
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
|
||||
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val readerPreferences = migrationContext.get<ReaderPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
if (prefs.contains("pref_rotation_type_key")) {
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val libraryPreferences = migrationContext.get<LibraryPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
|
||||
MangaLibraryUpdateJob.setupTask(context)
|
||||
AnimeLibraryUpdateJob.setupTask(context)
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
val uiPreferences = migrationContext.get<UiPreferences>() ?: return false
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -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<App>() ?: return false
|
||||
val context = migrationContext.get<Application>() ?: return false
|
||||
|
||||
MangaLibraryUpdateJob.cancelAllWorks(context)
|
||||
AnimeLibraryUpdateJob.cancelAllWorks(context)
|
||||
|
|
Loading…
Reference in a new issue