From be124ebe86377ad77de5abd1594afd7aedf9050c Mon Sep 17 00:00:00 2001 From: MajorTanya <39014446+MajorTanya@users.noreply.github.com> Date: Mon, 12 Aug 2024 01:36:34 +0200 Subject: [PATCH] Fix some migrations never running (#1114) Both `SetupBackupCreateMigration` and `SetupLibraryUpdateMigration` were trying to get the `App` class from Injekt which is never provided via the `AppModule`. Using `Application` instead works since the `workManager` property used by the respective `setupTask` functions is an extension property on `Context`. Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> --- .../core/migration/migrations/SetupBackupCreateMigration.kt | 4 ++-- .../core/migration/migrations/SetupLibraryUpdateMigration.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/mihon/core/migration/migrations/SetupBackupCreateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/SetupBackupCreateMigration.kt index 44c0b557c..aabd5935f 100644 --- a/app/src/main/java/mihon/core/migration/migrations/SetupBackupCreateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/SetupBackupCreateMigration.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 @@ -9,7 +9,7 @@ class SetupBackupCreateMigration : Migration { override val version: Float = Migration.ALWAYS override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false BackupCreateJob.setupTask(context) return true } diff --git a/app/src/main/java/mihon/core/migration/migrations/SetupLibraryUpdateMigration.kt b/app/src/main/java/mihon/core/migration/migrations/SetupLibraryUpdateMigration.kt index 65482cd89..08b84c9a0 100644 --- a/app/src/main/java/mihon/core/migration/migrations/SetupLibraryUpdateMigration.kt +++ b/app/src/main/java/mihon/core/migration/migrations/SetupLibraryUpdateMigration.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.LibraryUpdateJob import mihon.core.migration.Migration import mihon.core.migration.MigrationContext @@ -9,7 +9,7 @@ class SetupLibraryUpdateMigration : Migration { override val version: Float = Migration.ALWAYS override suspend fun invoke(migrationContext: MigrationContext): Boolean { - val context = migrationContext.get() ?: return false + val context = migrationContext.get() ?: return false LibraryUpdateJob.setupTask(context) return true }