1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 13:57:10 +09:00

When searching for pages, if query text is empty space, query returns only pages where title contains empty spaces (#747)

This commit is contained in:
Evgenii Kozlov 2020-08-28 18:00:15 +03:00 committed by GitHub
parent 65d79a0cc8
commit 2b29ad7e0e
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -4,6 +4,7 @@
### Fixes & tech 🚒
* When searching for pages, if filter text is empty space, query returns only pages where title contains empty spaces (#746)
* Regression. Text is not always set when creating a lot of text blocks (#741)
* Respective theme colors should differ for text color and background colors in action menu (#738)
* Fix app configuration lifetime (#735)

View file

@ -53,15 +53,15 @@ class PageSearchViewModel(
}
private fun proceedWithResults(original: List<PageLinkView>, filter: String) {
val filtered = original.filterBy(filter)
when (filtered.isNotEmpty()) {
true -> stateData.postValue(PageSearchView.Success(pages = filtered))
false -> {
when (filter.isEmpty()) {
true -> stateData.postValue(PageSearchView.EmptyPages)
false -> stateData.postValue(PageSearchView.NoResults(filter))
}
}
val query = filter.trim()
val filtered = original.filterBy(query)
if (filtered.isNotEmpty()) {
stateData.postValue(PageSearchView.Success(pages = filtered))
} else {
if (query.isEmpty())
stateData.postValue(PageSearchView.EmptyPages)
else
stateData.postValue(PageSearchView.NoResults(query))
}
}