fix(LocalSource): Url is not initialized

This commit is contained in:
Ahmad Ansori Palembani 2024-05-29 10:17:48 +07:00
parent 0846e48d6a
commit 683c6a4a21
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 8 additions and 3 deletions

View file

@ -198,11 +198,17 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
val legacyJsonFile = localMangaFiles.firstOrNull { it.extension.orEmpty().equals("json", true) }
if (comicInfoFile != null)
return SManga.create().apply { setMangaDetailsFromComicInfoFile(comicInfoFile.openInputStream(), this) }
return SManga.create().apply {
url = manga.url
setMangaDetailsFromComicInfoFile(comicInfoFile.openInputStream(), this)
}
// TODO: Remove after awhile
if (legacyJsonFile != null) {
val rt = SManga.create().apply { setMangaDetailsFromLegacyJsonFile(legacyJsonFile.openInputStream(), this) }
val rt = SManga.create().apply {
url = manga.url
setMangaDetailsFromLegacyJsonFile(legacyJsonFile.openInputStream(), this)
}
val comicInfo = rt.toComicInfo()
localMangaDir.createFile(COMIC_INFO_FILE)
?.writeText(xml.encodeToString(ComicInfo.serializer(), comicInfo)) { legacyJsonFile.delete() }

View file

@ -783,7 +783,6 @@ class MangaDetailsPresenter(
db.updateViewerFlags(manga).executeAsBlocking()
}
manga.status = status ?: SManga.UNKNOWN
// TODO: Use ComicInfo
LocalSource(downloadManager.context).updateMangaInfo(manga, lang)
db.updateMangaInfo(manga).executeAsBlocking()
} else {