Lint fixes

This commit is contained in:
arkon
2023-11-05 09:14:57 -05:00
parent 4f3a0b3523
commit 953f5fb025
29 changed files with 182 additions and 57 deletions

View File

@@ -446,7 +446,13 @@ class BackupRestorer(
return backupManga
}
private suspend fun restoreExtras(manga: Manga, categories: List<Int>, history: List<BackupHistory>, tracks: List<Track>, backupCategories: List<BackupCategory>) {
private suspend fun restoreExtras(
manga: Manga,
categories: List<Int>,
history: List<BackupHistory>,
tracks: List<Track>,
backupCategories: List<BackupCategory>,
) {
restoreCategories(manga, categories, backupCategories)
restoreHistory(history)
restoreTracking(manga, tracks)

View File

@@ -39,7 +39,21 @@ data class BackupChapter(
}
}
val backupChapterMapper = { _: Long, _: Long, url: String, name: String, scanlator: String?, read: Boolean, bookmark: Boolean, lastPageRead: Long, chapterNumber: Double, source_order: Long, dateFetch: Long, dateUpload: Long, lastModifiedAt: Long ->
val backupChapterMapper = {
_: Long,
_: Long,
url: String,
name: String,
scanlator: String?,
read: Boolean,
bookmark: Boolean,
lastPageRead: Long,
chapterNumber: Double,
sourceOrder: Long,
dateFetch: Long,
dateUpload: Long,
lastModifiedAt: Long,
->
BackupChapter(
url = url,
name = name,
@@ -50,7 +64,7 @@ val backupChapterMapper = { _: Long, _: Long, url: String, name: String, scanlat
lastPageRead = lastPageRead,
dateFetch = dateFetch,
dateUpload = dateUpload,
sourceOrder = source_order,
sourceOrder = sourceOrder,
lastModifiedAt = lastModifiedAt,
)
}

View File

@@ -54,7 +54,20 @@ data class BackupTracking(
}
val backupTrackMapper = {
_: Long, _: Long, syncId: Long, mediaId: Long, libraryId: Long?, title: String, lastChapterRead: Double, totalChapters: Long, status: Long, score: Double, remoteUrl: String, startDate: Long, finishDate: Long ->
_: Long,
_: Long,
syncId: Long,
mediaId: Long,
libraryId: Long?,
title: String,
lastChapterRead: Double,
totalChapters: Long,
status: Long,
score: Double,
remoteUrl: String,
startDate: Long,
finishDate: Long,
->
BackupTracking(
syncId = syncId.toInt(),
mediaId = mediaId,

View File

@@ -358,9 +358,8 @@ class DownloadCache(
// Folder of images
it.isDirectory -> it.name
// CBZ files
it.isFile && it.name?.endsWith(".cbz") == true -> it.name!!.substringBeforeLast(
".cbz",
)
it.isFile && it.name?.endsWith(".cbz") == true ->
it.name!!.substringBeforeLast(".cbz")
// Anything else is irrelevant
else -> null
}

View File

@@ -336,7 +336,9 @@ class LibraryUpdateNotifier(private val context: Context) {
if (shouldTruncate) {
// "Chapters 1, 2.5, 3, 4, 5 and 10 more"
val remaining = displayableChapterNumbers.size - NOTIF_MAX_CHAPTERS
val joinedChapterNumbers = displayableChapterNumbers.take(NOTIF_MAX_CHAPTERS).joinToString(", ")
val joinedChapterNumbers = displayableChapterNumbers
.take(NOTIF_MAX_CHAPTERS)
.joinToString(", ")
context.resources.getQuantityString(
R.plurals.notification_chapters_multiple_and_more,
remaining,
@@ -371,7 +373,8 @@ class LibraryUpdateNotifier(private val context: Context) {
}
companion object {
const val HELP_WARNING_URL = "https://tachiyomi.org/docs/faq/library#why-am-i-warned-about-large-bulk-updates-and-downloads"
const val HELP_WARNING_URL =
"https://tachiyomi.org/docs/faq/library#why-am-i-warned-about-large-bulk-updates-and-downloads"
}
}

View File

@@ -79,7 +79,11 @@ abstract class BaseTracker(
}
override suspend fun setRemoteLastChapterRead(track: Track, chapterNumber: Int) {
if (track.last_chapter_read == 0f && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) {
if (
track.last_chapter_read == 0f &&
track.last_chapter_read < chapterNumber &&
track.status != getRereadingStatus()
) {
track.status = getReadingStatus()
}
track.last_chapter_read = chapterNumber.toFloat()

View File

@@ -278,7 +278,9 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
"https://AWQO5J657S-dsn.algolia.net/1/indexes/production_media/query/"
private const val algoliaAppId = "AWQO5J657S"
private const val algoliaFilter =
"&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=%5B%22synopsis%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
"&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=" +
"%5B%22synopsis%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22" +
"posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
fun mangaUrl(remoteId: Long): String {
return baseMangaUrl + remoteId

View File

@@ -59,7 +59,8 @@ class ShikimoriApi(
).awaitSuccess()
.parseAs<JsonObject>()
.let {
track.library_id = it["id"]!!.jsonPrimitive.long // save id of the entry for possible future delete request
// save id of the entry for possible future delete request
track.library_id = it["id"]!!.jsonPrimitive.long
}
track
}