Skip to content

Commit

Permalink
allow search source using both source's name & extensions's name
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Feb 7, 2024
1 parent 20e3b12 commit a3e47a1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ class SourcesScreenModel(
// KMK -->
val queryFilter: (String?) -> ((Source) -> Boolean) = { query ->
filter@{ source ->
if (nsfwOnly && source.installedExtension != null && !source.installedExtension!!.isNsfw) return@filter false
if (nsfwOnly && source.installedExtension?.isNsfw == true) return@filter false
if (query.isNullOrBlank()) return@filter true
query.split(",").any {
val input = it.trim()
if (input.isEmpty()) return@any false
source.name.contains(input, ignoreCase = true) ||
source.installedExtension?.name?.contains(input, ignoreCase = true) == true ||
source.id == input.toLongOrNull()
}
}
Expand Down

0 comments on commit a3e47a1

Please sign in to comment.