Filters by supported kinds in the DVM view.

This commit is contained in:
Vitor Pamplona
2024-06-01 15:16:35 -04:00
parent 2326e66382
commit 4faee68174

View File

@@ -48,12 +48,12 @@ open class DiscoverNIP89FeedFilter(
}
override fun feed(): List<Note> {
val params = buildFilterParams(account)
val filterParams = buildFilterParams(account)
val notes =
LocalCache.addressables.filterIntoSet { _, it ->
val noteEvent = it.event
noteEvent is AppDefinitionEvent && noteEvent.createdAt > TimeUtils.now() - lastAnnounced // && params.match(noteEvent)
noteEvent is AppDefinitionEvent && filterParams.match(noteEvent) && noteEvent.supportedKinds().contains(5300) && noteEvent.createdAt > TimeUtils.now() - lastAnnounced // && params.match(noteEvent)
}
return sort(notes)
@@ -73,11 +73,11 @@ open class DiscoverNIP89FeedFilter(
}
protected open fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val params = buildFilterParams(account)
val filterParams = buildFilterParams(account)
return collection.filterTo(HashSet()) {
val noteEvent = it.event
noteEvent is AppDefinitionEvent && noteEvent.createdAt > TimeUtils.now() - lastAnnounced // && params.match(noteEvent)
noteEvent is AppDefinitionEvent && filterParams.match(noteEvent) && noteEvent.supportedKinds().contains(5300) && noteEvent.createdAt > TimeUtils.now() - lastAnnounced // && params.match(noteEvent)
}
}