Display total chapters on duplicates list items (#1963)
(cherry picked from commit 12abd9938b7c235d6a1c02391624703476c1f339) # Conflicts: # CHANGELOG.md # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt # data/src/main/java/tachiyomi/data/manga/MangaMapper.kt
This commit is contained in:
@@ -3,6 +3,7 @@ package tachiyomi.data.manga
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import tachiyomi.domain.library.model.LibraryManga
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.manga.model.MangaWithChapterCount
|
||||
import tachiyomi.view.LibraryView
|
||||
|
||||
object MangaMapper {
|
||||
@@ -143,6 +144,71 @@ object MangaMapper {
|
||||
lastRead = lastRead,
|
||||
)
|
||||
|
||||
fun mapMangaWithChapterCount(
|
||||
id: Long,
|
||||
source: Long,
|
||||
url: String,
|
||||
artist: String?,
|
||||
author: String?,
|
||||
description: String?,
|
||||
genre: List<String>?,
|
||||
title: String,
|
||||
status: Long,
|
||||
thumbnailUrl: String?,
|
||||
favorite: Boolean,
|
||||
lastUpdate: Long?,
|
||||
nextUpdate: Long?,
|
||||
initialized: Boolean,
|
||||
viewerFlags: Long,
|
||||
chapterFlags: Long,
|
||||
coverLastModified: Long,
|
||||
dateAdded: Long,
|
||||
// SY -->
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
filteredScanlators: String?,
|
||||
// SY <--
|
||||
updateStrategy: UpdateStrategy,
|
||||
calculateInterval: Long,
|
||||
lastModifiedAt: Long,
|
||||
favoriteModifiedAt: Long?,
|
||||
version: Long,
|
||||
isSyncing: Long,
|
||||
notes: String,
|
||||
totalCount: Long,
|
||||
): MangaWithChapterCount = MangaWithChapterCount(
|
||||
manga = mapManga(
|
||||
id,
|
||||
source,
|
||||
url,
|
||||
artist,
|
||||
author,
|
||||
description,
|
||||
genre,
|
||||
title,
|
||||
status,
|
||||
thumbnailUrl,
|
||||
favorite,
|
||||
lastUpdate,
|
||||
nextUpdate,
|
||||
initialized,
|
||||
viewerFlags,
|
||||
chapterFlags,
|
||||
coverLastModified,
|
||||
dateAdded,
|
||||
// SY -->
|
||||
null,
|
||||
// SY <--
|
||||
updateStrategy,
|
||||
calculateInterval,
|
||||
lastModifiedAt,
|
||||
favoriteModifiedAt,
|
||||
version,
|
||||
isSyncing,
|
||||
notes,
|
||||
),
|
||||
chapterCount = totalCount,
|
||||
)
|
||||
|
||||
fun mapLibraryView(libraryView: LibraryView): LibraryManga {
|
||||
return LibraryManga(
|
||||
manga = Manga(
|
||||
|
||||
@@ -11,6 +11,7 @@ import tachiyomi.data.UpdateStrategyColumnAdapter
|
||||
import tachiyomi.domain.library.model.LibraryManga
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.manga.model.MangaUpdate
|
||||
import tachiyomi.domain.manga.model.MangaWithChapterCount
|
||||
import tachiyomi.domain.manga.repository.MangaRepository
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
@@ -73,9 +74,9 @@ class MangaRepositoryImpl(
|
||||
return handler.subscribeToList { mangasQueries.getFavoriteBySourceId(sourceId, MangaMapper::mapManga) }
|
||||
}
|
||||
|
||||
override suspend fun getDuplicateLibraryManga(id: Long, title: String): List<Manga> {
|
||||
override suspend fun getDuplicateLibraryManga(id: Long, title: String): List<MangaWithChapterCount> {
|
||||
return handler.awaitList {
|
||||
mangasQueries.getDuplicateLibraryManga(title, id, MangaMapper::mapManga)
|
||||
mangasQueries.getDuplicateLibraryManga(id, title, MangaMapper::mapMangaWithChapterCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user