|
@@ -4,120 +4,116 @@ import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
|
|
import tachiyomi.domain.library.model.LibraryManga
|
|
|
import tachiyomi.domain.manga.model.Manga
|
|
|
|
|
|
-val mangaMapper: (
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- String,
|
|
|
- String?,
|
|
|
- String?,
|
|
|
- String?,
|
|
|
- List<String>?,
|
|
|
- String,
|
|
|
- Long,
|
|
|
- String?,
|
|
|
- Boolean,
|
|
|
- Long?,
|
|
|
- Long?,
|
|
|
- Boolean,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- UpdateStrategy,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long?,
|
|
|
-) -> Manga =
|
|
|
- { id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, nextUpdate, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, calculateInterval, lastModifiedAt, favoriteModifiedAt ->
|
|
|
- Manga(
|
|
|
- id = id,
|
|
|
- source = source,
|
|
|
- favorite = favorite,
|
|
|
- lastUpdate = lastUpdate ?: 0,
|
|
|
- nextUpdate = nextUpdate ?: 0,
|
|
|
- fetchInterval = calculateInterval.toInt(),
|
|
|
- dateAdded = dateAdded,
|
|
|
- viewerFlags = viewerFlags,
|
|
|
- chapterFlags = chapterFlags,
|
|
|
- coverLastModified = coverLastModified,
|
|
|
- url = url,
|
|
|
- title = title,
|
|
|
- artist = artist,
|
|
|
- author = author,
|
|
|
- description = description,
|
|
|
- genre = genre,
|
|
|
- status = status,
|
|
|
- thumbnailUrl = thumbnailUrl,
|
|
|
- updateStrategy = updateStrategy,
|
|
|
- initialized = initialized,
|
|
|
- lastModifiedAt = lastModifiedAt,
|
|
|
- favoriteModifiedAt = favoriteModifiedAt,
|
|
|
- )
|
|
|
- }
|
|
|
+object MangaMapper {
|
|
|
+ fun mapManga(
|
|
|
+ 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,
|
|
|
+ updateStrategy: UpdateStrategy,
|
|
|
+ calculateInterval: Long,
|
|
|
+ lastModifiedAt: Long,
|
|
|
+ favoriteModifiedAt: Long?,
|
|
|
+ ): Manga = Manga(
|
|
|
+ id = id,
|
|
|
+ source = source,
|
|
|
+ favorite = favorite,
|
|
|
+ lastUpdate = lastUpdate ?: 0,
|
|
|
+ nextUpdate = nextUpdate ?: 0,
|
|
|
+ fetchInterval = calculateInterval.toInt(),
|
|
|
+ dateAdded = dateAdded,
|
|
|
+ viewerFlags = viewerFlags,
|
|
|
+ chapterFlags = chapterFlags,
|
|
|
+ coverLastModified = coverLastModified,
|
|
|
+ url = url,
|
|
|
+ title = title,
|
|
|
+ artist = artist,
|
|
|
+ author = author,
|
|
|
+ description = description,
|
|
|
+ genre = genre,
|
|
|
+ status = status,
|
|
|
+ thumbnailUrl = thumbnailUrl,
|
|
|
+ updateStrategy = updateStrategy,
|
|
|
+ initialized = initialized,
|
|
|
+ lastModifiedAt = lastModifiedAt,
|
|
|
+ favoriteModifiedAt = favoriteModifiedAt,
|
|
|
+ )
|
|
|
|
|
|
-val libraryManga: (
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- String,
|
|
|
- String?,
|
|
|
- String?,
|
|
|
- String?,
|
|
|
- List<String>?,
|
|
|
- String,
|
|
|
- Long,
|
|
|
- String?,
|
|
|
- Boolean,
|
|
|
- Long?,
|
|
|
- Long?,
|
|
|
- Boolean,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- UpdateStrategy,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long?,
|
|
|
- Long,
|
|
|
- Double,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Long,
|
|
|
- Double,
|
|
|
- Long,
|
|
|
-) -> LibraryManga =
|
|
|
- { id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, nextUpdate, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, calculateInterval, lastModifiedAt, favoriteModifiedAt, totalCount, readCount, latestUpload, chapterFetchedAt, lastRead, bookmarkCount, category ->
|
|
|
- LibraryManga(
|
|
|
- manga = mangaMapper(
|
|
|
- id,
|
|
|
- source,
|
|
|
- url,
|
|
|
- artist,
|
|
|
- author,
|
|
|
- description,
|
|
|
- genre,
|
|
|
- title,
|
|
|
- status,
|
|
|
- thumbnailUrl,
|
|
|
- favorite,
|
|
|
- lastUpdate,
|
|
|
- nextUpdate,
|
|
|
- initialized,
|
|
|
- viewerFlags,
|
|
|
- chapterFlags,
|
|
|
- coverLastModified,
|
|
|
- dateAdded,
|
|
|
- updateStrategy,
|
|
|
- calculateInterval,
|
|
|
- lastModifiedAt,
|
|
|
- favoriteModifiedAt,
|
|
|
- ),
|
|
|
- category = category,
|
|
|
- totalChapters = totalCount,
|
|
|
- readCount = readCount.toLong(),
|
|
|
- bookmarkCount = bookmarkCount.toLong(),
|
|
|
- latestUpload = latestUpload,
|
|
|
- chapterFetchedAt = chapterFetchedAt,
|
|
|
- lastRead = lastRead,
|
|
|
- )
|
|
|
- }
|
|
|
+ fun mapLibraryManga(
|
|
|
+ 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,
|
|
|
+ updateStrategy: UpdateStrategy,
|
|
|
+ calculateInterval: Long,
|
|
|
+ lastModifiedAt: Long,
|
|
|
+ favoriteModifiedAt: Long?,
|
|
|
+ totalCount: Long,
|
|
|
+ readCount: Double,
|
|
|
+ latestUpload: Long,
|
|
|
+ chapterFetchedAt: Long,
|
|
|
+ lastRead: Long,
|
|
|
+ bookmarkCount: Double,
|
|
|
+ category: Long,
|
|
|
+ ): LibraryManga = LibraryManga(
|
|
|
+ manga = mapManga(
|
|
|
+ id,
|
|
|
+ source,
|
|
|
+ url,
|
|
|
+ artist,
|
|
|
+ author,
|
|
|
+ description,
|
|
|
+ genre,
|
|
|
+ title,
|
|
|
+ status,
|
|
|
+ thumbnailUrl,
|
|
|
+ favorite,
|
|
|
+ lastUpdate,
|
|
|
+ nextUpdate,
|
|
|
+ initialized,
|
|
|
+ viewerFlags,
|
|
|
+ chapterFlags,
|
|
|
+ coverLastModified,
|
|
|
+ dateAdded,
|
|
|
+ updateStrategy,
|
|
|
+ calculateInterval,
|
|
|
+ lastModifiedAt,
|
|
|
+ favoriteModifiedAt,
|
|
|
+ ),
|
|
|
+ category = category,
|
|
|
+ totalChapters = totalCount,
|
|
|
+ readCount = readCount.toLong(),
|
|
|
+ bookmarkCount = bookmarkCount.toLong(),
|
|
|
+ latestUpload = latestUpload,
|
|
|
+ chapterFetchedAt = chapterFetchedAt,
|
|
|
+ lastRead = lastRead,
|
|
|
+ )
|
|
|
+}
|