solve recursive method call

This commit is contained in:
Vitor Pamplona
2023-04-19 15:57:27 -04:00
parent 57b35398be
commit abdad7fbea
5 changed files with 16 additions and 16 deletions

View File

@@ -9,17 +9,17 @@ object GlobalFeedFilter : AdditiveFeedFilter<Note>() {
lateinit var account: Account lateinit var account: Account
override fun feed(): List<Note> { override fun feed(): List<Note> {
val notes = applyFilter(LocalCache.notes.values) val notes = innerApplyFilter(LocalCache.notes.values)
val longFormNotes = applyFilter(LocalCache.addressables.values) val longFormNotes = innerApplyFilter(LocalCache.addressables.values)
return sort(notes + longFormNotes) return sort(notes + longFormNotes)
} }
override fun applyFilter(collection: Set<Note>): List<Note> { override fun applyFilter(collection: Set<Note>): List<Note> {
return applyFilter(collection) return innerApplyFilter(collection)
} }
private fun applyFilter(collection: Collection<Note>): List<Note> { private fun innerApplyFilter(collection: Collection<Note>): List<Note> {
val followChannels = account.followingChannels val followChannels = account.followingChannels
val followUsers = account.followingKeySet() val followUsers = account.followingKeySet()
val now = System.currentTimeMillis() / 1000 val now = System.currentTimeMillis() / 1000

View File

@@ -18,14 +18,14 @@ object HashtagFeedFilter : AdditiveFeedFilter<Note>() {
} }
override fun feed(): List<Note> { override fun feed(): List<Note> {
return sort(applyFilter(LocalCache.notes.values)) return sort(innerApplyFilter(LocalCache.notes.values))
} }
override fun applyFilter(collection: Set<Note>): List<Note> { override fun applyFilter(collection: Set<Note>): List<Note> {
return applyFilter(collection) return applyFilter(collection)
} }
private fun applyFilter(collection: Collection<Note>): List<Note> { private fun innerApplyFilter(collection: Collection<Note>): List<Note> {
val myTag = tag ?: return emptyList() val myTag = tag ?: return emptyList()
return collection return collection

View File

@@ -10,14 +10,14 @@ object HomeConversationsFeedFilter : AdditiveFeedFilter<Note>() {
lateinit var account: Account lateinit var account: Account
override fun feed(): List<Note> { override fun feed(): List<Note> {
return sort(applyFilter(LocalCache.notes.values)) return sort(innerApplyFilter(LocalCache.notes.values))
} }
override fun applyFilter(collection: Set<Note>): List<Note> { override fun applyFilter(collection: Set<Note>): List<Note> {
return applyFilter(collection) return innerApplyFilter(collection)
} }
private fun applyFilter(collection: Collection<Note>): List<Note> { private fun innerApplyFilter(collection: Collection<Note>): List<Note> {
val user = account.userProfile() val user = account.userProfile()
val followingKeySet = user.cachedFollowingKeySet() val followingKeySet = user.cachedFollowingKeySet()
val followingTagSet = user.cachedFollowingTagSet() val followingTagSet = user.cachedFollowingTagSet()

View File

@@ -12,17 +12,17 @@ object HomeNewThreadFeedFilter : AdditiveFeedFilter<Note>() {
lateinit var account: Account lateinit var account: Account
override fun feed(): List<Note> { override fun feed(): List<Note> {
val notes = applyFilter(LocalCache.notes.values) val notes = innerApplyFilter(LocalCache.notes.values)
val longFormNotes = applyFilter(LocalCache.addressables.values) val longFormNotes = innerApplyFilter(LocalCache.addressables.values)
return sort(notes + longFormNotes) return sort(notes + longFormNotes)
} }
override fun applyFilter(collection: Set<Note>): List<Note> { override fun applyFilter(collection: Set<Note>): List<Note> {
return applyFilter(collection) return innerApplyFilter(collection)
} }
private fun applyFilter(collection: Collection<Note>): List<Note> { private fun innerApplyFilter(collection: Collection<Note>): List<Note> {
val user = account.userProfile() val user = account.userProfile()
val followingKeySet = user.cachedFollowingKeySet() val followingKeySet = user.cachedFollowingKeySet()
val followingTagSet = user.cachedFollowingTagSet() val followingTagSet = user.cachedFollowingTagSet()

View File

@@ -10,14 +10,14 @@ object NotificationFeedFilter : AdditiveFeedFilter<Note>() {
lateinit var account: Account lateinit var account: Account
override fun feed(): List<Note> { override fun feed(): List<Note> {
return sort(applyFilter(LocalCache.notes.values)) return sort(innerApplyFilter(LocalCache.notes.values))
} }
override fun applyFilter(collection: Set<Note>): List<Note> { override fun applyFilter(collection: Set<Note>): List<Note> {
return applyFilter(collection) return innerApplyFilter(collection)
} }
private fun applyFilter(collection: Collection<Note>): List<Note> { private fun innerApplyFilter(collection: Collection<Note>): List<Note> {
val loggedInUser = account.userProfile() val loggedInUser = account.userProfile()
val loggedInUserHex = loggedInUser.pubkeyHex val loggedInUserHex = loggedInUser.pubkeyHex