From 0f7e9bec7d24f654b8fbc20f0b443cc03c9bd538 Mon Sep 17 00:00:00 2001 From: Cologler Date: Sun, 7 Apr 2024 22:31:30 +0800 Subject: [PATCH] fix: detekt warnings --- .../create/creators/MangaBackupCreator.kt | 13 +++++--- .../data/backup/models/BackupTracking.kt | 31 ++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt index 1cf55a351f..04b33e828a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/creators/MangaBackupCreator.kt @@ -29,16 +29,21 @@ class MangaBackupCreator( handler.awaitList { manga_syncQueries.getTracks(backupTrackMapper) }.groupBy({ x -> x.first }, { x -> x.second }) - } else null + } else { + null + } return mangas.map { backupManga(it, options, categoriesMap, trackingMap) } } - private suspend fun backupManga(manga: Manga, options: BackupOptions, - categoriesMap: Map>?, - trackingMap: Map>?): BackupManga { + private suspend fun backupManga( + manga: Manga, + options: BackupOptions, + categoriesMap: Map>?, + trackingMap: Map>? + ): BackupManga { // Entry for this manga val mangaObject = manga.toBackupManga() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt index 0735ecaf02..f25a4ec4ce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt @@ -67,18 +67,21 @@ val backupTrackMapper = { startDate: Long, finishDate: Long, -> - Pair(mangaId, BackupTracking( - syncId = syncId.toInt(), - mediaId = mediaId, - // forced not null so its compatible with 1.x backup system - libraryId = libraryId ?: 0, - title = title, - lastChapterRead = lastChapterRead.toFloat(), - totalChapters = totalChapters.toInt(), - score = score.toFloat(), - status = status.toInt(), - startedReadingDate = startDate, - finishedReadingDate = finishDate, - trackingUrl = remoteUrl, - )) + Pair( + mangaId, + BackupTracking( + syncId = syncId.toInt(), + mediaId = mediaId, + // forced not null so its compatible with 1.x backup system + libraryId = libraryId ?: 0, + title = title, + lastChapterRead = lastChapterRead.toFloat(), + totalChapters = totalChapters.toInt(), + score = score.toFloat(), + status = status.toInt(), + startedReadingDate = startDate, + finishedReadingDate = finishDate, + trackingUrl = remoteUrl, + ) + ) }