Browse Source

1.增加第一次策略请求延迟,防止列表无法展示。

20241218TB223FC(测试jar包)
wangwanlei 3 months ago
parent
commit
ede66653cb
1 changed files with 21 additions and 10 deletions
  1. 21
    10
      app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt

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

179
                 CrashReport.setUserId(it.userid.toString())
179
                 CrashReport.setUserId(it.userid.toString())
180
             }
180
             }
181
         }
181
         }
182
-        //自动同时一次时间
183
-        viewModel.postSyncTime()
184
-        viewModel.timeResultData.observe(this) {
185
-            ManageApplication.setSysTime(it)
186
-        }
187
         lifecycleScope.launch {
182
         lifecycleScope.launch {
188
             withContext(Dispatchers.IO) {
183
             withContext(Dispatchers.IO) {
189
                 val file = File(filesDir, "wallpaper.png")
184
                 val file = File(filesDir, "wallpaper.png")
602
                 }
597
                 }
603
             }
598
             }
604
         }
599
         }
605
-        getLocation()
606
-        startWorkManager()
607
-        lastTimeLong = System.currentTimeMillis()
608
-        isCreatFlag = true
609
-        updateAllStrategy()
600
+        viewModel.timeResultData.observe(this) {
601
+            ManageApplication.setSysTime(it)
602
+            try {
603
+                tipsDialog?.dismiss()
604
+            }catch (e:Exception){
605
+
606
+            }
607
+        }
608
+
609
+        lifecycleScope.launch {
610
+            withContext(Dispatchers.IO){
611
+                delay(2000)
612
+            }
613
+            //自动同时一次时间
614
+            viewModel.postSyncTime()
615
+            lastTimeLong = System.currentTimeMillis()
616
+            getLocation()
617
+            startWorkManager()
618
+            isCreatFlag = true
619
+            updateAllStrategy()
620
+        }
610
     }
621
     }
611
 
622
 
612
     private fun startAutoApp(autoAppBean: AutoAppBean) {
623
     private fun startAutoApp(autoAppBean: AutoAppBean) {

Loading…
Cancel
Save