Fix some Feed add bugs

This commit is contained in:
Jobobby04 2022-10-14 17:19:01 -04:00
parent 24593da484
commit 861481bf26

View File

@ -114,17 +114,20 @@ open class FeedPresenter(
} }
} }
suspend fun hasTooManyFeeds(): Boolean { private suspend fun hasTooManyFeeds(): Boolean {
return countFeedSavedSearchGlobal.await() > 10 return countFeedSavedSearchGlobal.await() > 10
} }
fun getEnabledSources(): List<CatalogueSource> { fun getEnabledSources(): List<CatalogueSource> {
val languages = sourcePreferences.enabledLanguages().get() val languages = sourcePreferences.enabledLanguages().get()
val pinnedSources = sourcePreferences.pinnedSources().get() val pinnedSources = sourcePreferences.pinnedSources().get()
val disabledSources = sourcePreferences.disabledSources().get()
.mapNotNull { it.toLongOrNull() }
val list = sourceManager.getVisibleCatalogueSources() val list = sourceManager.getVisibleCatalogueSources()
.filter { it.lang in languages } .filter { it.lang in languages }
.sortedBy { "(${it.lang}) ${it.name}" } .filterNot { it.id in disabledSources }
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { "(${it.lang}) ${it.name}" })
return list.sortedBy { it.id.toString() !in pinnedSources } return list.sortedBy { it.id.toString() !in pinnedSources }
} }