lmw
2023-05-12 3408b10a3466f2db3f81e5c484142e3c180d36ac
app/src/main/java/com/fuban/driver/ui/main/MainActivity.kt
@@ -56,6 +56,7 @@
    }
    override fun initView() {
        MyApplication.canPlayVoice = true
//        var packageName = "com.android.providers.downloads";
//        var intent =  Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
//    intent.setData(Uri.parse("package:" + packageName));
@@ -63,13 +64,18 @@
        if (CacheKey.getKeyStr(Const.REFUSE_LOCATION).isNotEmpty()&&!RxPermissions(this).isGranted(Manifest.permission.ACCESS_FINE_LOCATION)){
            toast("没有定位权限,您将无法收到新订单推送")
        }else{
            val subscribe =
                RxPermissions(this).request(Manifest.permission.ACCESS_FINE_LOCATION).subscribe {
                    if (!it){
                        toast("没有定位权限,您将无法收到新订单推送")
                        CacheKey.putKeyStr(Const.REFUSE_LOCATION,"1")
                    }
            if (!RxPermissions(this).isGranted(Manifest.permission.ACCESS_FINE_LOCATION)){
                DialogUtil.getDelAndSureDialog(this,"去授权","否","《福伴司机》需要获取您的当前位置信息,用于查询当前城市是否开通服务,我们会将您的位置实时上传至后端为您匹配和推送附近订单。如果拒绝定位权限,您将无法正常接单。",{
                }){
                    val subscribe =
                        RxPermissions(this).request(Manifest.permission.ACCESS_FINE_LOCATION).subscribe {
                            if (!it){
                                toast("没有定位权限,您将无法收到新订单推送")
                                CacheKey.putKeyStr(Const.REFUSE_LOCATION,"1")
                            }
                        }
                }
            }
        }
        setTitleText("福伴司机")
        tv_Left.setDrawableLeft(R.mipmap.icon_nav_user)
@@ -330,4 +336,8 @@
        }
    }
    override fun onDestroy() {
        super.onDestroy()
        MyApplication.canPlayVoice = false
    }
}