Add filters for gallery (pictures/videos) events

This commit is contained in:
Kgothatso Ngako committed 2026-04-27 03:01:56 +02:00
1 parent 80f131361f
commit e877dbe75e
4 files changed
+39 -10

No files matched your search

@@ -217,6 +217,9 @@ fun SearchResultScreen(
SearchResultType.Videos -> { SearchResultType.Videos -> {
Text("Videos") Text("Videos")
} }
SearchResultType.Shorts -> {
Text("Shorts")
}
} }
when (val searchResultListUIState = searchViewModel.searchResultListUIState) { when (val searchResultListUIState = searchViewModel.searchResultListUIState) {
@@ -234,6 +237,7 @@ fun SearchResultScreen(
} }
} }
is SearchResultListUIState.Loaded -> { is SearchResultListUIState.Loaded -> {
// TODO: Handle gallery UI
if (searchResultListUIState.localNostrEvents.isEmpty()) { if (searchResultListUIState.localNostrEvents.isEmpty()) {
Column( Column(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -273,7 +273,7 @@ fun MetadataEventDetail(
when (metadataEventDetailType) { when (metadataEventDetailType) {
MetadataEventDetailType.Posts, MetadataEventDetailType.Replies, MetadataEventDetailType.Posts, MetadataEventDetailType.Replies,
MetadataEventDetailType.Articles, MetadataEventDetailType.Zaps, MetadataEventDetailType.Articles, MetadataEventDetailType.Zaps,
MetadataEventDetailType.Photos, MetadataEventDetailType.Videos, MetadataEventDetailType.Photos, MetadataEventDetailType.Shorts, MetadataEventDetailType.Videos,
MetadataEventDetailType.Bookmarks, MetadataEventDetailType.Reports, MetadataEventDetailType.Relays -> { MetadataEventDetailType.Bookmarks, MetadataEventDetailType.Reports, MetadataEventDetailType.Relays -> {
val feedListViewModel: FeedListViewModel = viewModel( val feedListViewModel: FeedListViewModel = viewModel(
key = metadataEventDetailType.name, key = metadataEventDetailType.name,
@@ -294,7 +294,7 @@ fun MetadataEventDetail(
feedListViewModel.initiate() feedListViewModel.initiate()
} }
} }
// TODO: Support gallery feeds...
MetadataEventDetailType.Following -> { MetadataEventDetailType.Following -> {
val followingListViewModel: FollowingListViewModel = viewModel( val followingListViewModel: FollowingListViewModel = viewModel(
key = metadataEventDetailType.name, key = metadataEventDetailType.name,
@@ -33,12 +33,15 @@ import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent
import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent
import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
import com.vitorpamplona.quartz.nip68Picture.PictureEvent
import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent
import com.vitorpamplona.quartz.nip71Video.VideoShortEvent
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO import kotlinx.coroutines.IO
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
enum class MetadataEventDetailType { enum class MetadataEventDetailType {
Posts, Replies, Articles, Followers, Following, Zaps, Photos, Videos, Bookmarks, Reports, Relays Posts, Replies, Articles, Followers, Following, Zaps, Photos, Shorts, Videos, Bookmarks, Reports, Relays
} }
class MetadataEventDetailViewModel( class MetadataEventDetailViewModel(
@@ -164,9 +167,19 @@ class MetadataEventDetailViewModel(
publicKey publicKey
), ),
kinds = arrayOf( kinds = arrayOf(
TextNoteEvent.KIND, PictureEvent.KIND,
),
limit = 50
)
}
MetadataEventDetailType.Shorts -> {
SynchronizationFilter(
authors = arrayOf(
publicKey
),
kinds = arrayOf(
VideoShortEvent.KIND,
), ),
// TODO: filter for tags of pictures...
limit = 50 limit = 50
) )
} }
@@ -176,9 +189,8 @@ class MetadataEventDetailViewModel(
publicKey publicKey
), ),
kinds = arrayOf( kinds = arrayOf(
TextNoteEvent.KIND, VideoNormalEvent.KIND,
), ),
// TODO: filter for tags of videos...
limit = 50 limit = 50
) )
} }
@@ -21,12 +21,15 @@ import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
import com.vitorpamplona.quartz.nip68Picture.PictureEvent
import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent
import com.vitorpamplona.quartz.nip71Video.VideoShortEvent
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO import kotlinx.coroutines.IO
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
enum class SearchResultType { enum class SearchResultType {
Posts, Articles, Profiles, Photos, Videos Posts, Articles, Profiles, Photos, Shorts, Videos
} }
class SearchResultViewModel( class SearchResultViewModel(
@@ -87,7 +90,7 @@ class SearchResultViewModel(
SearchResultType.Photos -> { SearchResultType.Photos -> {
SynchronizationFilter( SynchronizationFilter(
kinds = arrayOf( kinds = arrayOf(
TextNoteEvent.KIND, PictureEvent.KIND,
), ),
// TODO: filter for tags of pictures... // TODO: filter for tags of pictures...
search = searchQuery, search = searchQuery,
@@ -97,7 +100,17 @@ class SearchResultViewModel(
SearchResultType.Videos -> { SearchResultType.Videos -> {
SynchronizationFilter( SynchronizationFilter(
kinds = arrayOf( kinds = arrayOf(
TextNoteEvent.KIND, VideoNormalEvent.KIND,
),
// TODO: filter for tags of videos...
search = searchQuery,
limit = 50
)
}
SearchResultType.Shorts -> {
SynchronizationFilter(
kinds = arrayOf(
VideoShortEvent.KIND,
), ),
// TODO: filter for tags of videos... // TODO: filter for tags of videos...
search = searchQuery, search = searchQuery,