fixed cleanup() deleting .cache

fixed empty tag showing up
This commit is contained in:
tom5079
2021-01-18 22:17:48 +09:00
parent 2f16838e1e
commit 4aea7d08ce
2 changed files with 4 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ class SearchResultsAdapter(private val results: List<ItemInfo>) : RecyclerSwipeA
CoroutineScope(Dispatchers.Main).launch {
with (binding.tagGroup) {
tags.clear()
result.extra[ItemInfo.ExtraType.TAGS]?.await()?.split(", ")?.map {
result.extra[ItemInfo.ExtraType.TAGS]?.await()?.split(", ")?.let { if (it.size == 1 && it.first().isEmpty()) emptyList() else it }?.map {
Tag.parse(it)
}?.let { tags.addAll(it) }
refresh()

View File

@@ -19,12 +19,12 @@
package xyz.quaver.pupil.util
import android.content.Context
import android.util.Log
import com.google.firebase.crashlytics.FirebaseCrashlytics
import kotlinx.coroutines.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.sendBlocking
import kotlinx.coroutines.coroutineScope
import okhttp3.*
import org.kodein.di.DIAware
import org.kodein.di.android.di
@@ -50,7 +50,7 @@ class ImageCache(context: Context) : DIAware {
suspend fun cleanup() = coroutineScope {
val LIMIT = 100*1024*1024
cacheFolder.listFiles { it -> it.canonicalPath !in cache.values }?.forEach { it.delete() }
cacheFolder.listFiles { it -> it.canonicalPath !in cache.values || it.name == ".cache" }?.forEach { it.delete() }
if (cacheFolder.size() > LIMIT)
do {