fix(migration): Add Merged Manga Dedupe Mode Migration and update versioning (#1258)
This commit is contained in:
parent
dd69b6f9c0
commit
f668e31cf6
3 changed files with 38 additions and 2 deletions
|
|
@ -25,8 +25,8 @@ android {
|
|||
defaultConfig {
|
||||
applicationId = "app.komikku"
|
||||
|
||||
versionCode = 76
|
||||
versionName = "1.13.4"
|
||||
versionCode = 77
|
||||
versionName = "1.13.5"
|
||||
|
||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
||||
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package mihon.core.migration.migrations
|
||||
|
||||
import mihon.core.migration.Migration
|
||||
import mihon.core.migration.MigrationContext
|
||||
import tachiyomi.core.common.util.lang.withIOContext
|
||||
import tachiyomi.data.DatabaseHandler
|
||||
import tachiyomi.data.manga.MergedMangaMapper
|
||||
import tachiyomi.domain.manga.interactor.UpdateMergedSettings
|
||||
import tachiyomi.domain.manga.model.MergeMangaSettingsUpdate
|
||||
|
||||
class MergedMangaDedupeModeMigration : Migration {
|
||||
override val version: Float = 77f
|
||||
|
||||
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
|
||||
val handler = migrationContext.get<DatabaseHandler>() ?: return@withIOContext false
|
||||
val updateMergedSettings = migrationContext.get<UpdateMergedSettings>() ?: return@withIOContext false
|
||||
|
||||
// Get merged manga references from db
|
||||
val dbMergedMangaReferences = handler.awaitList {
|
||||
mergedQueries.selectAll(MergedMangaMapper::map)
|
||||
}
|
||||
|
||||
dbMergedMangaReferences.map {
|
||||
MergeMangaSettingsUpdate(
|
||||
id = it.id,
|
||||
chapterSortMode = (it.chapterSortMode - 1).coerceAtLeast(0),
|
||||
isInfoManga = null,
|
||||
getChapterUpdates = null,
|
||||
chapterPriority = null,
|
||||
downloadChapters = null,
|
||||
)
|
||||
}.let { updateMergedSettings.awaitAll(it) }
|
||||
return@withIOContext true
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,7 @@ val migrations: List<Migration>
|
|||
IntegratedHentaiMigration(),
|
||||
SetupAppUpdateMigration(),
|
||||
EHentaiMigration(),
|
||||
MergedMangaDedupeModeMigration(),
|
||||
// KMK <--
|
||||
TrustExtensionRepositoryMigration(),
|
||||
CategoryPreferencesCleanupMigration(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue