mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
refactor(source/local): Invalidate cover on refresh instead
This commit is contained in:
parent
4f46d0ee28
commit
630e23cff7
5 changed files with 20 additions and 28 deletions
|
@ -9,15 +9,12 @@
|
|||
|
||||
## Other ?? Technical stuff, what happened behind the scene
|
||||
-->
|
||||
## Additions
|
||||
- Add button to local source's entry info editor to invalidate cover,
|
||||
in case Android messing it up (especially on heavily modified ROMs)
|
||||
|
||||
## Changes
|
||||
- Add more info to WorkerInfo page
|
||||
- Added "next scheduled run"
|
||||
- Added attempt count
|
||||
- `english` tag no longer cause reading mode to switch to LTR (mangkoran)
|
||||
- Local source manga's cover now being invalidated on refresh
|
||||
|
||||
## Fixes
|
||||
- Fixed auto backup, auto extension update, and app update checker stop working
|
||||
|
|
|
@ -226,11 +226,17 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
val legacyJsonFile = localMangaFiles.firstOrNull { it.extension.orEmpty().equals("json", true) }
|
||||
|
||||
if (comicInfoFile != null)
|
||||
return@withIOContext manga.copy().apply { setMangaDetailsFromComicInfoFile(comicInfoFile.openInputStream(), this) }
|
||||
return@withIOContext manga.copy().apply {
|
||||
setMangaDetailsFromComicInfoFile(comicInfoFile.openInputStream(), this)
|
||||
invalidateCover(manga)
|
||||
}
|
||||
|
||||
// TODO: Remove after awhile
|
||||
if (legacyJsonFile != null) {
|
||||
val rt = manga.copy().apply { setMangaDetailsFromLegacyJsonFile(legacyJsonFile.openInputStream(), this) }
|
||||
val rt = manga.copy().apply {
|
||||
setMangaDetailsFromLegacyJsonFile(legacyJsonFile.openInputStream(), this)
|
||||
invalidateCover(manga)
|
||||
}
|
||||
val comicInfo = rt.toComicInfo()
|
||||
localMangaDir.createFile(COMIC_INFO_FILE)
|
||||
?.writeText(xml.encodeToString(ComicInfo.serializer(), comicInfo)) { legacyJsonFile.delete() }
|
||||
|
|
|
@ -216,22 +216,14 @@ class EditMangaDialog : DialogController {
|
|||
true
|
||||
}
|
||||
|
||||
binding.resetCover.text = context.getString(
|
||||
if (isLocal) {
|
||||
MR.strings.invalidate_cover
|
||||
} else {
|
||||
MR.strings.reset_cover
|
||||
}
|
||||
)
|
||||
binding.resetCover.isVisible = !isLocal
|
||||
binding.resetCover.setOnClickListener {
|
||||
if (!isLocal) {
|
||||
binding.mangaCover.load(
|
||||
manga,
|
||||
) {
|
||||
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
||||
}
|
||||
customCoverUri = null
|
||||
binding.mangaCover.load(
|
||||
manga,
|
||||
) {
|
||||
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
||||
}
|
||||
customCoverUri = null
|
||||
willResetCover = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@ import coil3.request.SuccessResult
|
|||
import com.hippo.unifile.UniFile
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
|
@ -77,8 +81,6 @@ import yokai.domain.library.custom.model.CustomMangaInfo
|
|||
import yokai.domain.manga.interactor.UpdateManga
|
||||
import yokai.domain.manga.models.MangaUpdate
|
||||
import yokai.domain.storage.StorageManager
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
@ -852,11 +854,7 @@ class MangaDetailsPresenter(
|
|||
if (uri != null) {
|
||||
editCoverWithStream(uri)
|
||||
} else if (resetCover) {
|
||||
if (!manga.isLocal()) {
|
||||
coverCache.deleteCustomCover(manga)
|
||||
} else {
|
||||
LocalSource.invalidateCover(manga)
|
||||
}
|
||||
coverCache.deleteCustomCover(manga)
|
||||
view?.setPaletteColor()
|
||||
}
|
||||
view?.updateHeader()
|
||||
|
|
|
@ -553,7 +553,6 @@
|
|||
<string name="add_tag">Add tag</string>
|
||||
<string name="clear_tags">Clear tags</string>
|
||||
<string name="reset_tags">Reset tags</string>
|
||||
<string name="invalidate_cover">Invalidate cover</string>
|
||||
<string name="reset_cover">Reset cover</string>
|
||||
<string name="failed_to_update_cover">Failed to update cover</string>
|
||||
<string name="must_be_in_library_to_edit">Series must be in your library to edit</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue