Преглед изворни кода

1.默认添加白名单地址。

2.限制经纬度上传频率。
20241218TB223FC(测试jar包)
wangwanlei пре 8 месеци
родитељ
комит
20d1e892ff

+ 1
- 0
app/src/main/java/com/xhly/manageapp/ManageApplication.kt Прегледај датотеку

@@ -565,6 +565,7 @@ class ManageApplication : MultiDexApplication() {
565 565
                 setUrlWhiteListEnable(true)
566 566
                 //先清除再添加
567 567
                 ClearIpHostRules()
568
+                list.add(Const.BASEURL)
568 569
                 csdkManager?.urlWhiteListWrite(list)
569 570
                 csdkManager?.urlBlackListWrite(arrayListOf("*"))
570 571
             }

+ 2
- 0
app/src/main/java/com/xhly/manageapp/bean/PadLocationConst.kt Прегледај датотеку

@@ -6,4 +6,6 @@ import com.xhly.manageapp.bean.log.PadLocationBean
6 6
 object PadLocationConst {
7 7
     val currentLocation=PadLocationBean()
8 8
     val lastLocation=PadLocationBean()
9
+    //记录上一次查询时间
10
+    var lastTimeLong=0L
9 11
 }

+ 3
- 2
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Прегледај датотеку

@@ -443,7 +443,6 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
443 443
         }
444 444
 
445 445
         viewModel.viewModelScope.launch {
446
-
447 446
             viewModel.netWhiteListData.collect {
448 447
                it?.let {
449 448
                    StrategyUtils.setNetWhiteList(it)
@@ -1075,7 +1074,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1075 1074
                 location.address=addrStr
1076 1075
                 try {
1077 1076
                     val lastLocation = PadLocationConst.lastLocation
1078
-                    if (location.lat!=null&&location.lon!=null&&(lastLocation.lon!=location.lon&&lastLocation.lat!=location.lat)&&!addrStr.isNullOrBlank()){
1077
+                    //经纬度变动,并且上次传值时间超过一分钟才能再次发送定位。
1078
+                    if (location.lat!=null&&location.lon!=null&&(lastLocation.lon!=location.lon&&lastLocation.lat!=location.lat)&&!addrStr.isNullOrBlank()&&System.currentTimeMillis()-PadLocationConst.lastTimeLong>1000*60){
1079
+                        PadLocationConst.lastTimeLong=System.currentTimeMillis()
1079 1080
                         lastLocation.lat=location.lat
1080 1081
                         lastLocation.lon=location.lon
1081 1082
                         ManageApplication.getDeviceInfo()?.let {

+ 1
- 8
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt Прегледај датотеку

@@ -452,14 +452,7 @@ object StrategyUtils {
452 452
                 Const.CURRENTAPPPKG,
453 453
                 Const.CURRENTAPPPKG + ".ui.ManageActivity"
454 454
             )
455
-            //ManageApplication.enableOverlayWindow()
456
-            if (Const.isDebug){
457
-                ManageApplication.setPackageEnabled("com.xhly.easystud", true)
458
-                ManageApplication.setUrlWhiteListEnable(false)
459
-                ManageApplication.disableStatusBarPanel(false)
460
-                ManageApplication.hideHomeSoftKey(false)
461
-                ManageApplication.hideMenuSoftKey(false)
462
-            }
455
+            ManageApplication.setUrlWhiteListWrite(arrayListOf())
463 456
             ManageApplication.urlWhiteListRead().forEach {
464 457
                 LogShow("白名单有$it")
465 458
             }

+ 3
- 1
corelib/src/main/java/com/xhly/corelib/Const.kt Прегледај датотеку

@@ -68,7 +68,9 @@ object Const {
68 68
     //存储区域码,存在则在弹窗出现时显示
69 69
     const val REGIONCODEKEY="REGIONCODEKEY"
70 70
     //接口地址 正式地址mc.xhkjedu.com测试地址mcapitest.xhkjedu.com
71
-    const val URL1: String = "https://mcapitest.xhkjedu.com/"
71
+    const val BASEURL="mcapitest.xhkjedu.com"
72
+
73
+    const val URL1: String = "https://$BASEURL/"
72 74
 
73 75
     //接口地址
74 76
     const val WSURL: String = "wss://mcwstest.xhkjedu.com/ws"

Loading…
Откажи
Сачувај