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 | 否 |
### 使用
#### 1.0.8
#### 1.0.12
```kotlin
repositories {
google()

View File

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

View File

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