Browse Source

1.替换拦截器,修改策略启动时间。

2025_1_17_tb223fc
wangwanlei 1 week ago
parent
commit
244fd10f6a

+ 3
- 2
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

776
             lastTimeLong = System.currentTimeMillis()
776
             lastTimeLong = System.currentTimeMillis()
777
             getLocation()
777
             getLocation()
778
             startWorkManager()
778
             startWorkManager()
779
-            updateAllStrategy()
779
+            //updateAllStrategy()
780
         }
780
         }
781
     }
781
     }
782
 
782
 
1083
     //亮屏,点击,和onresume都执行这个请求策略的方法,达到次数则请求策略。
1083
     //亮屏,点击,和onresume都执行这个请求策略的方法,达到次数则请求策略。
1084
     private fun updateResumeStrategy() {
1084
     private fun updateResumeStrategy() {
1085
         //在activity中判断,如果连续10分钟都没执行则重启任务。
1085
         //在activity中判断,如果连续10分钟都没执行则重启任务。
1086
-        if (System.currentTimeMillis() - TimingWorker.lastTime > 10 * 60 * 1000) {
1086
+        if (!isCreatFlag&&System.currentTimeMillis() - TimingWorker.lastTime > 10 * 60 * 1000) {
1087
             startWorkManager()
1087
             startWorkManager()
1088
         }
1088
         }
1089
         lifecycleScope.launch(Dispatchers.IO) {
1089
         lifecycleScope.launch(Dispatchers.IO) {
1429
                 }
1429
                 }
1430
             }*/
1430
             }*/
1431
             //没有单点登录所以不再判断
1431
             //没有单点登录所以不再判断
1432
+            LogShow("打开app拉起请求,type==$type")
1432
             userBean?.let {
1433
             userBean?.let {
1433
                 netAutoAppFlag = true
1434
                 netAutoAppFlag = true
1434
                 viewModel.postAutoAppDetail(it.regionid)
1435
                 viewModel.postAutoAppDetail(it.regionid)

+ 4
- 2
corelib/src/main/java/com/xhly/corelib/network/RetrofitService.kt View File

1
 package com.xhly.corelib.network
1
 package com.xhly.corelib.network
2
 
2
 
3
+import CustomLogInterceptor
3
 import android.annotation.SuppressLint
4
 import android.annotation.SuppressLint
4
 import android.util.Log
5
 import android.util.Log
5
 import com.xhly.corelib.Const
6
 import com.xhly.corelib.Const
35
 
36
 
36
     private fun getClient(): OkHttpClient {
37
     private fun getClient(): OkHttpClient {
37
 
38
 
38
-        val interceptor = HttpLoggingInterceptor { message ->
39
+     /*   val interceptor = HttpLoggingInterceptor { message ->
39
             try {
40
             try {
40
                 val text: String = URLDecoder.decode(message, "utf-8")
41
                 val text: String = URLDecoder.decode(message, "utf-8")
41
                 LogShow("OKHttp-----"+text)
42
                 LogShow("OKHttp-----"+text)
50
                 }
51
                 }
51
             }
52
             }
52
         }
53
         }
53
-        interceptor.level = HttpLoggingInterceptor.Level.BODY
54
+        interceptor.level = HttpLoggingInterceptor.Level.BODY*/
55
+        val interceptor=CustomLogInterceptor()
54
         return OkHttpClient.Builder()
56
         return OkHttpClient.Builder()
55
            /* .proxy(Proxy.NO_PROXY)*/
57
            /* .proxy(Proxy.NO_PROXY)*/
56
             .retryOnConnectionFailure(true)
58
             .retryOnConnectionFailure(true)

Loading…
Cancel
Save