From f65c698602dcdad94d0a672172f532f386f5d156 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 18 Dec 2023 15:30:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E5=89=A7=20=20=20=20CookieManager=20c?= =?UTF-8?q?ookieManager=20=3D=20CookieManager.getInstance();=20if(Build.VE?= =?UTF-8?q?RSION.SDK=5FINT=20>=3D=20Build.VERSION=5FCODES.LOLLIPOP)=20=20?= =?UTF-8?q?=20=20=20{=20=20=20=20=20cookieManager.setAcceptThirdPartyCooki?= =?UTF-8?q?es(mainWv,=20true);=20=20=20=20=20}=20else{=20=20=20=20=20?= =?UTF-8?q?=C2=A0=20cookieManager.setAcceptCookie(true);=20=20=20=20=20}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 ++-- .../yunbao/main/views/MainHomeCommunityViewHolder.java | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config.gradle b/config.gradle index c3bf59333..5442dbf23 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // 测试 -// serverHost : " https://ceshi.yaoulive.com", + serverHost : " https://ceshi.yaoulive.com", //百度语音识别 diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index f7875f41a..83c66ccac 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -17,6 +17,7 @@ import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; +import android.webkit.CookieManager; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebSettings; @@ -102,7 +103,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl Bus.getOn(this); String url = HtmlConfig.ENCOURAGE + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); -// String url = "https://coolshi.feioou.com/testAndroid.html"; +// String url = "https://api.coolydrama.com/?agentCode=186279"; final LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); mProgressBar = (ProgressBar) findViewById(R.id.progressbar); mWebView = new WebView(mContext); @@ -119,6 +120,12 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); + CookieManager cookieManager = CookieManager.getInstance(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + cookieManager.setAcceptThirdPartyCookies(mWebView, true); + } else { + cookieManager.setAcceptCookie(true); + } String appCachePath = mContext.getCacheDir().getAbsolutePath(); // mWebView.getSettings().setAppCachePath(appCachePath); mWebView.getSettings().setAllowFileAccess(true);