This commit is contained in:
Believethehype 2024-12-02 22:02:49 +01:00
commit 56450cf6c5
2 changed files with 15 additions and 6 deletions
amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal
gradle

@ -22,9 +22,11 @@ package com.vitorpamplona.amethyst.ui.dal
import com.vitorpamplona.amethyst.commons.richtext.RichTextParser.Companion.isImageOrVideoUrl
import com.vitorpamplona.amethyst.model.Account
import com.vitorpamplona.amethyst.model.AddressableNote
import com.vitorpamplona.amethyst.model.LocalCache
import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.service.SUPPORTED_VIDEO_FEED_MIME_TYPES_SET
import com.vitorpamplona.quartz.events.AddressableEvent
import com.vitorpamplona.quartz.events.FileHeaderEvent
import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
import com.vitorpamplona.quartz.events.MuteListEvent
@ -48,7 +50,10 @@ class VideoFeedFilter(
val notes =
LocalCache.notes.filterIntoSet { _, it ->
acceptableEvent(it, params)
}
} +
LocalCache.addressables.filterIntoSet { _, it ->
acceptableEvent(it, params)
}
return sort(notes)
}
@ -62,10 +67,14 @@ class VideoFeedFilter(
}
fun acceptableEvent(
it: Note,
note: Note,
params: FilterByListParams,
): Boolean {
val noteEvent = it.event
val noteEvent = note.event
if (noteEvent is AddressableEvent && note !is AddressableNote) {
return false
}
return (
(noteEvent is FileHeaderEvent && noteEvent.hasUrl() && (noteEvent.urls().any { isImageOrVideoUrl(it) } || noteEvent.isOneOf(SUPPORTED_VIDEO_FEED_MIME_TYPES_SET))) ||
@ -75,7 +84,7 @@ class VideoFeedFilter(
noteEvent is PictureEvent
) &&
params.match(noteEvent) &&
(params.isHiddenList || account.isAcceptable(it))
(params.isHiddenList || account.isAcceptable(note))
}
fun buildFilterParams(account: Account): FilterByListParams =

@ -20,7 +20,7 @@ espressoCore = "3.6.1"
firebaseBom = "33.6.0"
fragmentKtx = "1.8.5"
gms = "4.4.2"
jacksonModuleKotlin = "2.18.1"
jacksonModuleKotlin = "2.18.2"
jna = "5.15.0"
jtorctl = "0.4.5.7"
junit = "4.13.2"
@ -40,7 +40,7 @@ navigationCompose = "2.8.4"
okhttp = "5.0.0-alpha.14"
runner = "1.6.2"
rfc3986 = "0.1.0"
secp256k1KmpJniAndroid = "0.15.0"
secp256k1KmpJniAndroid = "0.16.0"
securityCryptoKtx = "1.1.0-alpha06"
spotless = "6.25.0"
torAndroid = "0.4.8.12"