|
|
@@ -12,9 +12,7 @@ import android.support.v4.content.ContextCompat;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.View;
|
|
|
-import android.webkit.CookieSyncManager;
|
|
|
import android.webkit.JavascriptInterface;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sheep.gamegroup.absBase.AbsObserver;
|
|
|
@@ -38,24 +36,9 @@ import com.sheep.gamegroup.module.qrcode.ScanQRCodeActivity;
|
|
|
import com.sheep.gamegroup.module.user.activity.ActVip;
|
|
|
import com.sheep.gamegroup.module.user.model.BuyVipReq;
|
|
|
import com.sheep.gamegroup.module.user.model.TempUserResp;
|
|
|
-import com.sheep.gamegroup.util.ApiJSONUtil;
|
|
|
-import com.sheep.gamegroup.util.ApiUtil;
|
|
|
-import com.sheep.gamegroup.util.CommonUtil;
|
|
|
-import com.sheep.gamegroup.util.Constant;
|
|
|
-import com.sheep.gamegroup.util.ContactUtil;
|
|
|
-import com.sheep.gamegroup.util.DataKey;
|
|
|
-import com.sheep.gamegroup.util.DataUtil;
|
|
|
-import com.sheep.gamegroup.util.DeviceUtil;
|
|
|
-import com.sheep.gamegroup.util.Jump2View;
|
|
|
-import com.sheep.gamegroup.util.ListUtil;
|
|
|
-import com.sheep.gamegroup.util.LocationUtils;
|
|
|
-import com.sheep.gamegroup.util.LogUtil;
|
|
|
-import com.sheep.gamegroup.util.MainTab;
|
|
|
-import com.sheep.gamegroup.util.QQUtil;
|
|
|
-import com.sheep.gamegroup.util.SMSUtil;
|
|
|
-import com.sheep.gamegroup.util.StringUtils;
|
|
|
-import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
-import com.sheep.gamegroup.util.ViewUtil;
|
|
|
+import com.sheep.gamegroup.module.webview.fragment.FgtWebX5;
|
|
|
+import com.sheep.gamegroup.util.*;
|
|
|
+import com.sheep.gamegroup.util.h5game.H5GameUtil;
|
|
|
import com.sheep.gamegroup.util.share.ShareLinkConfig;
|
|
|
import com.sheep.gamegroup.view.activity.ActInvitation;
|
|
|
import com.sheep.gamegroup.view.activity.ActMain;
|
|
|
@@ -73,16 +56,13 @@ import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
|
|
|
import com.tencent.smtt.sdk.CookieManager;
|
|
|
-import com.umeng.socialize.ShareAction;
|
|
|
import com.umeng.socialize.UMAuthListener;
|
|
|
import com.umeng.socialize.UMShareAPI;
|
|
|
import com.umeng.socialize.UMShareListener;
|
|
|
import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
-
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
-import java.net.URI;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
@@ -832,7 +812,7 @@ public class KFZSJs {
|
|
|
String cookies = CookieManager.getInstance().getCookie(host);
|
|
|
Map<String, String> cookieMap = StringUtils.string2Map(cookies, ";", "=");
|
|
|
|
|
|
- submitH5GameRecord(
|
|
|
+ H5GameUtil.submitH5GameRecord(
|
|
|
3,
|
|
|
cookieMap.get("openid"),
|
|
|
cookieMap.get("nickname"),
|
|
|
@@ -889,7 +869,7 @@ public class KFZSJs {
|
|
|
String cookies = CookieManager.getInstance().getCookie(host);
|
|
|
Map<String, String> cookieMap = StringUtils.string2Map(cookies, ";", "=");
|
|
|
|
|
|
- submitH5GameRecord(
|
|
|
+ H5GameUtil.submitH5GameRecord(
|
|
|
3,
|
|
|
cookieMap.get("openid"),
|
|
|
cookieMap.get("nickname"),
|
|
|
@@ -919,6 +899,7 @@ public class KFZSJs {
|
|
|
|
|
|
@Subscribe
|
|
|
public void whenWXAuth(WXLoginAuthEvent ev) {
|
|
|
+ Log.d("######","···EVENTBUS 回调登录");
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
if (!TextUtils.isEmpty(ev.code)) {
|
|
|
WXAPIUtil.loadWXUserToken(ev.code, (ret, openid, accessToken, refreshToken) -> {
|
|
|
@@ -928,7 +909,7 @@ public class KFZSJs {
|
|
|
params.put("openid", openid);
|
|
|
params.put("account_type", "wx");
|
|
|
params.put("app_id", Config.WX_AUTH_APP_ID);
|
|
|
- loadThirdPartUserInfo("wx", params);
|
|
|
+ H5GameUtil.loadThirdPartUserInfo(iWeb, activity, "wx", params);
|
|
|
});
|
|
|
} else {
|
|
|
G.shortToast("微信授权失败");
|
|
|
@@ -938,6 +919,7 @@ public class KFZSJs {
|
|
|
|
|
|
@JavascriptInterface
|
|
|
public void loginThirdPartApp(String type) {
|
|
|
+ Log.d("######","···三方登录中···");
|
|
|
if ("wx".equals(type)) {
|
|
|
WXAPIUtil.launchAuth(activity);
|
|
|
if (!EventBus.getDefault().isRegistered(this)) {
|
|
|
@@ -959,8 +941,8 @@ public class KFZSJs {
|
|
|
params.put("openid", map.get("openid"));
|
|
|
params.put("account_type", type);
|
|
|
params.put("app_id", "wx".equals(type) ? Config.WX_AUTH_APP_ID : Config.QQ_APP_ID);
|
|
|
- loadThirdPartUserInfo(type, params);
|
|
|
-// onFinally("", type, params);
|
|
|
+ H5GameUtil.loadThirdPartUserInfo(iWeb, activity, type, params);
|
|
|
+ //onFinally("", type, params);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -977,86 +959,6 @@ public class KFZSJs {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void loadThirdPartUserInfo(final String platform, Map<String, String> cookies) {
|
|
|
- if ("wx".equals(platform)) {
|
|
|
- WXAPIUtil.loadWXUserInfo(cookies.get("openid"), cookies.get("access_token"), (ret, info) -> {
|
|
|
- if (ret) {
|
|
|
- onFinally(info.get("screen_name"), platform, cookies);
|
|
|
- } else {
|
|
|
- onFinally("", platform, cookies);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- UMShareAPI.get(SheepApp.getInstance()).getPlatformInfo(activity, "wx".equals(platform) ? SHARE_MEDIA.WEIXIN : SHARE_MEDIA.QQ,
|
|
|
- new UMAuthListener() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onStart(SHARE_MEDIA share_media) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
|
|
|
- onFinally(map.get("screen_name"), platform, cookies);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
|
|
|
- throwable.printStackTrace();
|
|
|
- onFinally("", platform, cookies);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onCancel(SHARE_MEDIA share_media, int i) {
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void onFinally(String nickName, String platform, Map<String, String> cookies) {
|
|
|
- cookies.put("nickname", nickName);
|
|
|
- Uri uri = Uri.parse(iWeb.getWebUrl());
|
|
|
- String host = uri.getHost();
|
|
|
- iWeb.setCookies(host, cookies);
|
|
|
- iWeb.loadJs("handleLogin(1)");
|
|
|
-
|
|
|
- submitH5GameRecord(
|
|
|
- 2,
|
|
|
- cookies.get("openid"),
|
|
|
- nickName,
|
|
|
- iWeb.getWebTitle(),
|
|
|
- iWeb.getWebUrl(),
|
|
|
- "wx".equals(platform) ? 1 : 2,
|
|
|
- -1
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- private void submitH5GameRecord(int type, String openId, String nickname, String gameName, String gameUrl, int accountPlatform, int actionPlatform) {
|
|
|
- JSONObject json = new JSONObject();
|
|
|
- json.put("openid", openId);
|
|
|
- json.put("nickname", nickname);
|
|
|
- json.put("type", type);
|
|
|
- json.put("game_name", gameName);
|
|
|
- json.put("game_url", gameUrl);
|
|
|
- json.put("account_platform", accountPlatform);
|
|
|
- json.put("action_platform", actionPlatform);
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().recordH5GameAction(json)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
- @Override
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
- LogUtil.logE(baseMessage != null ? baseMessage.getErrorMsg() + "" : "api错误");
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
- LogUtil.logI("记录完成");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
@JavascriptInterface
|
|
|
public void discountRechargeBack(String packageName) {
|
|
|
ComponentName appName = new ComponentName(packageName, "com.yog.kothoth.view.activity.SSRechargeActivity");
|