mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 13:37:29 +01:00
Minor cleanup
This commit is contained in:
@@ -182,13 +182,15 @@ open class GlobalSearchPresenter(
|
||||
.map { result ->
|
||||
items
|
||||
.map { item -> if (item.source == result.source) result else item }
|
||||
.sortedWith(compareBy(
|
||||
// Bubble up sources that actually have results
|
||||
{ it.results.isNullOrEmpty() },
|
||||
// Same as initial sort, i.e. pinned first then alphabetically
|
||||
{ it.source.id.toString() !in pinnedSourceIds },
|
||||
{ "${it.source.name} (${it.source.lang})" }
|
||||
))
|
||||
.sortedWith(
|
||||
compareBy(
|
||||
// Bubble up sources that actually have results
|
||||
{ it.results.isNullOrEmpty() },
|
||||
// Same as initial sort, i.e. pinned first then alphabetically
|
||||
{ it.source.id.toString() !in pinnedSourceIds },
|
||||
{ "${it.source.name} (${it.source.lang})" }
|
||||
)
|
||||
)
|
||||
}
|
||||
// Update current state
|
||||
.doOnNext { items = it }
|
||||
|
||||
Reference in New Issue
Block a user