|
|
@@ -26,7 +26,6 @@ import android.widget.ProgressBar;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.dateview.DateUtil;
|
|
|
import com.sheep.gamegroup.event.WXLoginAuthEvent;
|
|
|
-import com.sheep.gamegroup.model.api.IWeb;
|
|
|
import com.sheep.gamegroup.model.entity.WebParams;
|
|
|
import com.sheep.gamegroup.util.*;
|
|
|
import com.sheep.gamegroup.util.h5game.H5GameUtil;
|
|
|
@@ -58,7 +57,9 @@ import com.zhy.http.okhttp.callback.StringCallback;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
@@ -468,7 +469,9 @@ public class FgtWebX5 extends BaseFgtWebX5 {
|
|
|
if (s.contains("page-error.css")) {
|
|
|
Uri uri = Uri.parse(getWebUrl());
|
|
|
String host = uri.getHost();
|
|
|
- CookieManager.getInstance().setCookie(host, "");
|
|
|
+ List<String> hostList = new ArrayList<>();
|
|
|
+ hostList.add(host);
|
|
|
+ WebViewUtils.deleteWebViewCookiesForDomains(getContext(),hostList);
|
|
|
Log.d("!!!!!!s", "清理了cookie~~~");
|
|
|
AndroidSchedulers.mainThread().scheduleDirect(() -> {
|
|
|
loadJs("window.location.reload()");
|
|
|
@@ -726,28 +729,20 @@ public class FgtWebX5 extends BaseFgtWebX5 {
|
|
|
//获取方块消消乐的本地用户信息
|
|
|
private void getXXLGameUserInfo(boolean shouldLoad) {
|
|
|
String js = "window.localStorage.getItem('userInfo');";
|
|
|
- mWebView.evaluateJavascript(js, new ValueCallback<String>() {
|
|
|
- @Override
|
|
|
- public void onReceiveValue(String s) {
|
|
|
- Log.d("!!!!!!!!", s);
|
|
|
- if (!s.equals("null")) {
|
|
|
- SharedPreferencesUtil.putData(KEY_GAME_USER_INFO, s);
|
|
|
- } else {
|
|
|
- if (shouldLoad) {
|
|
|
- String oldUserInfo = (String) SharedPreferencesUtil.getData(KEY_GAME_USER_INFO, "");
|
|
|
- if (oldUserInfo != null && !oldUserInfo.isEmpty()) {
|
|
|
- String jsUrl = "window.localStorage.setItem('userInfo','" + oldUserInfo + "')";
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
|
- mWebView.evaluateJavascript(jsUrl, new ValueCallback<String>() {
|
|
|
- @Override
|
|
|
- public void onReceiveValue(String s) {
|
|
|
- mWebView.reload();
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- mWebView.loadUrl(jsUrl);
|
|
|
- mWebView.reload();
|
|
|
- }
|
|
|
+ mWebView.evaluateJavascript(js, s -> {
|
|
|
+ Log.d("!!!!!!!!", s);
|
|
|
+ if (!s.equals("null")) {
|
|
|
+ SharedPreferencesUtil.putData(KEY_GAME_USER_INFO, s);
|
|
|
+ } else {
|
|
|
+ if (shouldLoad) {
|
|
|
+ String oldUserInfo = (String) SharedPreferencesUtil.getData(KEY_GAME_USER_INFO, "");
|
|
|
+ if (oldUserInfo != null && !oldUserInfo.isEmpty()) {
|
|
|
+ String jsUrl = "window.localStorage.setItem('userInfo','" + oldUserInfo + "')";
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
|
+ mWebView.evaluateJavascript(jsUrl, s1 -> mWebView.reload());
|
|
|
+ } else {
|
|
|
+ mWebView.loadUrl(jsUrl);
|
|
|
+ mWebView.reload();
|
|
|
}
|
|
|
}
|
|
|
}
|