Browse Source

1.增加应用拉起,条件判断。

20241218TB223FC(测试jar包)
wangwanlei 4 months ago
parent
commit
67ae104e2f

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

563
                         //如果地址为空并且请求为true则不跳转,否则跳转
563
                         //如果地址为空并且请求为true则不跳转,否则跳转
564
                         try {
564
                         try {
565
                             if ((it.authUrl.isNullOrEmpty()||it.appPackage.isNullOrEmpty())&&it.netSucessFlag){
565
                             if ((it.authUrl.isNullOrEmpty()||it.appPackage.isNullOrEmpty())&&it.netSucessFlag){
566
+                                //请求成功但地址为空,不跳转
566
                                 canClickFlag = true
567
                                 canClickFlag = true
567
                                 autoAppFlag = false
568
                                 autoAppFlag = false
568
                                 spUtils.saveJson(Const.AUTOAPPKEY, it)
569
                                 spUtils.saveJson(Const.AUTOAPPKEY, it)
569
                             } else if ((!it.authUrl.isNullOrEmpty()&&!it.appPackage.isNullOrEmpty()) && AppUtils.isAppInstalled(this@MainActivity, it.appPackage)) {
570
                             } else if ((!it.authUrl.isNullOrEmpty()&&!it.appPackage.isNullOrEmpty()) && AppUtils.isAppInstalled(this@MainActivity, it.appPackage)) {
571
+                                //请求成功地址不为空,并且安装了跳转
570
                                 spUtils.saveJson(Const.AUTOAPPKEY, it)
572
                                 spUtils.saveJson(Const.AUTOAPPKEY, it)
571
                                 startAutoApp(it)
573
                                 startAutoApp(it)
572
                             } else if (!it.netSucessFlag){
574
                             } else if (!it.netSucessFlag){
575
+                                //请求失败走缓存
573
                                 val autoAppBean = spUtils.getFromJson(
576
                                 val autoAppBean = spUtils.getFromJson(
574
                                     Const.AUTOAPPKEY,
577
                                     Const.AUTOAPPKEY,
575
                                     AutoAppBean().javaClass
578
                                     AutoAppBean().javaClass
576
                                 ) as AutoAppBean
579
                                 ) as AutoAppBean
577
-                                if (autoAppBean.authUrl != null && AppUtils.isAppInstalled(
578
-                                        this@MainActivity,
579
-                                        autoAppBean.appPackage
580
-                                    ) && !it.netSucessFlag
581
-                                ) {
580
+                                if ((!autoAppBean.authUrl.isNullOrEmpty()&&!autoAppBean.appPackage.isNullOrEmpty())&&
581
+                                    AppUtils.isAppInstalled(this@MainActivity, autoAppBean.appPackage) && !it.netSucessFlag) {
582
+                                    //缓存地址不为空,并且安装了则跳转
582
                                     startAutoApp(autoAppBean)
583
                                     startAutoApp(autoAppBean)
583
                                 } else {
584
                                 } else {
585
+                                    //其余情况都允许触控
584
                                     canClickFlag = true
586
                                     canClickFlag = true
585
                                 }
587
                                 }
588
+                            }else{
589
+                                canClickFlag = true
586
                             }
590
                             }
587
                         } catch (e: Exception) {
591
                         } catch (e: Exception) {
588
                             canClickFlag = true
592
                             canClickFlag = true

Loading…
Cancel
Save