fix: Use collect instead of collectLatest

This commit is contained in:
Ahmad Ansori Palembani 2024-12-14 09:29:28 +07:00
parent 16316d810b
commit d61052485f
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 3 additions and 5 deletions

View file

@ -135,7 +135,6 @@ import kotlin.math.roundToInt
import kotlin.random.Random
import kotlin.random.nextInt
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
@ -616,9 +615,9 @@ open class LibraryController(
setPreferenceFlows()
LibraryUpdateJob.updateFlow.onEach(::onUpdateManga).launchIn(viewScope)
viewScope.launchUI {
LibraryUpdateJob.isRunningFlow(view.context).collectLatest {
LibraryUpdateJob.isRunningFlow(view.context).collect {
val holder = if (mAdapter != null) visibleHeaderHolder() else null
val category = holder?.category ?: return@collectLatest
val category = holder?.category ?: return@collect
holder.notifyStatus(LibraryUpdateJob.categoryInQueue(category.id), category)
}
}

View file

@ -92,7 +92,6 @@ import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.LinearLayoutManagerAccurateOffset
import java.util.Locale
import kotlin.math.max
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import yokai.i18n.MR
import yokai.util.lang.getString
@ -390,7 +389,7 @@ class RecentsController(bundle: Bundle? = null) :
},
)
viewScope.launch {
LibraryUpdateJob.isRunningFlow(view.context).collectLatest {
LibraryUpdateJob.isRunningFlow(view.context).collect {
binding.swipeRefresh.isRefreshing = it
}
}