Address spotless lint errors (#1138)

* Add spotless (with ktlint)

* Run spotlessApply

* screaming case screaming case screaming case

* Update PagerViewerAdapter.kt

* Update ReaderTransitionView.kt
This commit is contained in:
AntsyLich
2024-08-19 18:11:39 +06:00
committed by GitHub
parent 5ae8095ef1
commit d6252ab770
230 changed files with 580 additions and 467 deletions
@@ -9,20 +9,24 @@ import tachiyomi.core.common.util.system.logcat
class MigrationJobFactory(
private val migrationContext: MigrationContext,
private val scope: CoroutineScope
private val scope: CoroutineScope,
) {
fun create(migrations: List<Migration>): Deferred<Boolean> = with(scope) {
return migrations.sortedBy { it.version }
.fold(CompletableDeferred(true)) { acc: Deferred<Boolean>, migration: Migration ->
if (!migrationContext.dryrun) {
logcat { "Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }" }
logcat {
"Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }"
}
async(start = CoroutineStart.UNDISPATCHED) {
val prev = acc.await()
migration(migrationContext) || prev
}
} else {
logcat { "(Dry-run) Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }" }
logcat {
"(Dry-run) Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }"
}
CompletableDeferred(true)
}
}
@@ -12,7 +12,7 @@ interface MigrationStrategy {
class DefaultMigrationStrategy(
private val migrationJobFactory: MigrationJobFactory,
private val migrationCompletedListener: MigrationCompletedListener,
private val scope: CoroutineScope
private val scope: CoroutineScope,
) : MigrationStrategy {
override operator fun invoke(migrations: List<Migration>): Deferred<Boolean> = with(scope) {
@@ -46,7 +46,7 @@ class NoopMigrationStrategy(val state: Boolean) : MigrationStrategy {
class VersionRangeMigrationStrategy(
private val versions: IntRange,
private val strategy: DefaultMigrationStrategy
private val strategy: DefaultMigrationStrategy,
) : MigrationStrategy {
override operator fun invoke(migrations: List<Migration>): Deferred<Boolean> {
@@ -17,7 +17,7 @@ object Migrator {
new: Int,
migrations: List<Migration>,
dryrun: Boolean = false,
onMigrationComplete: () -> Unit
onMigrationComplete: () -> Unit,
) {
val migrationContext = MigrationContext(dryrun)
val migrationJobFactory = MigrationJobFactory(migrationContext, scope)