File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
mvvm/src/main/java/com/catchpig/mvvm/network/manager Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11# CHANGE LOG
2+ ### v1.4.1
3+
4+ + 增加网络请求打印的总开关debug
5+
26### v1.4.0
37
48+ 优化Flow的lifecycle回调
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ class NetManager private constructor() {
2424
2525 private val serviceMap = hashMapOf<String , Any >()
2626
27+ private var debug: Boolean = false
28+
2729 fun <S : Any > getService (serviceClass : Class <S >, baseUrl : String? = null): S {
2830 val className = serviceClass.name
2931 val service = serviceMap[className]
@@ -46,6 +48,10 @@ class NetManager private constructor() {
4648 }
4749 }
4850
51+ fun setDebug (debug : Boolean ) {
52+ this .debug = debug
53+ }
54+
4955 private fun getClient (serviceParam : ServiceParam ): OkHttpClient {
5056 var builder = OkHttpClient
5157 .Builder ()
@@ -57,7 +63,7 @@ class NetManager private constructor() {
5763 * 读取数据超时时间
5864 */
5965 .readTimeout(serviceParam.readTimeout, TimeUnit .MILLISECONDS )
60- if (serviceParam.debug) {
66+ if (debug && serviceParam.debug) {
6167 serviceParam.debugInterceptors.forEach {
6268 builder = builder.addInterceptor(it)
6369 }
You can’t perform that action at this time.
0 commit comments