mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 02:18:24 +01:00
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:
parent
fdb96179c6
commit
be124ebe86
@ -1,6 +1,6 @@
|
|||||||
package mihon.core.migration.migrations
|
package mihon.core.migration.migrations
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.App
|
import android.app.Application
|
||||||
import eu.kanade.tachiyomi.data.backup.create.BackupCreateJob
|
import eu.kanade.tachiyomi.data.backup.create.BackupCreateJob
|
||||||
import mihon.core.migration.Migration
|
import mihon.core.migration.Migration
|
||||||
import mihon.core.migration.MigrationContext
|
import mihon.core.migration.MigrationContext
|
||||||
@ -9,7 +9,7 @@ class SetupBackupCreateMigration : Migration {
|
|||||||
override val version: Float = Migration.ALWAYS
|
override val version: Float = Migration.ALWAYS
|
||||||
|
|
||||||
override suspend fun invoke(migrationContext: MigrationContext): Boolean {
|
override suspend fun invoke(migrationContext: MigrationContext): Boolean {
|
||||||
val context = migrationContext.get<App>() ?: return false
|
val context = migrationContext.get<Application>() ?: return false
|
||||||
BackupCreateJob.setupTask(context)
|
BackupCreateJob.setupTask(context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mihon.core.migration.migrations
|
package mihon.core.migration.migrations
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.App
|
import android.app.Application
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||||
import mihon.core.migration.Migration
|
import mihon.core.migration.Migration
|
||||||
import mihon.core.migration.MigrationContext
|
import mihon.core.migration.MigrationContext
|
||||||
@ -9,7 +9,7 @@ class SetupLibraryUpdateMigration : Migration {
|
|||||||
override val version: Float = Migration.ALWAYS
|
override val version: Float = Migration.ALWAYS
|
||||||
|
|
||||||
override suspend fun invoke(migrationContext: MigrationContext): Boolean {
|
override suspend fun invoke(migrationContext: MigrationContext): Boolean {
|
||||||
val context = migrationContext.get<App>() ?: return false
|
val context = migrationContext.get<Application>() ?: return false
|
||||||
LibraryUpdateJob.setupTask(context)
|
LibraryUpdateJob.setupTask(context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user