浏览代码

+ 默认使用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())
 }