Adds onStart calculator for live bubble authors
This commit is contained in:
+7
@@ -38,6 +38,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.flowOn
|
import kotlinx.coroutines.flow.flowOn
|
||||||
import kotlinx.coroutines.flow.mapLatest
|
import kotlinx.coroutines.flow.mapLatest
|
||||||
|
import kotlinx.coroutines.flow.onStart
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun observeChannel(baseChannel: Channel): State<ChannelState?> {
|
fun observeChannel(baseChannel: Channel): State<ChannelState?> {
|
||||||
@@ -49,6 +50,7 @@ fun observeChannel(baseChannel: Channel): State<ChannelState?> {
|
|||||||
.collectAsStateWithLifecycle()
|
.collectAsStateWithLifecycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun observeChannelNoteAuthors(baseChannel: Channel): State<ImmutableList<User>> {
|
fun observeChannelNoteAuthors(baseChannel: Channel): State<ImmutableList<User>> {
|
||||||
ChannelFinderFilterAssemblerSubscription(baseChannel)
|
ChannelFinderFilterAssemblerSubscription(baseChannel)
|
||||||
@@ -64,6 +66,11 @@ fun observeChannelNoteAuthors(baseChannel: Channel): State<ImmutableList<User>>
|
|||||||
.mapNotNull { key, value -> value.author }
|
.mapNotNull { key, value -> value.author }
|
||||||
.toSet()
|
.toSet()
|
||||||
.toImmutableList()
|
.toImmutableList()
|
||||||
|
}.onStart {
|
||||||
|
baseChannel.notes
|
||||||
|
.mapNotNull { key, value -> value.author }
|
||||||
|
.toSet()
|
||||||
|
.toImmutableList()
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.Default)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user