Handle getImage for delegate sources

This commit is contained in:
Jobobby04
2023-02-09 17:44:21 -05:00
parent 83e23dedae
commit a51c25bdcf
6 changed files with 31 additions and 13 deletions
@@ -343,7 +343,8 @@ abstract class HttpSource : CatalogueSource {
*
* @param page the page whose source image has to be downloaded.
*/
suspend fun getImage(page: Page): Response {
/* SY --> */
open /* SY <-- */ suspend fun getImage(page: Page): Response {
// images will be cached or saved manually, so don't take up network cache
return client.newCachelessCallWithProgress(imageRequest(page), page)
.awaitSuccess()
@@ -266,6 +266,16 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
return delegate.fetchImage(page)
}
/**
* Returns the response of the source image.
*
* @param page the page whose source image has to be downloaded.
*/
override suspend fun getImage(page: Page): Response {
ensureDelegateCompatible()
return delegate.getImage(page)
}
/**
* Called before inserting a new chapter into database. Use it if you need to override chapter
* fields, like the title or the chapter number. Do not change anything to [manga].
@@ -233,6 +233,13 @@ class EnhancedHttpSource(
*/
override fun fetchImage(page: Page) = source().fetchImage(page)
/**
* Returns the response of the source image.
*
* @param page the page whose source image has to be downloaded.
*/
override suspend fun getImage(page: Page) = source().getImage(page)
/**
* Called before inserting a new chapter into database. Use it if you need to override chapter
* fields, like the title or the chapter number. Do not change anything to [manga].