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>
This commit is contained in:
MajorTanya 2024-08-12 01:36:34 +02:00 committed by GitHub
parent fdb96179c6
commit be124ebe86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -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<App>() ?: return false
val context = migrationContext.get<Application>() ?: return false
BackupCreateJob.setupTask(context)
return true
}

View File

@ -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<App>() ?: return false
val context = migrationContext.get<Application>() ?: return false
LibraryUpdateJob.setupTask(context)
return true
}