mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-27 16:26:29 +03:00
Use SharedFlow for available extensions to always emit the value (#7609)
- Fixes Extension screen being stuck refreshing due to StateFlow not emitting due to the value being the same
This commit is contained in:
parent
76057b84b2
commit
73901f50c0
1 changed files with 7 additions and 4 deletions
|
@ -19,8 +19,11 @@ import eu.kanade.tachiyomi.util.preference.plusAssign
|
|||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import logcat.LogPriority
|
||||
import rx.Observable
|
||||
|
@ -93,15 +96,15 @@ class ExtensionManager(
|
|||
var availableExtensions = emptyList<Extension.Available>()
|
||||
private set(value) {
|
||||
field = value
|
||||
availableExtensionsFlow.value = field
|
||||
availableExtensionsFlow.tryEmit(field)
|
||||
updatedInstalledExtensionsStatuses(value)
|
||||
setupAvailableExtensionsSourcesDataMap(value)
|
||||
}
|
||||
|
||||
private val availableExtensionsFlow = MutableStateFlow(availableExtensions)
|
||||
private val availableExtensionsFlow = MutableSharedFlow<List<Extension.Available>>(replay = 1)
|
||||
|
||||
fun getAvailableExtensionsFlow(): StateFlow<List<Extension.Available>> {
|
||||
return availableExtensionsFlow.asStateFlow()
|
||||
fun getAvailableExtensionsFlow(): Flow<List<Extension.Available>> {
|
||||
return availableExtensionsFlow.asSharedFlow()
|
||||
}
|
||||
|
||||
private var availableExtensionsSourcesData: Map<Long, SourceData> = mapOf()
|
||||
|
|
Loading…
Reference in a new issue