Fix local source not working if english was disabled. Closes #848

This commit is contained in:
len 2017-06-17 12:46:34 +02:00
parent 5fec956ce6
commit 74a7e2a17e
2 changed files with 4 additions and 7 deletions

View File

@ -57,7 +57,7 @@ class LocalSource(private val context: Context) : CatalogueSource {
override val id = ID override val id = ID
override val name = "LocalSource" override val name = "LocalSource"
override val lang = "en" override val lang = ""
override val supportsLatest = true override val supportsLatest = true
override fun toString() = context.getString(R.string.local_source) override fun toString() = context.getString(R.string.local_source)

View File

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.MangaCategory
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
@ -303,15 +304,11 @@ open class CataloguePresenter(
val languages = prefs.enabledLanguages().getOrDefault() val languages = prefs.enabledLanguages().getOrDefault()
val hiddenCatalogues = prefs.hiddenCatalogues().getOrDefault() val hiddenCatalogues = prefs.hiddenCatalogues().getOrDefault()
// Ensure at least one language
if (languages.isEmpty()) {
languages.add("en")
}
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}" } +
sourceManager.get(LocalSource.ID) as LocalSource
} }
/** /**