Browse Source

更新文档和依赖

drake 3 years ago
parent
commit
bb9e8e55ba
3 changed files with 25 additions and 22 deletions
  1. 11 10
      docs/log-notice.md
  2. 4 4
      sample/build.gradle
  3. 10 8
      sample/src/main/java/com/drake/net/sample/base/App.kt

+ 11 - 10
docs/log-notice.md

@@ -7,8 +7,7 @@
 添加依赖
 
 ```groovy
-debugImplementation "com.github.chuckerteam.chucker:library:3.5.2"
-releaseImplementation "com.github.chuckerteam.chucker:library-no-op:3.5.2" // release安装包自动会无效
+implementation "com.github.chuckerteam.chucker:library:3.5.2"
 ```
 
 添加拦截器
@@ -21,14 +20,16 @@ override fun onCreate() {
 
     NetConfig.initialize("https://github.com/liangjingkanji/", this) {
         // ...
-        addInterceptor(
-            ChuckerInterceptor.Builder(this@App)
-                .collector(ChuckerCollector(this@App))
-                .maxContentLength(250000L)
-                .redactHeaders(emptySet())
-                .alwaysReadResponseBody(false)
-                .build()
-        )
+        if (BuildConfig.DEBUG) {
+            addInterceptor(
+                ChuckerInterceptor.Builder(this@App)
+                    .collector(ChuckerCollector(this@App))
+                    .maxContentLength(250000L)
+                    .redactHeaders(emptySet())
+                    .alwaysReadResponseBody(false)
+                    .build()
+            )
+        }
     }
 }
 ```

+ 4 - 4
sample/build.gradle

@@ -91,14 +91,14 @@ dependencies {
     kapt "com.squareup.moshi:moshi-kotlin-codegen:1.8.0"
     implementation 'com.google.code.gson:gson:2.8.6'
     implementation 'com.alibaba:fastjson:1.2.73'
-    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0"
+    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
 
     // ------------------------------其他库-------------------------------------
     implementation "com.github.bumptech.glide:glide:$glide_version" // 图片加载库
-    implementation 'com.github.liangjingkanji:StatusBar:1.1.1' // 透明状态栏
+    implementation 'com.github.liangjingkanji:StatusBar:2.0.2' // 透明状态栏
     implementation 'com.github.liangjingkanji:debugkit:1.2.11' // 开发调试窗口工具
-    implementation "com.github.liangjingkanji:Tooltip:1.1.2" // 吐司工具
-    implementation 'com.github.liangjingkanji:Engine:0.0.25'
+    implementation "com.github.liangjingkanji:Tooltip:1.1.7" // 吐司工具
+    implementation 'com.github.liangjingkanji:Engine:0.0.60'
 
     // ------------------------------Google数据库-------------------------------------
     implementation "androidx.room:room-runtime:$room_version"

+ 10 - 8
sample/src/main/java/com/drake/net/sample/base/App.kt

@@ -61,14 +61,16 @@ class App : Application() {
             addInterceptor(LogRecordInterceptor(BuildConfig.DEBUG))
 
             // 通知栏监听网络日志
-            addInterceptor(
-                ChuckerInterceptor.Builder(this@App)
-                    .collector(ChuckerCollector(this@App))
-                    .maxContentLength(250000L)
-                    .redactHeaders(emptySet())
-                    .alwaysReadResponseBody(false)
-                    .build()
-            )
+            if (BuildConfig.DEBUG) {
+                addInterceptor(
+                    ChuckerInterceptor.Builder(this@App)
+                        .collector(ChuckerCollector(this@App))
+                        .maxContentLength(250000L)
+                        .redactHeaders(emptySet())
+                        .alwaysReadResponseBody(false)
+                        .build()
+                )
+            }
 
             // 添加请求拦截器, 可配置全局/动态参数
             setRequestInterceptor(MyRequestInterceptor())