mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Use collect instead of collectLatest
This commit is contained in:
parent
16316d810b
commit
d61052485f
2 changed files with 3 additions and 5 deletions
|
@ -135,7 +135,6 @@ import kotlin.math.roundToInt
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.random.nextInt
|
import kotlin.random.nextInt
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
|
||||||
import kotlinx.coroutines.flow.drop
|
import kotlinx.coroutines.flow.drop
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
|
@ -616,9 +615,9 @@ open class LibraryController(
|
||||||
setPreferenceFlows()
|
setPreferenceFlows()
|
||||||
LibraryUpdateJob.updateFlow.onEach(::onUpdateManga).launchIn(viewScope)
|
LibraryUpdateJob.updateFlow.onEach(::onUpdateManga).launchIn(viewScope)
|
||||||
viewScope.launchUI {
|
viewScope.launchUI {
|
||||||
LibraryUpdateJob.isRunningFlow(view.context).collectLatest {
|
LibraryUpdateJob.isRunningFlow(view.context).collect {
|
||||||
val holder = if (mAdapter != null) visibleHeaderHolder() else null
|
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)
|
holder.notifyStatus(LibraryUpdateJob.categoryInQueue(category.id), category)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@ import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.widget.LinearLayoutManagerAccurateOffset
|
import eu.kanade.tachiyomi.widget.LinearLayoutManagerAccurateOffset
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import yokai.i18n.MR
|
import yokai.i18n.MR
|
||||||
import yokai.util.lang.getString
|
import yokai.util.lang.getString
|
||||||
|
@ -390,7 +389,7 @@ class RecentsController(bundle: Bundle? = null) :
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
viewScope.launch {
|
viewScope.launch {
|
||||||
LibraryUpdateJob.isRunningFlow(view.context).collectLatest {
|
LibraryUpdateJob.isRunningFlow(view.context).collect {
|
||||||
binding.swipeRefresh.isRefreshing = it
|
binding.swipeRefresh.isRefreshing = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue