Sync with upstream

This commit is contained in:
KotlinGeekDev
2025-08-06 19:11:07 +00:00
committed by GitHub
38 changed files with 102 additions and 98 deletions
+3 -3
View File
@@ -175,8 +175,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
buildFeatures {
@@ -212,7 +212,7 @@ configurations.all {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
}
}
@@ -39,7 +39,7 @@ class AccountNotificationsEoseFromInboxRelaysManager(
client: NostrClient,
allKeys: () -> Set<AccountQueryState>,
) : PerUserEoseManager<AccountQueryState>(client, allKeys) {
override fun user(query: AccountQueryState) = query.account.userProfile()
override fun user(key: AccountQueryState) = key.account.userProfile()
/**
* Downloads most notifications from the user's own inbox relays.
@@ -59,7 +59,7 @@ class AccountNotificationsEoseFromInboxRelaysManager(
filterNotificationsToPubkey(
relay = it,
pubkey = user(key).pubkeyHex,
since = since?.get(it)?.time ?: key.feedContentStates.notifications.lastNoteCreatedAtIfFilled(),
since = since?.get(it)?.time ?: key.feedContentStates.notifications.lastNoteCreatedAtIfFilled() ?: TimeUtils.oneWeekAgo(),
)
}
@@ -39,7 +39,7 @@ class AccountNotificationsEoseFromRandomRelaysManager(
client: NostrClient,
allKeys: () -> Set<AccountQueryState>,
) : PerUserEoseManager<AccountQueryState>(client, allKeys) {
override fun user(query: AccountQueryState) = query.account.userProfile()
override fun user(key: AccountQueryState) = key.account.userProfile()
/**
* Downloads most notifications from the user's own inbox relays.
@@ -51,7 +51,7 @@ class AccountNotificationsEoseFromRandomRelaysManager(
since: SincePerRelayMap?,
): List<RelayBasedFilter>? =
(key.account.followsPerRelay.value.keys - key.account.notificationRelays.flow.value).flatMap {
val since = since?.get(it)?.time ?: TimeUtils.oneDayAgo()
val since = since?.get(it)?.time ?: TimeUtils.oneWeekAgo()
filterJustTheLatestNotificationsToPubkeyFromRandomRelays(it, user(key).pubkeyHex, since)
}
@@ -116,7 +116,7 @@ fun filterNotificationsToPubkey(
Filter(
kinds = NotificationsPerKeyKinds,
tags = mapOf("p" to listOf(pubkey)),
limit = 50,
limit = 500,
since = since,
),
),
@@ -126,7 +126,7 @@ fun filterNotificationsToPubkey(
Filter(
kinds = NotificationsPerKeyKinds2,
tags = mapOf("p" to listOf(pubkey)),
limit = 100,
limit = 500,
since = since,
),
),
@@ -147,7 +147,7 @@ fun filterJustTheLatestNotificationsToPubkeyFromRandomRelays(
Filter(
kinds = SummaryKinds,
tags = mapOf("p" to listOf(pubkey)),
limit = 10,
limit = 500,
since = since,
),
),
@@ -157,7 +157,7 @@ fun filterJustTheLatestNotificationsToPubkeyFromRandomRelays(
Filter(
kinds = NotificationsPerKeyKinds,
tags = mapOf("p" to listOf(pubkey)),
limit = 5,
limit = 500,
since = since,
),
),
@@ -167,7 +167,7 @@ fun filterJustTheLatestNotificationsToPubkeyFromRandomRelays(
Filter(
kinds = NotificationsPerKeyKinds2,
tags = mapOf("p" to listOf(pubkey)),
limit = 5,
limit = 500,
since = since,
),
),
@@ -76,6 +76,10 @@ fun filterMissingAddressables(keys: List<EventFinderQueryState>): List<RelayBase
potentialRelaysToFindAddress(key.note).ifEmpty { default }.forEach { relayUrl ->
add(relayUrl, key.note.address)
}
key.account.searchRelayList.flow.value.forEach { relayUrl ->
add(relayUrl, key.note.address)
}
}
// loads threading that is event-based
@@ -77,6 +77,10 @@ fun filterMissingEvents(keys: List<EventFinderQueryState>): List<RelayBasedFilte
potentialRelaysToFindEvent(key.note).ifEmpty { default }.forEach { relayUrl ->
add(relayUrl, key.note.idHex)
}
key.account.searchRelayList.flow.value.forEach { relayUrl ->
add(relayUrl, key.note.idHex)
}
}
// loads threading that is event-based
@@ -23,9 +23,9 @@ package com.vitorpamplona.amethyst.ui.dal
import com.vitorpamplona.amethyst.logTime
abstract class AdditiveFeedFilter<T> : FeedFilter<T>() {
abstract fun applyFilter(collection: Set<T>): Set<T>
abstract fun applyFilter(newItems: Set<T>): Set<T>
abstract fun sort(collection: Set<T>): List<T>
abstract fun sort(items: Set<T>): List<T>
open fun updateListWith(
oldList: List<T>,
@@ -42,11 +42,11 @@ class ChatroomFeedFilter(
.reversed()
}
override fun applyFilter(collection: Set<Note>): Set<Note> {
override fun applyFilter(newItems: Set<Note>): Set<Note> {
val chatroom = account.chatroomList.getOrCreatePrivateChatroom(withUser)
return collection.filter { it in chatroom.messages && account.isAcceptable(it) }.toSet()
return newItems.filter { it in chatroom.messages && account.isAcceptable(it) }.toSet()
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -40,10 +40,10 @@ class ChannelFeedFilter(
},
)
override fun applyFilter(collection: Set<Note>): Set<Note> =
collection
override fun applyFilter(newItems: Set<Note>): Set<Note> =
newItems
.filter { channel.notes.containsKey(it.idHex) && account.isAcceptable(it) }
.toSet()
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -254,5 +254,5 @@ class ChatroomListKnownFeedFilter(
return newRelevantPrivateMessages
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -133,5 +133,5 @@ class ChatroomListNewFeedFilter(
return newRelevantPrivateMessages
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -46,7 +46,7 @@ class CommunityFeedFilter(
return sort(result)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val myPubKey = account.userProfile().pubkeyHex
@@ -79,5 +79,5 @@ class CommunityFeedFilter(
null
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -55,7 +55,7 @@ open class DiscoverLongFormFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -72,5 +72,5 @@ open class DiscoverLongFormFeedFilter(
}
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -61,7 +61,7 @@ open class DiscoverChatFeedFilter(
return sort(allChannelNotes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -102,13 +102,13 @@ open class DiscoverChatFeedFilter(
}
}
override fun sort(collection: Set<Note>): List<Note> {
override fun sort(items: Set<Note>): List<Note> {
val lastNote =
collection.associateWith { note ->
items.associateWith { note ->
LocalCache.getPublicChatChannelIfExists(note.idHex)?.lastNote?.createdAt() ?: 0
}
return collection
return items
.sortedWith(
compareBy(
{ lastNote[it] },
@@ -53,7 +53,7 @@ open class DiscoverFollowSetsFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -70,5 +70,5 @@ open class DiscoverFollowSetsFeedFilter(
}
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -60,7 +60,7 @@ open class DiscoverLiveFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
protected open fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val filterParams =
@@ -75,7 +75,7 @@ open class DiscoverLiveFeedFilter(
}
}
override fun sort(collection: Set<Note>): List<Note> {
override fun sort(items: Set<Note>): List<Note> {
val topFilter = account.liveDiscoveryFollowLists.value
val discoveryTopFilterAuthors =
when (topFilter) {
@@ -94,12 +94,12 @@ open class DiscoverLiveFeedFilter(
val counter = ParticipantListBuilder()
val participantCounts =
collection.associate { it to counter.countFollowsThatParticipateOn(it, followingKeySet) }
items.associate { it to counter.countFollowsThatParticipateOn(it, followingKeySet) }
val allParticipants =
collection.associate { it to counter.countFollowsThatParticipateOn(it, null) }
items.associate { it to counter.countFollowsThatParticipateOn(it, null) }
return collection
return items
.sortedWith(
compareBy(
{ convertStatusToOrder((it.event as? LiveActivitiesEvent)?.status()) },
@@ -69,7 +69,7 @@ open class DiscoverCommunityFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
protected open fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
// here, we need to look for CommunityDefinition in new collection AND new CommunityDefinition from Post Approvals
@@ -111,13 +111,13 @@ open class DiscoverCommunityFeedFilter(
comingFrom: List<NormalizedRelayUrl> = emptyList(),
) = aTag != null && aTag.kind == CommunityDefinitionEvent.KIND && params.match(aTag, comingFrom)
override fun sort(collection: Set<Note>): List<Note> {
override fun sort(items: Set<Note>): List<Note> {
val lastNote =
collection.associateWith { note ->
items.associateWith { note ->
note.boosts.maxOfOrNull { it.createdAt() ?: 0 } ?: 0
}
return collection
return items
.sortedWith(
compareBy(
{ lastNote[it] },
@@ -55,7 +55,7 @@ open class DiscoverNIP89FeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -85,5 +85,5 @@ open class DiscoverNIP89FeedFilter(
acceptDVM(it)
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
}
@@ -54,7 +54,7 @@ open class DiscoverMarketplaceFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -71,5 +71,5 @@ open class DiscoverMarketplaceFeedFilter(
}
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
}
@@ -32,8 +32,8 @@ class DraftEventsFeedFilter(
) : AdditiveFeedFilter<Note>() {
override fun feedKey(): String = account.userProfile().pubkeyHex
override fun applyFilter(collection: Set<Note>): Set<Note> =
collection.filterTo(HashSet()) {
override fun applyFilter(newItems: Set<Note>): Set<Note> =
newItems.filterTo(HashSet()) {
acceptableEvent(it)
}
@@ -51,5 +51,5 @@ class DraftEventsFeedFilter(
return noteEvent is DraftEvent && noteEvent.pubKey == account.userProfile().pubkeyHex
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -69,7 +69,7 @@ open class NIP90ContentDiscoveryResponseFilter(
}
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -95,7 +95,7 @@ open class NIP90ContentDiscoveryResponseFilter(
}.toSet()
}
override fun sort(collection: Set<Note>): List<Note> {
return collection.toList() // collection.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
override fun sort(items: Set<Note>): List<Note> {
return items.toList() // collection.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed()
}
}
@@ -55,7 +55,7 @@ class GeoHashFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.filterTo(HashSet<Note>()) { acceptableEvent(it, tag) }
@@ -87,5 +87,5 @@ class GeoHashFeedFilter(
geohash: String,
): Boolean = event is CommentEvent && event.isTaggedScope(geohash, GeohashId::match)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -57,7 +57,7 @@ class HashtagFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.filterTo(HashSet<Note>()) { acceptableEvent(it, tag) }
@@ -91,5 +91,5 @@ class HashtagFeedFilter(
hashTag: String,
): Boolean = event is CommentEvent && event.isTaggedScope(hashTag, HashtagId::match)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -55,7 +55,7 @@ class HomeConversationsFeedFilter(
)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
fun buildFilterParams(account: Account): FilterByListParams =
FilterByListParams.create(
@@ -90,5 +90,5 @@ class HomeConversationsFeedFilter(
filterParams: FilterByListParams,
): Boolean = acceptableEvent(note.event, filterParams) && !note.isNewThread()
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -75,7 +75,7 @@ class HomeNewThreadFeedFilter(
return sort(notes + longFormNotes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val filterParams = buildFilterParams(account)
@@ -110,8 +110,8 @@ class HomeNewThreadFeedFilter(
it.isNewThread()
}
override fun sort(collection: Set<Note>): List<Note> =
collection
override fun sort(items: Set<Note>): List<Note> =
items
.distinctBy {
if (it.event is RepostEvent || it.event is GenericRepostEvent) {
it.replyTo?.lastOrNull()?.idHex ?: it.idHex // only the most recent repost per feed.
@@ -111,12 +111,10 @@ class NotificationSummaryState(
takenIntoAccount.add(noteEvent.id)
}
} else if (noteEvent is LnZapEvent) {
if (
noteEvent.isTaggedUser(currentUser)
) { // the user might be sending his own receipts noteEvent.pubKey != currentUser
// the user might be sending his own receipts noteEvent.pubKey != currentUser
if (noteEvent.isTaggedUser(currentUser)) {
val netDate = formatDate(noteEvent.createdAt)
zaps[netDate] =
(zaps[netDate] ?: BigDecimal.ZERO) + (noteEvent.amount ?: BigDecimal.ZERO)
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + (noteEvent.amount ?: BigDecimal.ZERO)
takenIntoAccount.add(noteEvent.id)
}
} else if (noteEvent is BaseThreadedEvent) {
@@ -178,12 +176,10 @@ class NotificationSummaryState(
hasNewElements = true
}
} else if (noteEvent is LnZapEvent) {
if (
noteEvent.isTaggedUser(currentUser)
) { // && noteEvent.pubKey != currentUser User might be sending his own receipts
if (noteEvent.isTaggedUser(currentUser)) {
// && noteEvent.pubKey != currentUser User might be sending his own receipts
val netDate = formatDate(noteEvent.createdAt)
zaps[netDate] =
(zaps[netDate] ?: BigDecimal.ZERO) + (noteEvent.amount ?: BigDecimal.ZERO)
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + (noteEvent.amount ?: BigDecimal.ZERO)
takenIntoAccount.add(noteEvent.id)
hasNewElements = true
}
@@ -84,7 +84,7 @@ class NotificationFeedFilter(
return sort(notifications)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val filterParams = buildFilterParams(account)
@@ -136,7 +136,7 @@ class NotificationFeedFilter(
tagsAnEventByUser(it, loggedInUserHex)
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
fun tagsAnEventByUser(
note: Note,
@@ -54,7 +54,7 @@ class UserProfileConversationsFeedFilter(
return sort(notes + longFormNotes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.filterTo(HashSet()) { acceptableEvent(it) }
@@ -72,7 +72,7 @@ class UserProfileConversationsFeedFilter(
!it.isNewThread() &&
account.isAcceptable(it)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
override fun limit() = 200
}
@@ -55,7 +55,7 @@ class UserProfileGalleryFeedFilter(
return sorted.toList()
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val params = buildFilterParams(account)
@@ -82,5 +82,5 @@ class UserProfileGalleryFeedFilter(
hiddenUsers = account.hiddenUsers.flow.value,
)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -41,7 +41,7 @@ class UserProfileAppRecommendationsFeedFilter(
return sort(recommendations)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.mapNotNull { filterMap(it) }.flatten().toSet()
@@ -56,5 +56,5 @@ class UserProfileAppRecommendationsFeedFilter(
return null
}
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
@@ -62,7 +62,7 @@ class UserProfileMutualFeedFilter(
return sort(notes + longFormNotes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.filterTo(HashSet()) { acceptableEvent(it) }
@@ -84,7 +84,7 @@ class UserProfileMutualFeedFilter(
) &&
it.event?.isTaggedUser(user.pubkeyHex) == true
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
override fun limit() = 200
}
@@ -62,7 +62,7 @@ class UserProfileNewThreadFeedFilter(
return sort(notes + longFormNotes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> = collection.filterTo(HashSet()) { acceptableEvent(it) }
@@ -86,7 +86,7 @@ class UserProfileNewThreadFeedFilter(
it.isNewThread() &&
account.isAcceptable(it)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
override fun limit() = 200
}
@@ -34,14 +34,14 @@ class UserProfileReportsFeedFilter(
override fun feed(): List<Note> = sort(innerApplyFilter(user.reports.values.flatten()))
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> =
collection
.filter { it.event is ReportEvent && it.event?.isTaggedUser(user.pubkeyHex) == true }
.toSet()
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
override fun limit() = 400
}
@@ -72,7 +72,7 @@ class VideoFeedFilter(
return sort(notes)
}
override fun applyFilter(collection: Set<Note>): Set<Note> = innerApplyFilter(collection)
override fun applyFilter(newItems: Set<Note>): Set<Note> = innerApplyFilter(newItems)
private fun innerApplyFilter(collection: Collection<Note>): Set<Note> {
val params = buildFilterParams(account)
@@ -124,5 +124,5 @@ class VideoFeedFilter(
hiddenUsers = account.hiddenUsers.flow.value,
)
override fun sort(collection: Set<Note>): List<Note> = collection.sortedWith(DefaultFeedOrder)
override fun sort(items: Set<Note>): List<Note> = items.sortedWith(DefaultFeedOrder)
}
+3 -3
View File
@@ -32,8 +32,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
packagingOptions {
resources {
@@ -44,7 +44,7 @@ android {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xstring-concat=inline")
}
}
+3 -3
View File
@@ -20,8 +20,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
sourceSets.androidTest.assets.srcDirs += ["../quartz/src/androidTest/assets"]
@@ -48,7 +48,7 @@ android {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xstring-concat=inline")
}
}
+3 -3
View File
@@ -29,8 +29,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
buildFeatures {
@@ -40,7 +40,7 @@ android {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xstring-concat=inline")
}
}
+3 -3
View File
@@ -28,8 +28,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
packagingOptions {
resources {
@@ -40,7 +40,7 @@ android {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xstring-concat=inline")
}
}