Bump dependencies

(cherry picked from commit 1a1f16f44aba242a52aed628ddd38bc2793ca406)

# Conflicts:
#	gradle/kotlinx.versions.toml
This commit is contained in:
arkon
2023-05-31 22:48:13 -04:00
committed by Jobobby04
parent 7c9398f9d5
commit b42f1f2df8
5 changed files with 16 additions and 9 deletions
+1
View File
@@ -221,6 +221,7 @@ dependencies {
implementation(libs.injekt.core)
// Image loading
implementation(platform(libs.coil.bom))
implementation(libs.bundles.coil)
implementation(libs.subsamplingscaleimageview) {
exclude(module = "image-decoder")
@@ -222,18 +222,22 @@ class MangaCoverFetcher(
}
private fun readFromDiskCache(): DiskCache.Snapshot? {
return if (options.diskCachePolicy.readEnabled) diskCacheLazy.value[diskCacheKey] else null
return if (options.diskCachePolicy.readEnabled) {
diskCacheLazy.value.openSnapshot(diskCacheKey)
} else {
null
}
}
private fun writeToDiskCache(
response: Response,
): DiskCache.Snapshot? {
val editor = diskCacheLazy.value.edit(diskCacheKey) ?: return null
val editor = diskCacheLazy.value.openEditor(diskCacheKey) ?: return null
try {
diskCacheLazy.value.fileSystem.write(editor.data) {
response.body.source().readAll(this)
}
return editor.commitAndGet()
return editor.commitAndOpenSnapshot()
} catch (e: Exception) {
try {
editor.abort()