Clean up search results
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user