Don't show items with custom label when query is blank
This commit is contained in:
parent
15837b0cdc
commit
ca7a736480
@ -9,6 +9,7 @@ import de.mm20.launcher2.ktx.jsonObjectOf
|
|||||||
import de.mm20.launcher2.search.data.Searchable
|
import de.mm20.launcher2.search.data.Searchable
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
@ -84,6 +85,11 @@ internal class CustomAttributesRepositoryImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): Flow<List<Searchable>> {
|
override suspend fun search(query: String): Flow<List<Searchable>> {
|
||||||
|
if (query.isBlank()) {
|
||||||
|
return flow {
|
||||||
|
emit(emptyList())
|
||||||
|
}
|
||||||
|
}
|
||||||
val dao = appDatabase.customAttrsDao()
|
val dao = appDatabase.customAttrsDao()
|
||||||
return dao.search("%$query%").map {
|
return dao.search("%$query%").map {
|
||||||
favoritesRepository.getFromKeys(it)
|
favoritesRepository.getFromKeys(it)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user