[Komga] Fix link to WebView/Share (#9361)

* use the correct link for viewing in browser

api url on browser just provides a json. For viewing in browser,
we need the normal url instead

* just use `substringAfter`

was trying out another way using `substringAfterLast` but dropped that.
Now `substringAfterLast` isn't required and `substringAfter` suffices

* make fetchMangaDetails not use mangaDetailsRequest

internally, `fetchMangaDetails` uses `mangaDetailsRequest` to create a
new call. However, since `mangaDetailsRequest` is now fixed to use a
normal browser URL rather than the API URL, it no longer works for
`fetchMangaDetails`. So, it needs to be manually overriden to make its
own call

* use hardcoded ID values instead of computing

this was done because of the following:
 - IDs are same as before
 - no need to rely on calculation to be correct everytime
 - avoids unnecessary copy of base class code
 - sets it in the constructor itself

* increment komga.extVersionCode

also update CHANGELOG with list of changes

* linting and remove unused imports

* Revert "linting and remove unused imports"

This reverts commit e13396badef53fced2700266182bbf53a67124cf.

* Revert "use hardcoded ID values instead of computing"

This reverts commit 44f063904d5969fb6d90c9ffad5c33aff50b995f.

* refactor `mangaDetailsRequest`

Do it in a simpler manner without having to create another variable

Co-authored-by: Gauthier <gotson@users.noreply.github.com>

Co-authored-by: Gauthier <gotson@users.noreply.github.com>
This commit is contained in:
nicki 2021-10-06 15:36:37 +05:30 committed by GitHub
parent 6a75de9261
commit c04984b89b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,24 @@
## 1.2.33
Minimum Komga version required: `0.113.0`
### Fix
* Open in WebView and Share options now open regular browser link instead of showing JSON
* Note that Komga cannot be viewed using System WebView since there is no login prompt
However, opening in a regular browser works.
## 1.2.32
Minimum Komga version required: `0.113.0`
### Fix
* Source language, conventionally set to "en", is now changed to "all"
* Downloaded files, if any, will have to be moved to new location
- `Komga (EN)` to `Komga (ALL)`
- `Komga (3) (EN)` to `Komga (3) (ALL)`
## 1.2.31
Minimum Komga version required: `0.113.0`

View File

@ -6,7 +6,7 @@ ext {
extName = 'Komga'
pkgNameSuffix = 'all.komga'
extClass = '.KomgaFactory'
extVersionCode = 32
extVersionCode = 33
}
dependencies {

View File

@ -15,6 +15,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.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
@ -33,6 +34,7 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.ResponseBody
import rx.Observable
import rx.Single
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
@ -175,8 +177,16 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
override fun searchMangaParse(response: Response): MangasPage =
processSeriesPage(response)
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
return client.newCall(GET(manga.url, headers))
.asObservableSuccess()
.map { response ->
mangaDetailsParse(response).apply { initialized = true }
}
}
override fun mangaDetailsRequest(manga: SManga): Request =
GET(manga.url, headers)
GET(manga.url.replaceFirst("api/v1/", "", ignoreCase = true), headers)
override fun mangaDetailsParse(response: Response): SManga {
val responseBody = response.body