mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Remove any mention of MangaJson outside CustomMangaManager
This commit is contained in:
parent
2283c7d5a8
commit
017ebe2f26
4 changed files with 53 additions and 28 deletions
|
@ -93,30 +93,14 @@ data class BackupManga(
|
|||
customGenre != null ||
|
||||
customStatus != 0
|
||||
) {
|
||||
return CustomMangaManager.ComicList.ComicInfoYokai(
|
||||
return CustomMangaManager.ComicList.ComicInfoYokai.create(
|
||||
id = 0L,
|
||||
value = ComicInfo(
|
||||
title = null,
|
||||
series = customTitle?.let { ComicInfo.Series(it) },
|
||||
number = null,
|
||||
writer = customAuthor?.let { ComicInfo.Writer(it) },
|
||||
penciller = customArtist?.let { ComicInfo.Penciller(it) },
|
||||
inker = null,
|
||||
colorist = null,
|
||||
letterer = null,
|
||||
coverArtist = null,
|
||||
translator = null,
|
||||
summary = customDescription?.let { ComicInfo.Summary(it) },
|
||||
genre = customGenre?.joinToString(", ")?.let { ComicInfo.Genre(it) },
|
||||
tags = null,
|
||||
web = null,
|
||||
publishingStatus = customStatus.takeUnless { it == 0 }?.let { ComicInfo.PublishingStatusTachiyomi(
|
||||
ComicInfoPublishingStatus.toComicInfoValue(status.toLong())
|
||||
) },
|
||||
categories = null,
|
||||
source = null,
|
||||
language = null,
|
||||
)
|
||||
title = customTitle,
|
||||
author = customAuthor,
|
||||
artist = customArtist,
|
||||
description = customDescription,
|
||||
genre = customGenre?.toTypedArray(),
|
||||
status = customStatus,
|
||||
)
|
||||
}
|
||||
return null
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import com.hippo.unifile.UniFile
|
||||
import dev.yokai.core.metadata.COMIC_INFO_EDITS_FILE
|
||||
import dev.yokai.core.metadata.ComicInfo
|
||||
import dev.yokai.core.metadata.ComicInfoPublishingStatus
|
||||
import dev.yokai.core.metadata.copyFromComicInfo
|
||||
import dev.yokai.core.metadata.toComicInfo
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
|
@ -177,7 +178,47 @@ class CustomMangaManager(val context: Context) {
|
|||
data class ComicInfoYokai(
|
||||
@XmlValue(true) val value: ComicInfo,
|
||||
var id: Long? = null,
|
||||
)
|
||||
) {
|
||||
companion object {
|
||||
fun create(
|
||||
id: Long? = null,
|
||||
title: String? = null,
|
||||
author: String? = null,
|
||||
artist: String? = null,
|
||||
description: String? = null,
|
||||
genre: Array<String>? = null,
|
||||
status: Int? = null,
|
||||
): ComicInfoYokai {
|
||||
return ComicInfoYokai(
|
||||
id = id,
|
||||
value = ComicInfo(
|
||||
title = null,
|
||||
series = title?.let { ComicInfo.Series(it) },
|
||||
number = null,
|
||||
writer = author?.let { ComicInfo.Writer(it) },
|
||||
penciller = artist?.let { ComicInfo.Penciller(it) },
|
||||
inker = null,
|
||||
colorist = null,
|
||||
letterer = null,
|
||||
coverArtist = null,
|
||||
translator = null,
|
||||
summary = description?.let { ComicInfo.Summary(it) },
|
||||
genre = genre?.joinToString(", ")?.let { ComicInfo.Genre(it) },
|
||||
tags = null,
|
||||
web = null,
|
||||
publishingStatus = status.takeUnless { it == 0 }?.let {
|
||||
ComicInfo.PublishingStatusTachiyomi(
|
||||
ComicInfoPublishingStatus.toComicInfoValue(it.toLong())
|
||||
)
|
||||
},
|
||||
categories = null,
|
||||
source = null,
|
||||
language = null,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun mangaFromComicInfoObject(id: Long, comicInfo: ComicInfo) = MangaImpl().apply {
|
||||
|
|
|
@ -246,7 +246,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
|
||||
lang?.let { langMap[manga.url] = it }
|
||||
val file = directory.createFile(COMIC_INFO_FILE)!!
|
||||
file.writeText(xml.encodeToString(ComicInfo.serializer(), manga.toComicInfo(lang)))
|
||||
file.writeText(xml.encodeToString(ComicInfo.serializer(), manga.toComicInfo(lang = lang)))
|
||||
}
|
||||
|
||||
@Serializable
|
||||
|
|
|
@ -712,7 +712,7 @@ class MangaDetailsPresenter(
|
|||
fun confirmDeletion() {
|
||||
launchIO {
|
||||
coverCache.deleteFromCache(manga)
|
||||
customMangaManager.saveMangaInfo(CustomMangaManager.MangaJson(manga.id!!))
|
||||
customMangaManager.saveMangaInfo(CustomMangaManager.ComicList.ComicInfoYokai.create(manga.id!!))
|
||||
downloadManager.deleteManga(manga, source)
|
||||
asyncUpdateMangaAndChapters(true)
|
||||
}
|
||||
|
@ -797,8 +797,8 @@ class MangaDetailsPresenter(
|
|||
manga.viewer_flags = -1
|
||||
db.updateViewerFlags(manga).executeAsBlocking()
|
||||
}
|
||||
val manga = CustomMangaManager.MangaJson(
|
||||
manga.id!!,
|
||||
val manga = CustomMangaManager.ComicList.ComicInfoYokai.create(
|
||||
id = manga.id!!,
|
||||
title?.trimOrNull(),
|
||||
author?.trimOrNull(),
|
||||
artist?.trimOrNull(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue