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

View File

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

View File

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