ExtensionsPresenter: Use StateFlow for extensions list (#8017)

This commit is contained in:
Ivan Iskandar 2022-09-16 19:35:15 +07:00 committed by GitHub
parent ec30026333
commit f54adb49a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import rx.Observable import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -77,7 +78,7 @@ class ExtensionsPresenter(
presenterScope.launchIO { presenterScope.launchIO {
combine( combine(
_query, _query,
getExtensions.subscribe(), getExtensions.subscribe().stateIn(presenterScope),
_currentDownloads, _currentDownloads,
) { query, (_updates, _installed, _available, _untrusted), downloads -> ) { query, (_updates, _installed, _available, _untrusted), downloads ->
val searchQuery = query ?: "" val searchQuery = query ?: ""