Commit 7a6e2320 by YKai

feat:webview配置防抓包

parent 67fcfc78
......@@ -36,7 +36,7 @@ ext {
"ydl-platform" : "0.0.39.90",
//第二步 若干
"ydl-webview" : "0.0.38.36",
"ydl-webview" : "0.0.38.40",
"ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.13",
"m-audioim" : "0.0.49.29.30",
......@@ -118,7 +118,7 @@ ext {
"ydl-platform" : "0.0.39.90",
//第二步 若干
"ydl-webview" : "0.0.38.36",
"ydl-webview" : "0.0.38.40",
"ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.11",
"m-audioim" : "0.0.49.29.30",
......
package com.ydl.utils
import android.content.Context
import android.net.Proxy
import android.os.Build
import android.text.TextUtils
/**
* Created by Ykai on 2021/4/1.
*/
object ProxyCheckUtils {
/**
* 判断设备 是否使用代理上网
* @param context 上下文对象
* return 当前网络是否开启了代理
*/
fun isWifiProxy(context: Context): Boolean {
val IS_ICS_OR_LATER: Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
val proxyAddress: String
val proxyPort: Int
if (IS_ICS_OR_LATER) {
proxyAddress = System.getProperty("http.proxyHost")
val portStr = System.getProperty("http.proxyPort")
proxyPort = (portStr ?: "-1").toInt()
} else {
proxyAddress = Proxy.getHost(context)
proxyPort = Proxy.getPort(context)
}
return !TextUtils.isEmpty(proxyAddress) && proxyPort != -1
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ import com.tencent.smtt.sdk.WebViewClient;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.ydl.utils.PopUtils;
import com.ydl.utils.ProxyCheckUtils;
import com.ydl.utils.WebUrlParamsUtils;
import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.BaseActivity;
......@@ -367,7 +368,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tellData = new TellData();
}
initView();
if (!BaseApp.instance.getGlobalConfig().getAppDebug()&& ProxyCheckUtils.INSTANCE.isWifiProxy(this)){
ToastUtil.toastShort("网络设置错误");
return;
}
startType = getIntent().getIntExtra("startType", 0);
rightText = getIntent().getStringExtra("rightText");
if (h5Params == null) {
......@@ -375,6 +379,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish();
return;
}
setUrlHeightParams();
EventBus.getDefault().register(this);
jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this, tellData = tellData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment