mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-02 13:00:01 -04:00
Also search in category descriptions
this is currently limited to the current locale, so requires translations to exist for that.
This commit is contained in:
@@ -58,7 +58,11 @@ constructor(
|
||||
db.getRepositoryDao().getLiveCategories().asFlow().map { categories ->
|
||||
categories
|
||||
.map { category ->
|
||||
CategoryItem(id = category.id, name = category.getName(localeList) ?: "Unknown Category")
|
||||
CategoryItem(
|
||||
id = category.id,
|
||||
name = category.getName(localeList) ?: "Unknown Category",
|
||||
description = category.getDescription(localeList),
|
||||
)
|
||||
}
|
||||
.sortedWith { c1, c2 -> collator.compare(c1.name, c2.name) }
|
||||
}
|
||||
@@ -113,7 +117,9 @@ constructor(
|
||||
val timedCategories = measureTimedValue {
|
||||
categories.first().filter {
|
||||
// normalization removed diacritics, so searches without them work
|
||||
it.name.normalize().contains(sanitized.normalize(), ignoreCase = true)
|
||||
val normalized = sanitized.normalize()
|
||||
it.name.normalize().contains(normalized, ignoreCase = true) ||
|
||||
(it.description?.normalize()?.contains(normalized, ignoreCase = true) ?: false)
|
||||
}
|
||||
}
|
||||
_searchResults.value = SearchResults(timedApps.value, timedCategories.value)
|
||||
|
||||
@@ -74,7 +74,7 @@ import androidx.compose.material.icons.filled.Wallpaper
|
||||
import androidx.compose.material.icons.filled.WbSunny
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
||||
data class CategoryItem(val id: String, val name: String) {
|
||||
data class CategoryItem(val id: String, val name: String, val description: String? = null) {
|
||||
val imageVector: ImageVector
|
||||
get() =
|
||||
when (id) {
|
||||
|
||||
Reference in New Issue
Block a user