From f2f809f35ddaff5c96e43dcf8a6392abfdac8b9b Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:16:46 +0500 Subject: [PATCH] Gmanga Multisrc: make cover nullable (#1854) * Gmanga Multisrc: make cover nullable * filter empty alt titles --- lib-multisrc/gmanga/build.gradle.kts | 2 +- .../src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib-multisrc/gmanga/build.gradle.kts b/lib-multisrc/gmanga/build.gradle.kts index dc076cc37..9dce2478c 100644 --- a/lib-multisrc/gmanga/build.gradle.kts +++ b/lib-multisrc/gmanga/build.gradle.kts @@ -2,4 +2,4 @@ plugins { id("lib-multisrc") } -baseVersionCode = 1 +baseVersionCode = 2 diff --git a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt index 3a0943c62..f0822db3d 100644 --- a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt +++ b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt @@ -29,12 +29,12 @@ class SearchMangaDto( class BrowseManga( private val id: Int, private val title: String, - private val cover: String, + private val cover: String? = null, ) { fun toSManga(createThumbnail: (String, String) -> String) = SManga.create().apply { url = "/mangas/$id" title = this@BrowseManga.title - thumbnail_url = createThumbnail(id.toString(), cover) + thumbnail_url = cover?.let { createThumbnail(id.toString(), cover) } } } @@ -58,7 +58,7 @@ class MangaDetailsDto( @Serializable class Manga( private val id: Int, - private val cover: String, + private val cover: String? = null, private val title: String, private val summary: String? = null, private val artists: List, @@ -74,7 +74,7 @@ class Manga( ) { fun toSManga(createThumbnail: (String, String) -> String) = SManga.create().apply { title = this@Manga.title - thumbnail_url = createThumbnail(id.toString(), cover) + thumbnail_url = cover?.let { createThumbnail(id.toString(), cover) } artist = artists.joinToString { it.name } author = authors.joinToString { it.name } status = when (this@Manga.status) { @@ -105,6 +105,8 @@ class Manga( } val titles = listOfNotNull(synonyms, arTitle, jpTitle, enTitle) + .filterNot(String::isEmpty) + if (titles.isNotEmpty()) { append("\n\n") append("مسميّات أخرى")