Introduce ktor http client with okhttp backend

This commit is contained in:
tarsin committed 2023-02-04 09:38:40 +08:00
1 parent 2c5646b1c2
commit 773993c6f2
3 files changed
+15

No files matched your search

+2
View File
@@ -190,6 +190,8 @@ dependencies {
// https://coil-kt.github.io/coil/changelog/
// implementation 'io.coil-kt:coil:2.2.2'
implementation("com.github.Ehviewer-Overhauled.coil:coil-compose:d65881d")
implementation("io.ktor:ktor-client-okhttp:2.2.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.5.0-RC")
implementation("org.jsoup:jsoup:1.15.3")
+3
View File
@@ -13,6 +13,9 @@
-keep class androidx.viewpager.widget.ViewPager$LayoutParams { int position; }
# Ktor logger
-dontwarn org.slf4j.impl.StaticLoggerBinder
-keepattributes LineNumberTable,SourceFile
-renamesourcefileattribute SourceFile
@@ -55,6 +55,8 @@ import com.hippo.yorozuya.IntIdGenerator
import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
import eu.kanade.tachiyomi.util.lang.launchIO
import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -312,6 +314,14 @@ class EhApplication : Application(), DefaultLifecycleObserver, ImageLoaderFactor
builder.build()
}
val ktorClient by lazy {
HttpClient(OkHttp) {
engine {
preconfigured = okHttpClient
}
}
}
@JvmStatic
val galleryDetailCache by lazy {
LruCache<Long, GalleryDetail>(25).also {