Update dependency com.pinterest.ktlint:ktlint-cli to v1.8.0 (#1786)

* Update dependency com.pinterest.ktlint:ktlint-cli to v1.8.0

* Format

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-12-06 12:37:19 -05:00
committed by GitHub
parent 949829ae6b
commit 83c94c044d
37 changed files with 524 additions and 143 deletions

View File

@@ -513,25 +513,33 @@ object Chapter {
// Make sure some filter is defined
val condition =
when {
mangaId != null ->
mangaId != null -> {
// mangaId is not null, scope query under manga
when {
input.chapterIds != null ->
input.chapterIds != null -> {
Op.build { (ChapterTable.manga eq mangaId) and (ChapterTable.id inList input.chapterIds) }
}
input.chapterIndexes != null ->
input.chapterIndexes != null -> {
Op.build { (ChapterTable.manga eq mangaId) and (ChapterTable.sourceOrder inList input.chapterIndexes) }
}
else -> null
else -> {
null
}
}
}
else -> {
// mangaId is null, only chapterIndexes is valid for this case
when {
input.chapterIds != null ->
input.chapterIds != null -> {
Op.build { (ChapterTable.id inList input.chapterIds) }
}
else -> null
else -> {
null
}
}
}
} ?: return

View File

@@ -372,10 +372,11 @@ object Manga {
val sourceId = mangaEntry[MangaTable.sourceReference]
return when (val source = getCatalogueSourceOrStub(sourceId)) {
is HttpSource ->
is HttpSource -> {
getImageResponse(cacheSaveDir, fileName) {
fetchHttpSourceMangaThumbnail(source, mangaEntry)
}
}
is LocalSource -> {
val imageFile =
@@ -393,7 +394,7 @@ object Manga {
imageFile.inputStream() to contentType
}
is StubSource ->
is StubSource -> {
getImageResponse(cacheSaveDir, fileName) {
val thumbnailUrl =
mangaEntry[MangaTable.thumbnail_url]
@@ -403,8 +404,11 @@ object Manga {
GET(thumbnailUrl, cache = CacheControl.FORCE_NETWORK),
).await()
}
}
else -> throw IllegalArgumentException("Unknown source")
else -> {
throw IllegalArgumentException("Unknown source")
}
}
}

View File

@@ -86,7 +86,10 @@ object Search {
},
)
}
else -> it
else -> {
it
}
},
)
}
@@ -122,13 +125,27 @@ object Search {
is Filter.Header -> {
// NOOP
}
is Filter.Separator -> {
// NOOP
}
is Filter.Select<*> -> filter.state = change.state.toInt()
is Filter.Text -> filter.state = change.state
is Filter.CheckBox -> filter.state = change.state.toBooleanStrict()
is Filter.TriState -> filter.state = change.state.toInt()
is Filter.Select<*> -> {
filter.state = change.state.toInt()
}
is Filter.Text -> {
filter.state = change.state
}
is Filter.CheckBox -> {
filter.state = change.state.toBooleanStrict()
}
is Filter.TriState -> {
filter.state = change.state.toInt()
}
is Filter.Group<*> -> {
val groupChange = jsonMapper.fromJsonString<FilterChange>(change.state)
@@ -139,6 +156,7 @@ object Search {
is Filter.Select<*> -> groupFilter.state = groupChange.state.toInt()
}
}
is Filter.Sort -> {
filter.state = jsonMapper.fromJsonString(change.state, Filter.Sort.Selection::class.java)
}

View File

@@ -120,8 +120,11 @@ object DownloadManager {
fun handleRequest(ctx: WsMessageContext) {
when (ctx.message()) {
"STATUS" -> notifyClient(ctx)
else ->
"STATUS" -> {
notifyClient(ctx)
}
else -> {
ctx.send(
"""
|Invalid command.
@@ -131,6 +134,7 @@ object DownloadManager {
|
""".trimMargin(),
)
}
}
}

View File

@@ -49,6 +49,7 @@ sealed class FileType {
is RegularFile -> {
this.file.name
}
is ZipFile -> {
this.entry.name
}
@@ -59,6 +60,7 @@ sealed class FileType {
is RegularFile -> {
this.file.extension
}
is ZipFile -> {
this.entry.name.substringAfterLast(".")
}

View File

@@ -149,6 +149,7 @@ object ExtensionsList {
this[ExtensionTable.hasUpdate] = true
updateMap.putIfAbsent(foundExtension.pkgName, foundExtension)
}
foundExtension.versionCode < extensionRecord[ExtensionTable.versionCode] -> {
// somehow the user installed an invalid version
this[ExtensionTable.isObsolete] = true

View File

@@ -150,6 +150,7 @@ object KoreaderSyncService {
null
}
}
KoreaderSyncChecksumMethod.FILENAME -> {
logger.debug { "[KOSYNC HASH] No hash for chapterId=$chapterId. Generating from filename." }
(ChapterTable innerJoin MangaTable)

View File

@@ -69,56 +69,82 @@ class Anilist(
when (trackPreferences.getScoreType(this)) {
// 10 point
POINT_10 -> IntRange(0, 10).map(Int::toString)
// 100 point
POINT_100 -> IntRange(0, 100).map(Int::toString)
// 5 stars
POINT_5 -> IntRange(0, 5).map { "$it" }
// Smiley
POINT_3 -> listOf("-", "😦", "😐", "😊")
// 10 point decimal
POINT_10_DECIMAL -> IntRange(0, 100).map { (it / 10f).toString() }
else -> throw Exception("Unknown score type")
}
override fun indexToScore(index: Int): Double =
when (trackPreferences.getScoreType(this)) {
// 10 point
POINT_10 -> index * 10.0
POINT_10 -> {
index * 10.0
}
// 100 point
POINT_100 -> index.toDouble()
POINT_100 -> {
index.toDouble()
}
// 5 stars
POINT_5 ->
POINT_5 -> {
when (index) {
0 -> 0.0
else -> index * 20.0 - 10.0
}
}
// Smiley
POINT_3 ->
POINT_3 -> {
when (index) {
0 -> 0.0
else -> index * 25.0 + 10.0
}
}
// 10 point decimal
POINT_10_DECIMAL -> index.toDouble()
else -> throw Exception("Unknown score type")
POINT_10_DECIMAL -> {
index.toDouble()
}
else -> {
throw Exception("Unknown score type")
}
}
override fun displayScore(track: Track): String {
val score = track.score
return when (val type = trackPreferences.getScoreType(this)) {
POINT_5 ->
POINT_5 -> {
when (score) {
0.0 -> "0 ★"
else -> "${((score + 10) / 20).toInt()}"
}
POINT_3 ->
}
POINT_3 -> {
when {
score == 0.0 -> "0"
score <= 35 -> "😦"
score <= 60 -> "😐"
else -> "😊"
}
else -> track.toApiScore(type)
}
else -> {
track.toApiScore(type)
}
}
}

View File

@@ -16,11 +16,17 @@ fun Track.toApiStatus() =
fun Track.toApiScore(scoreType: String?): String =
when (scoreType) {
// 10 point
"POINT_10" -> (score.toInt() / 10).toString()
"POINT_10" -> {
(score.toInt() / 10).toString()
}
// 100 point
"POINT_100" -> score.toInt().toString()
"POINT_100" -> {
score.toInt().toString()
}
// 5 stars
"POINT_5" ->
"POINT_5" -> {
when {
score == 0.0 -> "0"
score < 30 -> "1"
@@ -29,15 +35,24 @@ fun Track.toApiScore(scoreType: String?): String =
score < 90 -> "4"
else -> "5"
}
}
// Smiley
"POINT_3" ->
"POINT_3" -> {
when {
score == 0.0 -> "0"
score <= 35 -> ":("
score <= 60 -> ":|"
else -> ":)"
}
}
// 10 point decimal
"POINT_10_DECIMAL" -> (score / 10).toString()
else -> throw NotImplementedError("Unknown score type")
"POINT_10_DECIMAL" -> {
(score / 10).toString()
}
else -> {
throw NotImplementedError("Unknown score type")
}
}

View File

@@ -24,12 +24,19 @@ class MangaUpdates(
(0..10)
.flatMap { decimal ->
when (decimal) {
0 -> listOf("-")
10 -> listOf("10.0")
else ->
0 -> {
listOf("-")
}
10 -> {
listOf("10.0")
}
else -> {
(0..9).map { fraction ->
"$decimal.$fraction"
}
}
}
}
}

View File

@@ -26,8 +26,11 @@ object UpdaterSocket : Websocket<UpdateStatus>() {
override fun handleRequest(ctx: WsMessageContext) {
when (ctx.message()) {
"STATUS" -> notifyClient(ctx, updater.statusDeprecated.value)
else ->
"STATUS" -> {
notifyClient(ctx, updater.statusDeprecated.value)
}
else -> {
ctx.send(
"""
|Invalid command.
@@ -37,6 +40,7 @@ object UpdaterSocket : Websocket<UpdateStatus>() {
|
""".trimMargin(),
)
}
}
}

View File

@@ -48,7 +48,10 @@ private fun getChapterDir(
chapterEntry[ChapterTable.scanlator] != null -> {
"${chapterEntry[ChapterTable.scanlator]}_${chapterEntry[ChapterTable.name]}"
}
else -> chapterEntry[ChapterTable.name]
else -> {
chapterEntry[ChapterTable.name]
}
},
)