- Only shows live stream bubbles that are not 24/7

- Only shows user pictures of the active users in the past 15 minutes.
This commit is contained in:
Vitor Pamplona
2025-09-11 18:52:14 -04:00
parent c06c03928e
commit c9dc30d976
3 changed files with 14 additions and 2 deletions

View File

@@ -48,7 +48,15 @@ abstract class Channel : NotesGatherer {
return new return new
} }
open fun participatingAuthors() = notes.mapNotNull { key, value -> value.author } open fun participatingAuthors(maxTimeLimit: Long) =
notes.mapNotNull { key, value ->
val createdAt = value.createdAt()
if (createdAt != null && createdAt > maxTimeLimit) {
value.author
} else {
null
}
}
abstract fun toBestDisplayName(): String abstract fun toBestDisplayName(): String

View File

@@ -32,6 +32,7 @@ import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatChannel
import com.vitorpamplona.amethyst.model.nip53LiveActivities.LiveActivitiesChannel import com.vitorpamplona.amethyst.model.nip53LiveActivities.LiveActivitiesChannel
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent
import com.vitorpamplona.quartz.utils.TimeUtils
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
@@ -85,10 +86,11 @@ fun observeChannelNoteAuthors(
private fun channelToParticipatingUsers( private fun channelToParticipatingUsers(
channel: Channel, channel: Channel,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
maxTimeLimit: Long = TimeUtils.fifteenMinutesAgo(),
): ImmutableList<User> { ): ImmutableList<User> {
val users = mutableSetOf<User>() val users = mutableSetOf<User>()
channel.participatingAuthors().forEach { channel.participatingAuthors(maxTimeLimit).forEach {
users.add(it) users.add(it)
} }

View File

@@ -88,7 +88,9 @@ class HomeLiveFilter(
): Boolean { ): Boolean {
val liveChannel = val liveChannel =
channel.info?.let { channel.info?.let {
val startedAt = it.starts()
it.createdAt > timeLimit && it.createdAt > timeLimit &&
(startedAt == null || (it.createdAt - startedAt) < TimeUtils.ONE_DAY) &&
it.status() == StatusTag.STATUS.LIVE && it.status() == StatusTag.STATUS.LIVE &&
filterParams.match(it, channel.relays().toList()) filterParams.match(it, channel.relays().toList())
} }