Migrate to new URL import system

This commit is contained in:
NerdNumber9
2019-08-07 10:21:18 -04:00
parent 46636b537c
commit e915fd28cb
10 changed files with 231 additions and 168 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
package exh.util
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.online.UrlImportableSource
import exh.GalleryAddEvent
import exh.GalleryAdder
import rx.Observable
@@ -13,11 +13,11 @@ private val galleryAdder by lazy {
/**
* A version of fetchSearchManga that supports URL importing
*/
fun Source.urlImportFetchSearchManga(query: String, fail: () -> Observable<MangasPage>) =
fun UrlImportableSource.urlImportFetchSearchManga(query: String, fail: () -> Observable<MangasPage>) =
when {
query.startsWith("http://") || query.startsWith("https://") -> {
Observable.fromCallable {
val res = galleryAdder.addGallery(query, false, id)
val res = galleryAdder.addGallery(query, false, this)
MangasPage((if(res is GalleryAddEvent.Success)
listOf(res.manga)
else