diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/NostrSingleEventDataSource.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/NostrSingleEventDataSource.kt index c09d38206..c5274166c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/NostrSingleEventDataSource.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/NostrSingleEventDataSource.kt @@ -12,7 +12,7 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { private var eventsToWatch = setOf() private var addressesToWatch = setOf() - private fun createTagToAddressFilter(): List? { + private fun createReactionsToWatchInAddressFilter(): List? { val addressesToWatch = eventsToWatch.filter { it.address() != null } + addressesToWatch if (addressesToWatch.isEmpty()) { @@ -25,12 +25,15 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { types = COMMON_FEED_TYPES, filter = JsonFilter( kinds = listOf( - TextNoteEvent.kind, LongTextNoteEvent.kind, - ReactionEvent.kind, RepostEvent.kind, GenericRepostEvent.kind, ReportEvent.kind, - LnZapEvent.kind, LnZapRequestEvent.kind, - BadgeAwardEvent.kind, BadgeDefinitionEvent.kind, BadgeProfilesEvent.kind, - PollNoteEvent.kind, AudioTrackEvent.kind, PinListEvent.kind, - PeopleListEvent.kind, BookmarkListEvent.kind + TextNoteEvent.kind, + ReactionEvent.kind, + RepostEvent.kind, + GenericRepostEvent.kind, + ReportEvent.kind, + LnZapEvent.kind, + PollNoteEvent.kind, + CommunityPostApprovalEvent.kind, + LiveActivitiesChatMessageEvent.kind ), tags = mapOf("a" to listOf(aTag.toTag())), since = it.lastReactionsDownloadTime, @@ -55,7 +58,8 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { types = COMMON_FEED_TYPES, filter = JsonFilter( kinds = listOf(aTag.kind), - authors = listOf(aTag.pubKeyHex) + authors = listOf(aTag.pubKeyHex), + limit = 1000 // Max amount of "replies" to download on a specific event. ) ) } else { @@ -64,7 +68,8 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { filter = JsonFilter( kinds = listOf(aTag.kind), tags = mapOf("d" to listOf(aTag.dTag)), - authors = listOf(aTag.pubKeyHex) + authors = listOf(aTag.pubKeyHex), + limit = 1000 // Max amount of "replies" to download on a specific event. ) ) } @@ -85,17 +90,12 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { filter = JsonFilter( kinds = listOf( TextNoteEvent.kind, - LongTextNoteEvent.kind, ReactionEvent.kind, RepostEvent.kind, GenericRepostEvent.kind, ReportEvent.kind, LnZapEvent.kind, - LnZapRequestEvent.kind, - PollNoteEvent.kind, - HighlightEvent.kind, - AudioTrackEvent.kind, - PinListEvent.kind + PollNoteEvent.kind ), tags = mapOf("e" to listOf(it.idHex)), since = it.lastReactionsDownloadTime, @@ -154,7 +154,7 @@ object NostrSingleEventDataSource : NostrDataSource("SingleEventFeed") { val reactions = createRepliesAndReactionsFilter() val missing = createLoadEventsIfNotLoadedFilter() val addresses = createAddressFilter() - val addressReactions = createTagToAddressFilter() + val addressReactions = createReactionsToWatchInAddressFilter() singleEventChannel.typedFilters = listOfNotNull(missing, addresses, reactions, addressReactions).flatten().ifEmpty { null } }