Skip to content

Commit

Permalink
Lint and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AntsyLich committed Mar 9, 2024
1 parent f0d8cfd commit 581e528
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ private fun Manga.toBackupManga() =
updateStrategy = this.updateStrategy,
lastModifiedAt = this.lastModifiedAt,
favoriteModifiedAt = this.favoriteModifiedAt,
version = this.version
version = this.version,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import tachiyomi.domain.chapter.model.Chapter

@Suppress("MagicNumber")
@Serializable
data class BackupChapter(
// in 1.x some of these values have different names
Expand All @@ -21,7 +22,7 @@ data class BackupChapter(
@ProtoNumber(9) var chapterNumber: Float = 0F,
@ProtoNumber(10) var sourceOrder: Long = 0,
@ProtoNumber(11) var lastModifiedAt: Long = 0,
@ProtoNumber(12) var version: Long = 0
@ProtoNumber(12) var version: Long = 0,
) {
fun toChapterImpl(): Chapter {
return Chapter.create().copy(
Expand All @@ -36,7 +37,7 @@ data class BackupChapter(
dateUpload = this@BackupChapter.dateUpload,
sourceOrder = this@BackupChapter.sourceOrder,
lastModifiedAt = this@BackupChapter.lastModifiedAt,
version = this@BackupChapter.version
version = this@BackupChapter.version,
)
}
}
Expand All @@ -56,7 +57,7 @@ val backupChapterMapper = {
dateUpload: Long,
lastModifiedAt: Long,
version: Long,
_: Long
_: Long,
->
BackupChapter(
url = url,
Expand All @@ -70,6 +71,6 @@ val backupChapterMapper = {
dateUpload = dateUpload,
sourceOrder = sourceOrder,
lastModifiedAt = lastModifiedAt,
version = version
version = version,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import tachiyomi.domain.manga.model.Manga

@Suppress("DEPRECATION")
@Suppress(
"DEPRECATION",
"MagicNumber",
)
@Serializable
data class BackupManga(
// in 1.x some of these values have different names
Expand Down Expand Up @@ -39,7 +42,7 @@ data class BackupManga(
@ProtoNumber(106) var lastModifiedAt: Long = 0,
@ProtoNumber(107) var favoriteModifiedAt: Long? = null,
@ProtoNumber(108) var excludedScanlators: List<String> = emptyList(),
@ProtoNumber(109) var version: Long = 0
@ProtoNumber(109) var version: Long = 0,
) {
fun getMangaImpl(): Manga {
return Manga.create().copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class MangaRestorer(
mangaId = manga.id,
updateStrategy = manga.updateStrategy.let(UpdateStrategyColumnAdapter::encode),
version = manga.version,
isSyncing = 1
isSyncing = 1,
)
}
return manga
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ fun Chapter.toDomainChapter(): DomainChapter? {
chapterNumber = chapter_number.toDouble(),
scanlator = scanlator,
lastModifiedAt = last_modified,
version = version
version = version,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChapterRepositoryImpl(
chapter.sourceOrder,
chapter.dateFetch,
chapter.dateUpload,
chapter.version
chapter.version,
)
val lastInsertId = chaptersQueries.selectLastInsertedRowId().executeAsOne()
chapter.copy(id = lastInsertId)
Expand Down Expand Up @@ -127,6 +127,7 @@ class ChapterRepositoryImpl(
}
}

@Suppress("LongParameterList")
private fun mapChapter(
id: Long,
mangaId: Long,
Expand All @@ -142,6 +143,7 @@ class ChapterRepositoryImpl(
dateUpload: Long,
lastModifiedAt: Long,
version: Long,
@Suppress("UNUSED_PARAMETER")
isSyncing: Long,
): Chapter = Chapter(
id = id,
Expand All @@ -157,6 +159,6 @@ class ChapterRepositoryImpl(
chapterNumber = chapterNumber,
scanlator = scanlator,
lastModifiedAt = lastModifiedAt,
version = version
version = version,
)
}
5 changes: 4 additions & 1 deletion data/src/main/java/tachiyomi/data/manga/MangaMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.model.Manga

object MangaMapper {
@Suppress("LongParameterList")
fun mapManga(
id: Long,
source: Long,
Expand All @@ -29,6 +30,7 @@ object MangaMapper {
lastModifiedAt: Long,
favoriteModifiedAt: Long?,
version: Long,
@Suppress("UNUSED_PARAMETER")
isSyncing: Long,
): Manga = Manga(
id = id,
Expand All @@ -53,9 +55,10 @@ object MangaMapper {
initialized = initialized,
lastModifiedAt = lastModifiedAt,
favoriteModifiedAt = favoriteModifiedAt,
version = version
version = version,
)

@Suppress("LongParameterList")
fun mapLibraryManga(
id: Long,
source: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class Chapter(
val chapterNumber: Double,
val scanlator: String?,
val lastModifiedAt: Long,
val version: Long
val version: Long,
) {
val isRecognizedNumber: Boolean
get() = chapterNumber >= 0f
Expand Down Expand Up @@ -44,7 +44,7 @@ data class Chapter(
chapterNumber = -1.0,
scanlator = null,
lastModifiedAt = 0,
version = 1
version = 1,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data class ChapterUpdate(
val dateUpload: Long? = null,
val chapterNumber: Double? = null,
val scanlator: String? = null,
val version: Long? = null
val version: Long? = null,
)

fun Chapter.toChapterUpdate(): ChapterUpdate {
Expand All @@ -30,6 +30,6 @@ fun Chapter.toChapterUpdate(): ChapterUpdate {
dateUpload,
chapterNumber,
scanlator,
version
version,
)
}
5 changes: 2 additions & 3 deletions domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ data class Manga(
val initialized: Boolean,
val lastModifiedAt: Long,
val favoriteModifiedAt: Long?,
val version: Long

val version: Long,
) : Serializable {

val expectedNextUpdate: Instant?
Expand Down Expand Up @@ -124,7 +123,7 @@ data class Manga(
initialized = false,
lastModifiedAt = 0L,
favoriteModifiedAt = null,
version = 0L
version = 0L,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ fun Manga.toMangaUpdate(): MangaUpdate {
thumbnailUrl = thumbnailUrl,
updateStrategy = updateStrategy,
initialized = initialized,
version = version
version = version,
)
}

0 comments on commit 581e528

Please sign in to comment.