소스 검색

+ 默认使用OkHttp3作为网络请求实现

drake 5 년 전
부모
커밋
2b25320fa1
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      net/src/main/java/com/drake/net/NetConfig.kt

+ 2 - 0
net/src/main/java/com/drake/net/NetConfig.kt

@@ -18,6 +18,7 @@ import com.drake.net.scope.DialogCoroutineScope
 import com.drake.tooltip.toast
 import com.yanzhenjie.kalle.Kalle
 import com.yanzhenjie.kalle.KalleConfig
+import com.yanzhenjie.kalle.OkHttpConnectFactory
 import com.yanzhenjie.kalle.exception.*
 import com.yanzhenjie.kalle.simple.cache.DiskCacheStore
 import java.util.concurrent.ExecutionException
@@ -99,6 +100,7 @@ fun Application.initNet(host: String, config: KalleConfig.Builder.() -> Unit = {
     NetConfig.host = host
     NetConfig.app = this
     val builder = KalleConfig.newBuilder()
+    builder.connectFactory(OkHttpConnectFactory.newBuilder().build())
     builder.config()
     Kalle.setConfig(builder.build())
 }