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

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

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

Loading…
Cancel
Save