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