diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b823726a1..e4f6f6516 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -307,7 +307,7 @@ a.k.a. the Browse source entry point in the app (invoked by tapping on the sourc - The app calls `fetchPopularManga` which should return a `MangasPage` containing the first batch of found `SManga` entries. - This method supports pagination. When user scrolls the manga list and more results must be fetched, the app calls it again with increasing `page` values (starting with `page=1`). This continues while `MangasPage.hasNextPage` is passed as `true` and `MangasPage.mangas` is not empty. - To show the list properly, the app needs `url`, `title` and `thumbnail_url`. You **must** set them here. The rest of the fields could be filled later (refer to Manga Details below). - - You should set `thumbnail_url` if is available, if not, `fetchMangaDetails` will be **immediately** called (this will increase network calls heavily and should be avoided). + - You should set `thumbnail_url` if is available, if not, `getMangaDetails` will be **immediately** called (this will increase network calls heavily and should be avoided). #### Latest Manga @@ -350,15 +350,15 @@ open class UriPartFilter(displayName: String, private val vals: Array { + override suspend fun getMangaDetails(manga: SManga): SManga { return client.newCall(chapterListRequest(manga)) - .asObservableSuccess() - .map { response -> mangaDetailsParse(response, manga) } + .await() + .let { response -> mangaDetailsParse(response, manga) } } // Called when the series is loaded, or when opening in browser @@ -103,10 +104,10 @@ open class Cubari(override val lang: String) : HttpSource() { return parseManga(result, manga) } - override fun fetchChapterList(manga: SManga): Observable> { + override suspend fun getChapterList(manga: SManga): List { return client.newCall(chapterListRequest(manga)) - .asObservableSuccess() - .map { response -> chapterListParse(response, manga) } + .await() + .let { response -> chapterListParse(response, manga) } } // Gets the chapter list based on the series being viewed @@ -128,19 +129,19 @@ open class Cubari(override val lang: String) : HttpSource() { return parseChapterList(res, manga) } - override fun fetchPageList(chapter: SChapter): Observable> { + override suspend fun getPageList(chapter: SChapter): List { return when { chapter.url.contains("/chapter/") -> { client.newCall(pageListRequest(chapter)) - .asObservableSuccess() - .map { response -> + .await() + .let { response -> directPageListParse(response) } } else -> { client.newCall(pageListRequest(chapter)) - .asObservableSuccess() - .map { response -> + .await() + .let { response -> seriesJsonPageListParse(response, chapter) } } diff --git a/src/all/komga/build.gradle b/src/all/komga/build.gradle index f866a844f..d8f703466 100644 --- a/src/all/komga/build.gradle +++ b/src/all/komga/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Komga' pkgNameSuffix = 'all.komga' extClass = '.KomgaFactory' - extVersionCode = 48 + extVersionCode = 49 } apply from: "$rootDir/common.gradle" diff --git a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt index 3bfe5742f..970e47d0b 100644 --- a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt +++ b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt @@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.extension.all.komga.dto.PageWrapperDto import eu.kanade.tachiyomi.extension.all.komga.dto.ReadListDto import eu.kanade.tachiyomi.extension.all.komga.dto.SeriesDto import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.await import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.UnmeteredSource import eu.kanade.tachiyomi.source.model.Filter @@ -39,7 +39,6 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response -import rx.Observable import rx.Single import rx.schedulers.Schedulers import uy.kohesive.injekt.Injekt @@ -180,10 +179,10 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere override fun searchMangaParse(response: Response): MangasPage = processSeriesPage(response) - override fun fetchMangaDetails(manga: SManga): Observable { + override suspend fun getMangaDetails(manga: SManga): SManga { return client.newCall(GET(manga.url, headers)) - .asObservableSuccess() - .map { response -> + .await() + .let { response -> mangaDetailsParse(response).apply { initialized = true } } }