This commit is contained in:
tom5079
2020-09-04 07:51:55 +09:00
parent be64703d3c
commit 5ec67488eb
8 changed files with 44 additions and 34 deletions

View File

@@ -135,11 +135,11 @@ class Cache private constructor(context: Context, val galleryID: Int) : ContextW
suspend fun getThumbnail(): ByteArray? =
findFile(".thumbnail")?.readBytes()
?: getGalleryBlock()?.thumbnails?.firstOrNull()?.let { withContext(Dispatchers.IO) {
val request = Request.Builder()
.url(it)
.build()
kotlin.runCatching {
val request = Request.Builder()
.url(it)
.build()
client.newCall(request).execute().body()?.use { it.bytes() }
}.getOrNull()?.also { kotlin.run {
cacheFolder.getChild(".thumbnail").writeBytes(it)