Autocomplete tag input

This commit is contained in:
MM20
2022-09-22 22:22:40 +02:00
parent 5073cb0297
commit 060e2975aa
5 changed files with 102 additions and 80 deletions
@@ -30,6 +30,8 @@ interface CustomAttributesRepository {
suspend fun export(toDir: File)
suspend fun import(fromDir: File)
suspend fun getAllTags(startsWith: String? = null): List<String>
}
internal class CustomAttributesRepositoryImpl(
@@ -103,6 +105,15 @@ internal class CustomAttributesRepositoryImpl(
}
}
override suspend fun getAllTags(startsWith: String?): List<String> {
val dao = appDatabase.customAttrsDao()
return if (startsWith != null) {
dao.getAllTagsLike("$startsWith%")
} else {
dao.getAllTags()
}
}
override suspend fun search(query: String): Flow<List<Searchable>> {
if (query.isBlank()) {
return flow {