fix: Just wrap it with if statement

The last fix somehow reverted the other fix, awesome!
This commit is contained in:
Ahmad Ansori Palembani 2024-06-17 19:46:36 +07:00
parent d5651573b0
commit 8f07c2d99a
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 19 additions and 33 deletions

View file

@ -12,11 +12,6 @@ import eu.kanade.tachiyomi.ui.reader.settings.ReadingModeType
import eu.kanade.tachiyomi.util.manga.MangaCoverMetadata
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import yokai.data.manga.originalArtist
import yokai.data.manga.originalAuthor
import yokai.data.manga.originalDescription
import yokai.data.manga.originalGenre
import yokai.data.manga.originalStatus
import java.util.*
// TODO: Transform into data class
@ -58,18 +53,26 @@ interface Manga : SManga {
author?.contains(artist ?: "", true) == true
fun copyFrom(other: SManga) {
author = other.originalAuthor ?: author
artist = other.originalArtist ?: artist
description = other.originalDescription ?: description
genre = other.originalGenre ?: genre
status = other.originalStatus
thumbnail_url = other.thumbnail_url ?: thumbnail_url
if (other.author != null) {
author = if (other is Manga) other.originalAuthor else other.author
}
if (other.artist != null) {
artist = if (other is Manga) other.originalArtist else other.artist
}
if (other.description != null) {
description = if (other is Manga) other.originalDescription else other.description
}
if (other.genre != null) {
genre = if (other is Manga) other.originalGenre else other.genre
}
status = if (other is Manga) other.originalStatus else other.status
update_strategy = other.update_strategy
if (!initialized) {

View file

@ -1,17 +0,0 @@
package yokai.data.manga
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.source.model.SManga
val SManga.originalTitle: String
get() = (this as? MangaImpl)?.ogTitle ?: title
val SManga.originalAuthor: String?
get() = (this as? MangaImpl)?.ogAuthor ?: author
val SManga.originalArtist: String?
get() = (this as? MangaImpl)?.ogArtist ?: artist
val SManga.originalDescription: String?
get() = (this as? MangaImpl)?.ogDesc ?: description
val SManga.originalGenre: String?
get() = (this as? MangaImpl)?.ogGenre ?: genre
val SManga.originalStatus: Int
get() = (this as? MangaImpl)?.ogStatus ?: status