Add filters for gallery (pictures/videos) events

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

View File

@@ -217,6 +217,9 @@ fun SearchResultScreen(
SearchResultType.Videos -> {
Text("Videos")
}
SearchResultType.Shorts -> {
Text("Shorts")
}
}
when (val searchResultListUIState = searchViewModel.searchResultListUIState) {
@@ -234,6 +237,7 @@ fun SearchResultScreen(
}
}
is SearchResultListUIState.Loaded -> {
// TODO: Handle gallery UI
if (searchResultListUIState.localNostrEvents.isEmpty()) {
Column(
modifier = Modifier.fillMaxWidth(),

View File

@@ -273,7 +273,7 @@ fun MetadataEventDetail(
when (metadataEventDetailType) {
MetadataEventDetailType.Posts, MetadataEventDetailType.Replies,
MetadataEventDetailType.Articles, MetadataEventDetailType.Zaps,
MetadataEventDetailType.Photos, MetadataEventDetailType.Videos,
MetadataEventDetailType.Photos, MetadataEventDetailType.Shorts, MetadataEventDetailType.Videos,
MetadataEventDetailType.Bookmarks, MetadataEventDetailType.Reports, MetadataEventDetailType.Relays -> {
val feedListViewModel: FeedListViewModel = viewModel(
key = metadataEventDetailType.name,
@@ -294,7 +294,7 @@ fun MetadataEventDetail(
feedListViewModel.initiate()
}
}
// TODO: Support gallery feeds...
MetadataEventDetailType.Following -> {
val followingListViewModel: FollowingListViewModel = viewModel(
key = metadataEventDetailType.name,

View File

@@ -33,12 +33,15 @@ import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent
import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent
import com.vitorpamplona.quartz.nip56Reports.ReportEvent
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.IO
import kotlinx.coroutines.launch
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(
@@ -164,9 +167,19 @@ class MetadataEventDetailViewModel(
publicKey
),
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
)
}
@@ -176,9 +189,8 @@ class MetadataEventDetailViewModel(
publicKey
),
kinds = arrayOf(
TextNoteEvent.KIND,
VideoNormalEvent.KIND,
),
// TODO: filter for tags of videos...
limit = 50
)
}

View File

@@ -21,12 +21,15 @@ import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
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.IO
import kotlinx.coroutines.launch
enum class SearchResultType {
Posts, Articles, Profiles, Photos, Videos
Posts, Articles, Profiles, Photos, Shorts, Videos
}
class SearchResultViewModel(
@@ -87,7 +90,7 @@ class SearchResultViewModel(
SearchResultType.Photos -> {
SynchronizationFilter(
kinds = arrayOf(
TextNoteEvent.KIND,
PictureEvent.KIND,
),
// TODO: filter for tags of pictures...
search = searchQuery,
@@ -97,7 +100,17 @@ class SearchResultViewModel(
SearchResultType.Videos -> {
SynchronizationFilter(
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...
search = searchQuery,