diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterNotificationsToPubkey.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterNotificationsToPubkey.kt index 6da7409fc..4f75d1521 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterNotificationsToPubkey.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterNotificationsToPubkey.kt @@ -95,7 +95,7 @@ fun filterSummaryNotificationsToPubkey( Filter( kinds = SummaryKinds, tags = mapOf("p" to listOf(pubkey)), - limit = if (since == null) 2000 else null, + limit = 2000, since = since, ), ), @@ -116,7 +116,7 @@ fun filterNotificationsToPubkey( Filter( kinds = NotificationsPerKeyKinds, tags = mapOf("p" to listOf(pubkey)), - limit = if (since == null) 50 else null, + limit = 50, since = since, ), ), @@ -126,7 +126,7 @@ fun filterNotificationsToPubkey( Filter( kinds = NotificationsPerKeyKinds2, tags = mapOf("p" to listOf(pubkey)), - limit = if (since == null) 100 else null, + limit = 100, since = since, ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFilterAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFilterAssembler.kt index c86d924c8..a8d7a427b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFilterAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFilterAssembler.kt @@ -38,9 +38,9 @@ class DiscoveryFilterAssembler( ) : ComposeSubscriptionManager() { val group = listOf( - DiscoveryFollowsDiscoverySubAssembler1(client, ::allKeys), - DiscoveryFollowsDiscoverySubAssembler2(client, ::allKeys), - DiscoveryFollowsDiscoverySubAssembler3(client, ::allKeys), + DiscoveryLongFormClassifiedsAndDVMSubAssembler1(client, ::allKeys), + DiscoveryFollowsSetsAndLiveStreamsSubAssembler2(client, ::allKeys), + DiscoveryPublicChatsAndCommunitiesSubAssembler3(client, ::allKeys), ) override fun invalidateKeys() = invalidateFilters() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler2.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsSetsAndLiveStreamsSubAssembler2.kt similarity index 98% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler2.kt rename to amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsSetsAndLiveStreamsSubAssembler2.kt index 2cf987317..37c224244 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler2.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsSetsAndLiveStreamsSubAssembler2.kt @@ -36,7 +36,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.sample import kotlinx.coroutines.launch -class DiscoveryFollowsDiscoverySubAssembler2( +class DiscoveryFollowsSetsAndLiveStreamsSubAssembler2( client: NostrClient, allKeys: () -> Set, ) : PerUserAndFollowListEoseManager(client, allKeys) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler1.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryLongFormClassifiedsAndDVMSubAssembler1.kt similarity index 98% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler1.kt rename to amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryLongFormClassifiedsAndDVMSubAssembler1.kt index 7c3ef0db6..00d94583e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler1.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryLongFormClassifiedsAndDVMSubAssembler1.kt @@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.sample import kotlinx.coroutines.launch -class DiscoveryFollowsDiscoverySubAssembler1( +class DiscoveryLongFormClassifiedsAndDVMSubAssembler1( client: NostrClient, allKeys: () -> Set, ) : PerUserAndFollowListEoseManager(client, allKeys) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler3.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryPublicChatsAndCommunitiesSubAssembler3.kt similarity index 98% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler3.kt rename to amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryPublicChatsAndCommunitiesSubAssembler3.kt index 660896e6c..ef4fbb011 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryFollowsDiscoverySubAssembler3.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/datasource/DiscoveryPublicChatsAndCommunitiesSubAssembler3.kt @@ -36,7 +36,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.sample import kotlinx.coroutines.launch -class DiscoveryFollowsDiscoverySubAssembler3( +class DiscoveryPublicChatsAndCommunitiesSubAssembler3( client: NostrClient, allKeys: () -> Set, ) : PerUserAndFollowListEoseManager(client, allKeys) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/subassemblies/FilterLongFormGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/subassemblies/FilterLongFormGlobal.kt index 1c74098a4..4c879bbb3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/subassemblies/FilterLongFormGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/subassemblies/FilterLongFormGlobal.kt @@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.utils.TimeUtils fun filterLongFormGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -34,7 +35,7 @@ fun filterLongFormGlobal( if (relays.set.isEmpty()) return emptyList() return relays.set.map { - val since = since?.get(it.key)?.time ?: defaultSince + val since = since?.get(it.key)?.time ?: defaultSince ?: TimeUtils.oneWeekAgo() RelayBasedFilter( relay = it.key, filter = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/subassemblies/FilterPublicChatsGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/subassemblies/FilterPublicChatsGlobal.kt index ce424a1c7..defd9b502 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/subassemblies/FilterPublicChatsGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip28Chats/subassemblies/FilterPublicChatsGlobal.kt @@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent +import com.vitorpamplona.quartz.utils.TimeUtils fun filterPublicChatsGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -35,21 +36,34 @@ fun filterPublicChatsGlobal( ): List { if (relays.set.isEmpty()) return emptyList() - return relays.set.map { + return relays.set.flatMap { val since = since?.get(it.key)?.time ?: defaultSince - RelayBasedFilter( - relay = it.key, - filter = - Filter( - kinds = - listOf( - ChannelCreateEvent.KIND, - ChannelMetadataEvent.KIND, - ChannelMessageEvent.KIND, - ), - limit = 30, - since = since, - ), + listOf( + RelayBasedFilter( + relay = it.key, + filter = + Filter( + kinds = + listOf( + ChannelCreateEvent.KIND, + ChannelMetadataEvent.KIND, + ), + limit = 30, + since = since, + ), + ), + RelayBasedFilter( + relay = it.key, + filter = + Filter( + kinds = + listOf( + ChannelMessageEvent.KIND, + ), + limit = 50, + since = since ?: TimeUtils.oneWeekAgo(), + ), + ), ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/subassemblies/FilterFollowSetsGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/subassemblies/FilterFollowSetsGlobal.kt index 7684ecd79..661e9ca70 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/subassemblies/FilterFollowSetsGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/subassemblies/FilterFollowSetsGlobal.kt @@ -40,7 +40,7 @@ fun filterFollowSetsGlobal( filter = Filter( kinds = listOf(FollowListEvent.KIND), - limit = 300, + limit = 100, since = since, ), ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/subassemblies/FilterLiveActivitiesGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/subassemblies/FilterLiveActivitiesGlobal.kt index d3cb8095d..8932ad9e2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/subassemblies/FilterLiveActivitiesGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/subassemblies/FilterLiveActivitiesGlobal.kt @@ -26,6 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.utils.TimeUtils fun filterLiveActivitiesGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -34,16 +35,28 @@ fun filterLiveActivitiesGlobal( ): List { if (relays.set.isEmpty()) return emptyList() - return relays.set.map { - val since = since?.get(it.key)?.time ?: defaultSince - RelayBasedFilter( - relay = it.key, - filter = - Filter( - kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND), - limit = 30, - since = since, + return relays.set + .map { + val since = since?.get(it.key)?.time ?: defaultSince + listOf( + RelayBasedFilter( + relay = it.key, + filter = + Filter( + kinds = listOf(LiveActivitiesEvent.KIND), + limit = 30, + since = since ?: TimeUtils.oneWeekAgo(), + ), ), - ) - } + RelayBasedFilter( + relay = it.key, + filter = + Filter( + kinds = listOf(LiveActivitiesChatMessageEvent.KIND), + limit = 50, + since = since ?: TimeUtils.oneDayAgo(), + ), + ), + ) + }.flatten() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip72Communities/subassemblies/FilterCommunitiesGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip72Communities/subassemblies/FilterCommunitiesGlobal.kt index a9baaba88..6798e81f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip72Communities/subassemblies/FilterCommunitiesGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip72Communities/subassemblies/FilterCommunitiesGlobal.kt @@ -26,6 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent +import com.vitorpamplona.quartz.utils.TimeUtils fun filterCommunitiesGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -51,8 +52,8 @@ fun filterCommunitiesGlobal( filter = Filter( kinds = listOf(CommunityPostApprovalEvent.KIND), - limit = 30, - since = since, + limit = 100, + since = since ?: TimeUtils.oneWeekAgo(), ), ), ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsByAuthors.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsByAuthors.kt index 0b999913a..de27c901a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsByAuthors.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsByAuthors.kt @@ -42,7 +42,7 @@ fun filterClassifiedsAuthors( Filter( authors = authorList, kinds = listOf(ClassifiedsEvent.KIND), - limit = 300, + limit = authorList.size * 10, since = since, ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsGlobal.kt index 993e2a118..f91c5cde5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/subassemblies/FilterClassifiedsGlobal.kt @@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent +import com.vitorpamplona.quartz.utils.TimeUtils fun filterClassifiedsGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -34,7 +35,7 @@ fun filterClassifiedsGlobal( if (relays.set.isEmpty()) return emptyList() return relays.set.flatMap { - val since = since?.get(it.key)?.time ?: defaultSince + val since = since?.get(it.key)?.time ?: defaultSince ?: TimeUtils.oneMonthAgo() listOf( RelayBasedFilter( relay = it.key, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByGeohash.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByGeohash.kt index e8075c4da..5cbc0db86 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByGeohash.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByGeohash.kt @@ -43,7 +43,7 @@ fun filterPictureAndVideoGeohash( Filter( kinds = PictureAndVideoKinds, tags = mapOf("g" to geoHashes), - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ), @@ -57,7 +57,7 @@ fun filterPictureAndVideoGeohash( "g" to geoHashes, "m" to LegacyMimeTypes, ), - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByHashtag.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByHashtag.kt index 797cb856f..1b7bff4be 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByHashtag.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoByHashtag.kt @@ -44,7 +44,7 @@ fun filterPictureAndVideoHashtag( Filter( kinds = PictureAndVideoKinds, tags = mapOf("t" to hashtags), - limit = if (since == null) 100 else null, + limit = 100, since = since, ), ), @@ -58,7 +58,7 @@ fun filterPictureAndVideoHashtag( "t" to hashtags, "m" to LegacyMimeTypes, ), - limit = if (since == null) 100 else null, + limit = 100, since = since, ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoGlobal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoGlobal.kt index 2e2295ea5..a5c03b7ee 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoGlobal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip01Core/FilterPictureAndVideoGlobal.kt @@ -43,7 +43,7 @@ fun filterPictureAndVideoGlobal( filter = Filter( kinds = PictureAndVideoKinds, - limit = if (since == null) 50 else null, + limit = 50, since = since, ), ), @@ -53,7 +53,7 @@ fun filterPictureAndVideoGlobal( Filter( kinds = PictureAndVideoLegacyKinds, tags = LegacyMimeTypeMap, - limit = if (since == null) 50 else null, + limit = 50, since = since, ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip72Communities/FilterPictureAndVideoByAllCommunities.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip72Communities/FilterPictureAndVideoByAllCommunities.kt index 90d0bafae..b7be4a067 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip72Communities/FilterPictureAndVideoByAllCommunities.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/datasource/subassemblies/nip72Communities/FilterPictureAndVideoByAllCommunities.kt @@ -52,7 +52,7 @@ fun filterPictureAndVideoAllCommunities( "a" to communityList, "k" to PictureAndVideoKTags, ), - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ), @@ -63,7 +63,7 @@ fun filterPictureAndVideoAllCommunities( Filter( tags = mapOf("a" to communityList), kinds = PictureAndVideoKinds, - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ), @@ -78,7 +78,7 @@ fun filterPictureAndVideoAllCommunities( "a" to communityList, "k" to listOf(FileHeaderEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()), ), - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ), @@ -93,7 +93,7 @@ fun filterPictureAndVideoAllCommunities( "m" to LegacyMimeTypes, ), kinds = PictureAndVideoLegacyKinds, - limit = if (since == null) 200 else null, + limit = 200, since = since, ), ),