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 798ffcfad8..eb59a304c9 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 8977d67d48..4400ed68a9 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 ef219b50f5..686837fb44 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()) }