Commit bda0ea8e by YKai

feat: 代码优化

parent 483590e8
......@@ -202,7 +202,7 @@ dependencies {
implementation project(':ydl-webview')
implementation project(':ydl-media')
implementation project(':m-muse')
implementation project(':m-im')
implementation rootProject.ext.dependencies["m-im-medical"]
implementation modularPublication('com.ydl:m-im-api')
implementation project(':m-dynamic')
implementation project(':m-course')
......
......@@ -285,6 +285,7 @@ ext {
"ydl-pay" : "com.ydl:ydl-pay:${ydlCompileVersion["ydl-pay"]}@aar",
"ydl-medical-pay" : "com.ydl:ydl-medical-pay:${ydlCompileVersion["ydl-medical-pay"]}@aar",
"m-audioim" : "com.ydl:m-audioim:${ydlCompileVersion["m-audioim"]}@aar",
"m-im-medical" : "com.ydl:m-im-module-medical:${ydlCompileVersion["m-im-medical"]}",
//业务组件 <<--- 最后发这些(只发改过的)
"ydl-m-user-api" : "com.ydl:m-user-api:${ydlCompileVersion["m-user-api"]}",
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -386,7 +386,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
return;
}
setUrlHeightParams();
// setUrlHeightParams();
EventBus.getDefault().register(this);
jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this, tellData = tellData);
......@@ -409,93 +409,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
initTimeOutHandler();
}
/**
* 专家详情页改版 需要url后面拼接状态栏高度 并且隐藏导航栏
*/
private void setUrlHeightParams() {
String url = h5Params.getUrl();
//兼容课程详情页url
if (!TextUtils.isEmpty(url) && url.contains("course/Detail/") && !url.contains("course/Detail/v2/")) {
url = url.replace("course/Detail/", "course/Detail/v2/");
//再次替换 方哥那边解决不了域名的问题 app中强行匹配修改
if (url.contains("fe-app-yidianling")) {
int index = url.indexOf("course/Detail");
String newUrl = url.substring(index, url.length());
if (url.contains("test")) {
newUrl = "https://testnewm.ydl.com/" + newUrl;
} else {
newUrl = "https://m.ydl.com/" + newUrl;
}
url = newUrl;
}
}
url = pinjie(url);
h5Params.setUrl(url);
}
/**
* 专家详情页改版 需要url后面拼接状态栏高度 并且隐藏导航栏
*
* @param url
* @return
*/
private String setUrlHeightParams(String url) {
String resultUrl = url;
try {
Uri uri = Uri.parse(url);
String host = uri.getHost();
if (!TextUtils.isEmpty(host) && host.contains("nodeapi.ydl")) {
//马亮的需求,在nodeapi.ydl.com 地址后面拼上公共参数,用于判断是否为app
String uriAppendSuffix = jtoJHandle.getUriAppendSuffix();
resultUrl = WebUrlParamsUtils.getSuffix(url, uriAppendSuffix);
}
} catch (Exception e) {
e.printStackTrace();
}
return pinjie(resultUrl);
}
private String pinjie(String jumpUrl) {
if (jumpUrl.contains("hideNavBar=1")) {
hideJavaTitleBar();
return jumpUrl;
} else if (jumpUrl.contains("hideNavBar=2")) {
showTitleBar();
return jumpUrl;
}
String useUrl = new StringBuffer().append(jumpUrl).toString();
Resources res = getResources();
String[] doctorUrlArray = res.getStringArray(R.array.platform_doctorUrls);
for (String url : doctorUrlArray) {
if (useUrl.contains(url)) {
String lastUrl = useUrl.replaceAll(url, "");
if (lastUrl.contains("?")) {
lastUrl = lastUrl.substring(0, lastUrl.indexOf("?"));
}
try {
//不报错就说明可以转成long,就说明是专家详情页地址
Long.parseLong(lastUrl);
if (!lastUrl.contains("/")) {
if (useUrl.endsWith("?")) {
useUrl = useUrl.substring(0, useUrl.indexOf("?"));
}
if (!useUrl.contains("barHeight")) {
String paramsStr = useUrl.contains("?")
? "&barHeight=" + String.valueOf(StatusBarUtils.Companion.getStatusBarHeight(NewH5Activity.this))
: "?barHeight=" + String.valueOf(StatusBarUtils.Companion.getStatusBarHeight(NewH5Activity.this));
useUrl = new StringBuffer().append(useUrl).append(paramsStr).toString();
}
hideJavaTitleBar();
}
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
}
return useUrl;
}
public void hasShowDownRefresh(boolean isVisible) {
store_house_ptr_frame.post(() -> store_house_ptr_frame.setEnabled(isVisible));
......@@ -757,10 +670,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
} else if (!TextUtils.isEmpty(url) && url.startsWith("http")) {
loadUrl(setUrlHeightParams(url));
// loadUrl(setUrlHeightParams(url));
loadUrl(url);
} else {
if (!YDLRouterManager.Companion.router(url)) {
loadUrl(setUrlHeightParams(url));
// loadUrl(setUrlHeightParams(url));
loadUrl(url);
}
}
return true;
......@@ -839,10 +754,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
} else if (!TextUtils.isEmpty(url) && url.startsWith("http")) {
loadUrl(setUrlHeightParams(url));
// loadUrl(setUrlHeightParams(url));
loadUrl(url);
} else {
if (!YDLRouterManager.Companion.router(url)) {
loadUrl(setUrlHeightParams(url));
// loadUrl(setUrlHeightParams(url));
loadUrl(url);
}
}
return true;
......
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