mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 02:34:39 +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
|
## 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
|
## Changes
|
||||||
- Add more info to WorkerInfo page
|
- Add more info to WorkerInfo page
|
||||||
- Added "next scheduled run"
|
- Added "next scheduled run"
|
||||||
- Added attempt count
|
- Added attempt count
|
||||||
- `english` tag no longer cause reading mode to switch to LTR (mangkoran)
|
- `english` tag no longer cause reading mode to switch to LTR (mangkoran)
|
||||||
|
- Local source manga's cover now being invalidated on refresh
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
- Fixed auto backup, auto extension update, and app update checker stop working
|
- 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) }
|
val legacyJsonFile = localMangaFiles.firstOrNull { it.extension.orEmpty().equals("json", true) }
|
||||||
|
|
||||||
if (comicInfoFile != null)
|
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
|
// TODO: Remove after awhile
|
||||||
if (legacyJsonFile != null) {
|
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()
|
val comicInfo = rt.toComicInfo()
|
||||||
localMangaDir.createFile(COMIC_INFO_FILE)
|
localMangaDir.createFile(COMIC_INFO_FILE)
|
||||||
?.writeText(xml.encodeToString(ComicInfo.serializer(), comicInfo)) { legacyJsonFile.delete() }
|
?.writeText(xml.encodeToString(ComicInfo.serializer(), comicInfo)) { legacyJsonFile.delete() }
|
||||||
|
|
|
@ -216,22 +216,14 @@ class EditMangaDialog : DialogController {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.resetCover.text = context.getString(
|
binding.resetCover.isVisible = !isLocal
|
||||||
if (isLocal) {
|
|
||||||
MR.strings.invalidate_cover
|
|
||||||
} else {
|
|
||||||
MR.strings.reset_cover
|
|
||||||
}
|
|
||||||
)
|
|
||||||
binding.resetCover.setOnClickListener {
|
binding.resetCover.setOnClickListener {
|
||||||
if (!isLocal) {
|
|
||||||
binding.mangaCover.load(
|
binding.mangaCover.load(
|
||||||
manga,
|
manga,
|
||||||
) {
|
) {
|
||||||
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
||||||
}
|
}
|
||||||
customCoverUri = null
|
customCoverUri = null
|
||||||
}
|
|
||||||
willResetCover = true
|
willResetCover = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ import coil3.request.SuccessResult
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
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.cache.CoverCache
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
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.interactor.UpdateManga
|
||||||
import yokai.domain.manga.models.MangaUpdate
|
import yokai.domain.manga.models.MangaUpdate
|
||||||
import yokai.domain.storage.StorageManager
|
import yokai.domain.storage.StorageManager
|
||||||
import yokai.i18n.MR
|
|
||||||
import yokai.util.lang.getString
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
@ -852,11 +854,7 @@ class MangaDetailsPresenter(
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
editCoverWithStream(uri)
|
editCoverWithStream(uri)
|
||||||
} else if (resetCover) {
|
} else if (resetCover) {
|
||||||
if (!manga.isLocal()) {
|
|
||||||
coverCache.deleteCustomCover(manga)
|
coverCache.deleteCustomCover(manga)
|
||||||
} else {
|
|
||||||
LocalSource.invalidateCover(manga)
|
|
||||||
}
|
|
||||||
view?.setPaletteColor()
|
view?.setPaletteColor()
|
||||||
}
|
}
|
||||||
view?.updateHeader()
|
view?.updateHeader()
|
||||||
|
|
|
@ -553,7 +553,6 @@
|
||||||
<string name="add_tag">Add tag</string>
|
<string name="add_tag">Add tag</string>
|
||||||
<string name="clear_tags">Clear tags</string>
|
<string name="clear_tags">Clear tags</string>
|
||||||
<string name="reset_tags">Reset 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="reset_cover">Reset cover</string>
|
||||||
<string name="failed_to_update_cover">Failed to update 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>
|
<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