Remove 1.x source models (#7781)
This commit is contained in:
@@ -7,7 +7,7 @@ import eu.kanade.domain.manga.model.isLocal
|
||||
import eu.kanade.domain.manga.model.toDbManga
|
||||
import eu.kanade.domain.manga.repository.MangaRepository
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
@@ -26,17 +26,18 @@ class UpdateManga(
|
||||
|
||||
suspend fun awaitUpdateFromSource(
|
||||
localManga: Manga,
|
||||
remoteManga: MangaInfo,
|
||||
remoteManga: SManga,
|
||||
manualFetch: Boolean,
|
||||
coverCache: CoverCache = Injekt.get(),
|
||||
): Boolean {
|
||||
// if the manga isn't a favorite, set its title from source and update in db
|
||||
val title = if (!localManga.favorite) remoteManga.title else null
|
||||
|
||||
// Never refresh covers if the url is empty to avoid "losing" existing covers
|
||||
val updateCover = remoteManga.cover.isNotEmpty() && (manualFetch || localManga.thumbnailUrl != remoteManga.cover)
|
||||
val coverLastModified = if (updateCover) {
|
||||
val coverLastModified =
|
||||
when {
|
||||
// Never refresh covers if the url is empty to avoid "losing" existing covers
|
||||
remoteManga.thumbnail_url.isNullOrEmpty() -> null
|
||||
!manualFetch && localManga.thumbnailUrl == remoteManga.thumbnail_url -> null
|
||||
localManga.isLocal() -> Date().time
|
||||
localManga.hasCustomCover(coverCache) -> {
|
||||
coverCache.deleteFromCache(localManga.toDbManga(), false)
|
||||
@@ -47,7 +48,6 @@ class UpdateManga(
|
||||
Date().time
|
||||
}
|
||||
}
|
||||
} else null
|
||||
|
||||
return mangaRepository.update(
|
||||
MangaUpdate(
|
||||
@@ -57,8 +57,8 @@ class UpdateManga(
|
||||
author = remoteManga.author,
|
||||
artist = remoteManga.artist,
|
||||
description = remoteManga.description,
|
||||
genre = remoteManga.genres,
|
||||
thumbnailUrl = remoteManga.cover.takeIf { it.isNotEmpty() },
|
||||
genre = remoteManga.getGenres(),
|
||||
thumbnailUrl = remoteManga.thumbnail_url?.takeIf { it.isNotEmpty() },
|
||||
status = remoteManga.status.toLong(),
|
||||
initialized = true,
|
||||
),
|
||||
|
||||
@@ -7,7 +7,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.Serializable
|
||||
@@ -184,17 +183,6 @@ fun Manga.toDbManga(): DbManga = MangaImpl().also {
|
||||
it.initialized = initialized
|
||||
}
|
||||
|
||||
fun Manga.toMangaInfo(): MangaInfo = MangaInfo(
|
||||
artist = artist ?: "",
|
||||
author = author ?: "",
|
||||
cover = thumbnailUrl ?: "",
|
||||
description = description ?: "",
|
||||
genres = genre ?: emptyList(),
|
||||
key = url,
|
||||
status = status.toInt(),
|
||||
title = title,
|
||||
)
|
||||
|
||||
fun Manga.toMangaUpdate(): MangaUpdate {
|
||||
return MangaUpdate(
|
||||
id = id,
|
||||
|
||||
Reference in New Issue
Block a user