From d63c083c06b2ff63ef13e44115a13c531adde675 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Wed, 17 Jun 2026 19:05:49 +0300 Subject: [PATCH] Clean up search results --- .../ui/composable/SearchResultScreen.kt | 17 +----- .../ui/view/model/SearchResultViewModel.kt | 55 +------------------ 2 files changed, 3 insertions(+), 69 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/composable/SearchResultScreen.kt b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/composable/SearchResultScreen.kt index 3c856b09..0ce11a97 100644 --- a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/composable/SearchResultScreen.kt +++ b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/composable/SearchResultScreen.kt @@ -67,7 +67,7 @@ fun SearchResultScreen( val searchViewModel: at.torch.compose.ui.view.model.SearchResultViewModel = viewModel( factory = _root_ide_package_.at.torch.compose.ui.view.model.SearchResultViewModel.Companion.factory( - initialSearchResultType = _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Posts, + initialSearchResultType = _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Profiles, searchQuery = searchQuery, nostrRepository = nostrRepository, searchRepository = searchRepository @@ -196,24 +196,9 @@ fun SearchResultScreen( horizontalAlignment = Alignment.CenterHorizontally ) { when(_root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.entries[pageIndex]) { - _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Posts -> { - Text("Posts") - } - _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Articles -> { - Text("Articles") - } _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Profiles -> { Text("Profiles") } - _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Photos -> { - Text("Photos") - } - _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Videos -> { - Text("Videos") - } - _root_ide_package_.at.torch.compose.ui.view.model.SearchResultType.Shorts -> { - Text("Shorts") - } } when (val searchResultListUIState = searchViewModel.searchResultListUIState) { diff --git a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/SearchResultViewModel.kt b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/SearchResultViewModel.kt index 491d1c7a..a3cc70c8 100755 --- a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/SearchResultViewModel.kt +++ b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/SearchResultViewModel.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch enum class SearchResultType { - Posts, Articles, Profiles, Photos, Shorts, Videos + Profiles } class SearchResultViewModel( @@ -55,18 +55,6 @@ class SearchResultViewModel( fun initiateSearchResults(searchResultType: SearchResultType = this.searchResultType) { logger.d("initiateSearchResults") val synchronizationFilter = when (searchResultType) { - SearchResultType.Posts -> { - _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( - kinds = arrayOf( - TextNoteEvent.KIND, - RepostEvent.KIND, - ReactionEvent.KIND, - LnZapEvent.KIND, - ), - search = searchQuery, - limit = 50 - ) - } SearchResultType.Profiles -> { _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( kinds = arrayOf( @@ -76,45 +64,6 @@ class SearchResultViewModel( limit = 50 ) } - SearchResultType.Articles -> { - _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( - kinds = arrayOf( - LongTextNoteEvent.KIND, - ), - search = searchQuery, - limit = 50 - ) - } - SearchResultType.Photos -> { - _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( - kinds = arrayOf( - PictureEvent.KIND, - ), - // TODO: filter for tags of pictures... - search = searchQuery, - limit = 50 - ) - } - SearchResultType.Videos -> { - _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( - kinds = arrayOf( - VideoNormalEvent.KIND, - ), - // TODO: filter for tags of videos... - search = searchQuery, - limit = 50 - ) - } - SearchResultType.Shorts -> { - _root_ide_package_.at.torch.compose.database.model.types.SynchronizationFilter( - kinds = arrayOf( - VideoShortEvent.KIND, - ), - // TODO: filter for tags of videos... - search = searchQuery, - limit = 50 - ) - } } saveSearchQuery(synchronizationFilter) @@ -169,7 +118,7 @@ class SearchResultViewModel( const val TAG = "SearchViewModel" fun factory( - initialSearchResultType: SearchResultType = SearchResultType.Posts, + initialSearchResultType: SearchResultType = SearchResultType.Profiles, searchQuery: String, nostrRepository: at.torch.compose.repository.NostrRepository, searchRepository: at.torch.compose.repository.SearchRepository,