Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
7a6e2320
Commit
7a6e2320
authored
Apr 01, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:webview配置防抓包
parent
67fcfc78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
+41
-3
config.gradle
config.gradle
+2
-2
ProxyCheckUtils.kt
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
+33
-0
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+6
-1
No files found.
config.gradle
View file @
7a6e2320
...
...
@@ -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"
,
...
...
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
0 → 100644
View file @
7a6e2320
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
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
7a6e2320
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment