mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 08:27:46 +02:00
- 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:
@@ -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
|
||||||
|
|
||||||
|
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user