Fix batch add delegated sources

This commit is contained in:
Jobobby04 2020-06-21 00:44:04 -04:00
parent 0ce63d0adc
commit 70c98e9c2b
2 changed files with 13 additions and 0 deletions

View File

@ -78,6 +78,10 @@ open class SourceManager(private val context: Context) {
fun getVisibleCatalogueSources() = sourcesMap.values.filterIsInstance<CatalogueSource>().filter {
it.id !in BlacklistedSources.HIDDEN_SOURCES
}
fun getDelegatedCatalogueSources() = sourcesMap.values.filterIsInstance<EnhancedHttpSource>().mapNotNull { enhancedHttpSource ->
enhancedHttpSource.enchancedSource as? DelegatedHttpSource
}
// SY <--
internal fun registerSource(source: Source, overwrite: Boolean = false) {

View File

@ -37,6 +37,15 @@ class GalleryAdder {
}
} else {
sourceManager.getVisibleCatalogueSources()
.filterIsInstance<UrlImportableSource>()
.find {
try {
it.matchesUri(uri)
} catch (e: Exception) {
XLog.e("Source URI match check error!", e)
false
}
} ?: sourceManager.getDelegatedCatalogueSources()
.filterIsInstance<UrlImportableSource>()
.find {
try {