From c9dc30d9769dbb289525e4ee58ff37fd095cb495 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 11 Sep 2025 18:52:14 -0400 Subject: [PATCH] - Only shows live stream bubbles that are not 24/7 - Only shows user pictures of the active users in the past 15 minutes. --- .../java/com/vitorpamplona/amethyst/model/Channel.kt | 10 +++++++++- .../relayClient/reqCommand/channel/ChannelObservers.kt | 4 +++- .../ui/screen/loggedIn/home/dal/HomeLiveFilter.kt | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Channel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Channel.kt index 798ffcfad..eb59a304c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Channel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Channel.kt @@ -48,7 +48,15 @@ abstract class Channel : NotesGatherer { 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 diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt index 8977d67d4..4400ed68a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt @@ -32,6 +32,7 @@ import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatChannel import com.vitorpamplona.amethyst.model.nip53LiveActivities.LiveActivitiesChannel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList @@ -85,10 +86,11 @@ fun observeChannelNoteAuthors( private fun channelToParticipatingUsers( channel: Channel, accountViewModel: AccountViewModel, + maxTimeLimit: Long = TimeUtils.fifteenMinutesAgo(), ): ImmutableList { val users = mutableSetOf() - channel.participatingAuthors().forEach { + channel.participatingAuthors(maxTimeLimit).forEach { users.add(it) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt index ef219b50f..686837fb4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt @@ -88,7 +88,9 @@ class HomeLiveFilter( ): Boolean { val liveChannel = channel.info?.let { + val startedAt = it.starts() it.createdAt > timeLimit && + (startedAt == null || (it.createdAt - startedAt) < TimeUtils.ONE_DAY) && it.status() == StatusTag.STATUS.LIVE && filterParams.match(it, channel.relays().toList()) }