feat: 适配okhttp3

This commit is contained in:
yangxisong 2025-12-16 09:44:48 +08:00
parent 0391c73916
commit 787df0801b
3 changed files with 12 additions and 8 deletions

View File

@ -7,7 +7,7 @@ Room 数据持久化Worker管理上传任务初次上传+重试共5次
| release | https://track.23544.com | 否 | | release | https://track.23544.com | 否 |
### 使用 ### 使用
#### 1.0.8 #### 1.0.12
```kotlin ```kotlin
repositories { repositories {
google() google()

View File

@ -7,7 +7,7 @@ plugins {
id("maven-publish") id("maven-publish")
} }
group = "com.yuanxuan" group = "com.yuanxuan"
version = "1.0.10" version = "1.0.12"
val baseReleaseUrl: Provider<String> = providers.gradleProperty("baseReleaseUrl") val baseReleaseUrl: Provider<String> = providers.gradleProperty("baseReleaseUrl")
@ -51,8 +51,12 @@ android {
} }
publishing { publishing {
singleVariant("debug") singleVariant("debug"){
singleVariant("release") withSourcesJar()
}
singleVariant("release"){
withSourcesJar()
}
} }
} }

View File

@ -6,8 +6,8 @@ import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory import retrofit2.converter.moshi.MoshiConverterFactory
import java.util.concurrent.TimeUnit
import kotlin.jvm.java import kotlin.jvm.java
import kotlin.time.Duration.Companion.seconds
internal object RetrofitClient { internal object RetrofitClient {
private val okHttpClient: OkHttpClient by lazy { private val okHttpClient: OkHttpClient by lazy {
@ -19,9 +19,9 @@ internal object RetrofitClient {
} }
} }
OkHttpClient.Builder() OkHttpClient.Builder()
.connectTimeout(15.seconds) .connectTimeout(15L, TimeUnit.SECONDS)
.readTimeout(30.seconds) .readTimeout(30L, TimeUnit.SECONDS)
.writeTimeout(30.seconds) .writeTimeout(30L, TimeUnit.SECONDS)
.addInterceptor(httpLoggingInterceptor) .addInterceptor(httpLoggingInterceptor)
.build() .build()
} }