Pinned sources now listed first in global search

This commit is contained in:
Jay 2020-05-10 14:37:22 -04:00
parent 1cca914c8f
commit b809f57950

View file

@ -102,11 +102,13 @@ open class SourceSearchPresenter(
protected open fun getEnabledSources(): List<CatalogueSource> { protected open fun getEnabledSources(): List<CatalogueSource> {
val languages = preferencesHelper.enabledLanguages().getOrDefault() val languages = preferencesHelper.enabledLanguages().getOrDefault()
val hiddenCatalogues = preferencesHelper.hiddenSources().getOrDefault() val hiddenCatalogues = preferencesHelper.hiddenSources().getOrDefault()
val pinnedCatalogues = preferencesHelper.pinnedCatalogues().getOrDefault()
return sourceManager.getCatalogueSources() return sourceManager.getCatalogueSources()
.filter { it.lang in languages } .filter { it.lang in languages }
.filterNot { it.id.toString() in hiddenCatalogues } .filterNot { it.id.toString() in hiddenCatalogues }
.sortedBy { "(${it.lang}) ${it.name}" } .sortedBy { "(${it.lang}) ${it.name}" }
.sortedBy { it.id.toString() !in pinnedCatalogues }
} }
private fun getSourcesToQuery(): List<CatalogueSource> { private fun getSourcesToQuery(): List<CatalogueSource> {