mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 19:04:39 -05:00
don't cancel me shit
This commit is contained in:
@@ -4,10 +4,8 @@ package eu.kanade.tachiyomi.network
|
|||||||
// import eu.kanade.tachiyomi.BuildConfig
|
// import eu.kanade.tachiyomi.BuildConfig
|
||||||
// import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
// import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import okhttp3.Dispatcher
|
|
||||||
// import okhttp3.HttpUrl.Companion.toHttpUrl
|
// import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import java.util.concurrent.Executors
|
|
||||||
// import okhttp3.dnsoverhttps.DnsOverHttps
|
// import okhttp3.dnsoverhttps.DnsOverHttps
|
||||||
// import okhttp3.logging.HttpLoggingInterceptor
|
// import okhttp3.logging.HttpLoggingInterceptor
|
||||||
// import uy.kohesive.injekt.injectLazy
|
// import uy.kohesive.injekt.injectLazy
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ fun Call.asObservable(): Observable<Response> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun unsubscribe() {
|
override fun unsubscribe() {
|
||||||
call.cancel()
|
// call.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isUnsubscribed(): Boolean {
|
override fun isUnsubscribed(): Boolean {
|
||||||
@@ -81,12 +81,12 @@ fun Call.asObservable(): Observable<Response> {
|
|||||||
|
|
||||||
fun Call.asObservableSuccess(): Observable<Response> {
|
fun Call.asObservableSuccess(): Observable<Response> {
|
||||||
return asObservable()
|
return asObservable()
|
||||||
// .doOnNext { response ->
|
.doOnNext { response ->
|
||||||
// if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
// response.close()
|
response.close()
|
||||||
// throw Exception("HTTP error ${response.code}")
|
throw Exception("HTTP error ${response.code}")
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call {
|
// fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ package ir.armor.tachidesk.util
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
|
||||||
import eu.kanade.tachiyomi.network.newCallWithProgress
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import ir.armor.tachidesk.database.table.ChapterTable
|
import ir.armor.tachidesk.database.table.ChapterTable
|
||||||
@@ -60,12 +58,7 @@ fun getPageImage(mangaId: Int, chapterId: Int, index: Int): Pair<InputStream, St
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: line bellow somehow closes the okhttp reqest!
|
val response = source.fetchImage(tachiPage).toBlocking().first()
|
||||||
// val response = source.fetchImage(tachiPage).toBlocking().first()
|
|
||||||
// Note: also this which is the same
|
|
||||||
// val response = source.client.newCallWithProgress(source.imageRequest(tachiPage), tachiPage)
|
|
||||||
// .asObservableSuccess().toBlocking().first()
|
|
||||||
val response = source.client.newCall(source.imageRequest(tachiPage)).execute()
|
|
||||||
|
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
val contentType = response.headers["content-type"]!!
|
val contentType = response.headers["content-type"]!!
|
||||||
|
|||||||
Reference in New Issue
Block a user