diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt index 991a84183..bd7e2f5f5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt @@ -228,18 +228,24 @@ class SearchBarViewModel( val filtered = if (follows != null) raw.filter { it.author?.pubkeyHex in follows } else raw when (order) { - SearchSortOrder.POPULAR -> + SearchSortOrder.POPULAR -> { filtered.sortedWith( compareByDescending { it.zapsAmount } .thenByDescending { it.createdAt() ?: 0L }, ) + } - SearchSortOrder.OLDEST -> + SearchSortOrder.OLDEST -> { filtered.sortedBy { it.createdAt() ?: 0L } + } - SearchSortOrder.RELEVANCE, SearchSortOrder.NEWEST -> filtered.sortedWith(DefaultFeedOrder) + SearchSortOrder.RELEVANCE, SearchSortOrder.NEWEST -> { + filtered.sortedWith(DefaultFeedOrder) + } - else -> filtered.sortedWith(DefaultFeedOrder) + else -> { + filtered.sortedWith(DefaultFeedOrder) + } } }.flowOn(Dispatchers.IO) .stateIn(viewModelScope, WhileSubscribed(5000), emptyList()) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt index decabb57f..e5479e836 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchScreen.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.search import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxHeight