4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1

以下内容为反编译后的 AndroidJsInterface.java 源代码,内容仅作参考


package com.m4399.gamecenter.plugin.main.controllers.web;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Keep;
import android.text.TextUtils;
import android.util.Base64;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.webkit.JavascriptInterface;
import com.android.tools.r8.annotations.SynthesizedClassMap;
import com.download.database.tables.DownloadTable;
import com.framework.config.Config;
import com.framework.config.SysConfigKey;
import com.framework.database.tables.CachesTable;
import com.framework.database.tables.HttpFailureTable;
import com.framework.helpers.ApkInstallHelper;
import com.framework.helpers.AppNativeHelper;
import com.framework.manager.network.NetworkStatusManager;
import com.framework.manager.storage.StorageManager;
import com.framework.net.ILoadPageEventListener;
import com.framework.rxbus.RxBus;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.utils.ActivityStateUtils;
import com.framework.utils.JSONUtils;
import com.framework.utils.UMengEventUtils;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.m4399.framework.BaseApplication;
import com.m4399.gamecenter.plugin.main.PluginApplication;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.config.GameCenterConfigKey;
import com.m4399.gamecenter.plugin.main.controllers.gamedetail.GameDetailActivity;
import com.m4399.gamecenter.plugin.main.controllers.gamehub.GameHubDetailForumStyleActivity;
import com.m4399.gamecenter.plugin.main.controllers.settings.SettingActivity;
import com.m4399.gamecenter.plugin.main.controllers.shop.ShopActivity;
import com.m4399.gamecenter.plugin.main.controllers.web.creator.CreatorCenterDescActivity;
import com.m4399.gamecenter.plugin.main.database.tables.n;
import com.m4399.gamecenter.plugin.main.database.tables.u;
import com.m4399.gamecenter.plugin.main.fastplay.helper.FastPlayRouterHelper;
import com.m4399.gamecenter.plugin.main.helpers.ShopExchangeHelper;
import com.m4399.gamecenter.plugin.main.helpers.ar;
import com.m4399.gamecenter.plugin.main.helpers.bi;
import com.m4399.gamecenter.plugin.main.helpers.bj;
import com.m4399.gamecenter.plugin.main.listeners.OnCommonCallBack;
import com.m4399.gamecenter.plugin.main.listeners.s;
import com.m4399.gamecenter.plugin.main.manager.authentication.ContentPublishAuthManagerProxy;
import com.m4399.gamecenter.plugin.main.manager.coupon.CouponManagerImpl;
import com.m4399.gamecenter.plugin.main.manager.permission.StoragePermissionManager;
import com.m4399.gamecenter.plugin.main.manager.permission.a;
import com.m4399.gamecenter.plugin.main.manager.router.GameCenterRouterManager;
import com.m4399.gamecenter.plugin.main.manager.stat.StatManager;
import com.m4399.gamecenter.plugin.main.manager.subscribe.SubscribeGameManager;
import com.m4399.gamecenter.plugin.main.manager.user.UserAccountType;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.manager.v;
import com.m4399.gamecenter.plugin.main.manager.video.publish.VideoPublishTaskMgr;
import com.m4399.gamecenter.plugin.main.models.PropertyKey;
import com.m4399.gamecenter.plugin.main.models.coupon.BaseCouponModel;
import com.m4399.gamecenter.plugin.main.models.home.SuggestSearchWordModel;
import com.m4399.gamecenter.plugin.main.models.local.LocalGameModel;
import com.m4399.gamecenter.plugin.main.models.picture.PicDetailModel;
import com.m4399.gamecenter.plugin.main.models.user.UserHomePageTabType;
import com.m4399.gamecenter.plugin.main.models.user.UserInfoModel;
import com.m4399.gamecenter.plugin.main.models.video.IVideoGameInfo;
import com.m4399.gamecenter.plugin.main.providers.gamehub.o;
import com.m4399.gamecenter.plugin.main.utils.AlbumUtils;
import com.m4399.gamecenter.plugin.main.utils.PraiseHelper;
import com.m4399.gamecenter.plugin.main.utils.ab;
import com.m4399.gamecenter.plugin.main.utils.ae;
import com.m4399.gamecenter.plugin.main.utils.ap;
import com.m4399.gamecenter.plugin.main.utils.bc;
import com.m4399.gamecenter.plugin.main.utils.bk;
import com.m4399.gamecenter.plugin.main.utils.bp;
import com.m4399.gamecenter.plugin.main.utils.t;
import com.m4399.gamecenter.plugin.main.views.comment.ZonePicPanel;
import com.m4399.gamecenter.plugin.main.views.m;
import com.m4399.gamecenter.plugin.main.widget.web.BaseWebViewLayout;
import com.m4399.gamecenter.utils.RunHelper;
import com.m4399.plugin.PluginConstant;
import com.m4399.support.controllers.ActivityPageTracer;
import com.m4399.support.controllers.BaseActivity;
import com.m4399.support.utils.HttpResultTipUtils;
import com.m4399.support.utils.ToastUtils;
import com.m4399.support.widget.dialog.CommonLoadingDialog;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.umeng.analytics.pro.am;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import timber.log.Timber;

@SynthesizedClassMap({$$Lambda$AndroidJsInterface$IQh4j1X8KaBT71QNlOeyh0ktCs.class, $$Lambda$AndroidJsInterface$NiANsxYX3xQLZcqYaWOd1bdtUYc.class})
public class AndroidJsInterface extends BaseJsInterface {
    public static final String INJECTED_ANDROID = "android";
    private CommonLoadingDialog adZ;
    private s bFa;
    private boolean ceV;
    HashMap<String, a> ceW;
    String ceX;
    protected RxBusHandler mRxBusHandler;

    public interface a {
        void dR(String str);
    }

    protected String getId() {
        return "";
    }

    @JavascriptInterface
    public void onClickAddComment() {
    }

    @JavascriptInterface
    public void onClickReplyComment(String str) {
    }

    @JavascriptInterface
    @Deprecated
    public boolean onJsIsOpenZoneWaterMark() {
        return false;
    }

    @JavascriptInterface
    public void onJsToMyCircleList() {
    }

    @JavascriptInterface
    public void openMameGameDetail(String str, String str2) {
    }

    @JavascriptInterface
    public void openMameList() {
    }

    @JavascriptInterface
    public void webContentHaveComplete() {
    }

    public AndroidJsInterface(BaseWebViewLayout baseWebViewLayout, Context context) {
        super(baseWebViewLayout, context);
        this.ceV = false;
        this.ceW = new HashMap<>();
        this.ceX = null;
    }

    @Override
    public void init(BaseWebViewLayout baseWebViewLayout, Context context) {
        super.init(baseWebViewLayout, context);
        this.mRxBusHandler = new RxBusHandler();
    }

    @Keep
    @JavascriptInterface
    public void openHelpSimpleSwipe(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        final String string = JSONUtils.getString(CachesTable.COLUMN_KEY, JSONUtils.parseJSONObjectFromString(str));
        if (TextUtils.isEmpty(string)) {
            return;
        }
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                AndroidJsInterface.this.dQ(string);
            }
        });
    }

    public void dQ(String str) {
        if (this.ceV) {
            return;
        }
        this.ceV = true;
        final com.m4399.gamecenter.plugin.main.providers.v.a aVar = new com.m4399.gamecenter.plugin.main.providers.v.a();
        aVar.setHelpKey(str);
        aVar.loadData(new ILoadPageEventListener() {
            @Override
            public void onBefore() {
            }

            @Override
            public void onSuccess() {
                Bundle bundle = new Bundle();
                bundle.putString("simple.swipe.title", aVar.getTitle());
                bundle.putString("simple.swipe.content", aVar.getContext());
                GameCenterRouterManager.getInstance().openSimpleSwipe(AndroidJsInterface.this.mContext, bundle);
                AndroidJsInterface.this.ceV = false;
            }

            @Override
            public void onFailure(Throwable th, int i, String str2, int i2, JSONObject jSONObject) {
                ToastUtils.showToast(AndroidJsInterface.this.mContext, HttpResultTipUtils.getFailureTip(AndroidJsInterface.this.mContext, th, i, str2));
                AndroidJsInterface.this.ceV = false;
            }
        });
    }

    @Keep
    @JavascriptInterface
    public void openMiniGame(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        if (TextUtils.isEmpty(ap.getString(FastPlayRouterHelper.ROUTER, parseJSONObjectFromString))) {
            GameCenterRouterManager.getInstance().openMiniGame(this.mContext, str, "");
        } else {
            GameCenterRouterManager.getInstance().openActivityByJson(this.mContext, parseJSONObjectFromString);
        }
    }

    @Keep
    @JavascriptInterface
    public void openMessageBox() {
        GameCenterRouterManager.getInstance().openMessageBox(this.mContext, 0L, true, new int[0]);
    }

    @Keep
    @JavascriptInterface
    public void openGameTool(int i) {
        GameCenterRouterManager.getInstance().openGameTool(this.mContext, i);
    }

    @JavascriptInterface
    public String onCheckEmulator(String str) {
        String str2;
        String uniqueId = getUniqueId();
        JSONObject jSONObject = new JSONObject();
        boolean z = true;
        try {
            z = ap.getBoolean("isShow", new JSONObject(str));
            boolean isDoubleLaunch = ae.isDoubleLaunch(this.mContext);
            if (ab.isEmulatorByCache() || isDoubleLaunch) {
                str2 = uniqueId + "1";
                jSONObject.put("enu", "1");
            } else {
                str2 = uniqueId + "0";
                jSONObject.put("enu", "0");
            }
            jSONObject.put("s", AppNativeHelper.getServerApi(str2));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (z) {
            Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
                @Override
                public void call(Object obj) {
                    AndroidJsInterface.this.HW();
                }
            });
        }
        return jSONObject.toString();
    }

    @JavascriptInterface
    public String isEmulator() {
        return ab.isEmulatorByCache() ? "1" : "0";
    }

    @JavascriptInterface
    public String isDoubleClient() {
        return ae.isDoubleLaunch(this.mContext) ? "1" : "0";
    }

    @JavascriptInterface
    public void loading(final String str, final String str2) {
        if (this.mContext == null) {
            return;
        }
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                AndroidJsInterface.this.f("1".equals(str), str2);
            }
        });
    }

    public void f(boolean z, String str) {
        if (z) {
            if (this.adZ == null) {
                this.adZ = new CommonLoadingDialog(this.mContext);
            }
            this.adZ.show(str);
        } else {
            CommonLoadingDialog commonLoadingDialog = this.adZ;
            if (commonLoadingDialog != null) {
                commonLoadingDialog.dismiss();
            }
        }
    }

    @JavascriptInterface
    public void onCopyToClipboard(String str) {
        Observable.just(str).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<String>() {
            @Override
            public void call(String str2) {
                com.m4399.gamecenter.plugin.main.utils.e.copyToClipboard(AndroidJsInterface.this.mContext.getApplicationContext(), str2, AndroidJsInterface.this.mContext.getString(R.string.copy_to_clipboard));
            }
        });
    }

    @JavascriptInterface
    public void onCopyToClipboard(String str, final String str2) {
        Observable.just(str).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<String>() {
            @Override
            public void call(String str3) {
                com.m4399.gamecenter.plugin.main.utils.e.copyToClipboard(AndroidJsInterface.this.mContext.getApplicationContext(), str3, str2);
            }
        });
    }

    @JavascriptInterface
    public void onJsToNecessaryApp() {
        GameCenterRouterManager.getInstance().openNecessaryApp(this.mContext);
    }

    @JavascriptInterface
    public void onJsToPayGame() {
        GameCenterRouterManager.getInstance().openPayGame(this.mContext, null);
    }

    @JavascriptInterface
    public void onJsToForumsTopic(String str, String str2) {
        onJsToForumsTopic(str, str2, 1);
    }

    @JavascriptInterface
    public void onJsToForumsTopic(String str, String str2, int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gamehub.forums.id", bc.toInt(str));
        bundle.putInt("intent.extra.gamehub.post.id", bc.toInt(str2));
        bundle.putInt("intent.extra.gamehub.post.reply.id", 0);
        bundle.putInt("intent.extra.gamehub.topic.is.show.gamehub.entry", i);
        GameCenterRouterManager.getInstance().openGameHubPostDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToMyForumsPost(String str, String str2, int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gamehub.forums.id", bc.toInt(str));
        bundle.putInt("intent.extra.gamehub.post.id", bc.toInt(str2));
        bundle.putInt("intent.extra.gamehub.post.reply.id", 0);
        bundle.putBoolean("intent.extra.gamehub.is.my", true);
        bundle.putInt("intent.extra.gamehub.topic.is.show.gamehub.entry", i);
        GameCenterRouterManager.getInstance().openGameHubPostDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToFeedDetails(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("zone.detail.id", String.valueOf(str));
        bundle.putString("intent.extra.game.id", str2);
        bundle.putBoolean("extra.zone.show.comment.bar", false);
        bundle.putBoolean("intent.extra.is.gamehub.zone", true);
        GameCenterRouterManager.getInstance().openZoneDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToUserGameVideo(int i, String str, String str2) {
        onJsToUserGameVideo(i, str, str2, 1);
    }

    @JavascriptInterface
    public void onJsToUserGameVideo(int i, String str, String str2, int i2) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", i);
        bundle.putString("intent.extra.game.name", str);
        bundle.putString("intent.extra.game.icon", str2);
        bundle.putBoolean(" intent.extra.is.game", i2 == 1);
        GameCenterRouterManager.getInstance().openGameVideo(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToUserGames() {
        UserCenterManager.checkIsLogin(this.mContext, new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Boolean bool, Object... objArr) {
                if (bool.booleanValue()) {
                    Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
                        @Override
                        public void call(Object obj) {
                            if (AndroidJsInterface.this.mContext instanceof BaseActivity) {
                                ((BaseActivity) AndroidJsInterface.this.mContext).getWindow().clearFlags(1024);
                            } else if (AndroidJsInterface.this.mContext instanceof ContextThemeWrapper) {
                                Context baseContext = ((ContextThemeWrapper) AndroidJsInterface.this.mContext).getBaseContext();
                                if (baseContext instanceof Activity) {
                                    ((Activity) baseContext).getWindow().clearFlags(1024);
                                }
                            }
                            String nick = UserCenterManager.getNick();
                            String ptUid = UserCenterManager.getPtUid();
                            Bundle bundle = new Bundle();
                            bundle.putString("intent.extra.goto.user.homepage.title.nick", nick);
                            bundle.putString("intent.extra.goto.user.homepage.user.ptuid", ptUid);
                            bundle.putString("intent.extra.tab.index", UserHomePageTabType.TAB_GAME_RECORD);
                            GameCenterRouterManager.getInstance().openUserHomePage(AndroidJsInterface.this.mContext, bundle);
                        }
                    });
                }
            }
        });
    }

    @JavascriptInterface
    public void onJsToForumsDetails(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gamehub.forums.id", bc.toInt(str));
        bundle.putInt("intent.extra.gamehub.id", bc.toInt(str2));
        GameCenterRouterManager.getInstance().openGameHubDetail(this.mContext, bundle, false, new int[0]);
    }

    @JavascriptInterface
    public void onJsToProfileDetailsByPtUid(final String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
            @Override
            public void call(Object obj) {
                if (AndroidJsInterface.this.mContext instanceof BaseActivity) {
                    ((BaseActivity) AndroidJsInterface.this.mContext).getWindow().clearFlags(1024);
                } else if (AndroidJsInterface.this.mContext instanceof ContextThemeWrapper) {
                    Context baseContext = ((ContextThemeWrapper) AndroidJsInterface.this.mContext).getBaseContext();
                    if (baseContext instanceof Activity) {
                        ((Activity) baseContext).getWindow().clearFlags(1024);
                    }
                }
                Bundle bundle = new Bundle();
                bundle.putString("intent.extra.goto.user.homepage.user.ptuid", str);
                GameCenterRouterManager.getInstance().openUserHomePage(AndroidJsInterface.this.mContext, bundle);
            }
        });
    }

    @JavascriptInterface
    public void onJsToGiftList() {
        Bundle bundle = new Bundle();
        bundle.putInt("id", 5);
        GameCenterRouterManager.getInstance().openWelfareShop(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToGameDetails(String str) {
        if ("0".equalsIgnoreCase(str)) {
            ToastUtils.showToast(this.mContext, this.mContext.getString(R.string.live_no_such_game));
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        GameCenterRouterManager.getInstance().openGameDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToGameDetails(String str, String str2, String str3) {
        if ("0".equalsIgnoreCase(str)) {
            ToastUtils.showToast(this.mContext, this.mContext.getString(R.string.live_no_such_game));
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        bundle.putString("intent.extra.game.statflag", str2);
        bundle.putString(ActivityPageTracer.INTENT_EXTRA_ACTIVITY_TRACE, str3);
        GameCenterRouterManager.getInstance().openGameDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public String isGameInstalled(String str) {
        return ApkInstallHelper.checkInstalled(str) ? "1" : "0";
    }

    @JavascriptInterface
    public void onJsToPlayGameEarnHebi() {
        GameCenterRouterManager.getInstance().openMakeMoneyPlayHome(this.mContext, null);
    }

    @JavascriptInterface
    public String onJsGetDeviceId() {
        return (String) Config.getValue(SysConfigKey.UNIQUEID);
    }

    @JavascriptInterface
    public String getUniqueId() {
        return (String) Config.getValue(SysConfigKey.APP_UDID);
    }

    @JavascriptInterface
    public void onJsToCustomGameList(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.activity.title", str2);
        bundle.putInt("intent.extra.custom.game.id", bc.toInt(str));
        GameCenterRouterManager.getInstance().openCustomList(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToActivityDetails(String str, String str2) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.activity.id", Integer.valueOf(str).intValue());
        bundle.putString("intent.extra.activity.title", "活动详情");
        bundle.putString("intent.extra.activity.url", str2);
        GameCenterRouterManager.getInstance().openActivitiesDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToCategoryList(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.category.is.show.tag.tab", false);
        bundle.putInt("intent.extra.category.id", 0);
        bundle.putInt("intent.extra.category.tags.type", 2);
        bundle.putInt("intent.extra.category.tag.id", Integer.valueOf(str).intValue());
        bundle.putString("intent.extra.category.title", "");
        bundle.putString("intent.extra.category.tag.name", str2);
        GameCenterRouterManager.getInstance().openCategoryDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToAlbumDetails(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.special.id", bc.toInt(str));
        bundle.putString("intent.extra.special.name", str2);
        GameCenterRouterManager.getInstance().openSpecialDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToFeedBack() {
        GameCenterRouterManager.getInstance().openFeedback(this.mContext, null);
    }

    @JavascriptInterface
    public void onJsToFeedBackInAssistant(int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("assistant.question.id", i);
        bundle.putInt("intent.extra.feedback.from", 3);
        GameCenterRouterManager.getInstance().openFeedback(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToFeedBack(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.feedback.default.content", str);
        GameCenterRouterManager.getInstance().openFeedback(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJSClickLogin() {
        onJSClickLogin(null);
    }

    @JavascriptInterface
    public void onJSClickLogin(String str) {
        if (this.mContext == null) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", this.mContext.getClass().getName());
        if (!TextUtils.isEmpty(str)) {
            bundle.putString(PropertyKey.FastPlay.GAME_KEY, str);
        }
        GameCenterRouterManager.getInstance().openLogin(this.mContext, bundle, -1);
    }

    @JavascriptInterface
    public void onJSClickRegister() {
        Bundle bundle = new Bundle();
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 1);
        GameCenterRouterManager.getInstance().openLogin(this.mContext, bundle);
    }

    @JavascriptInterface
    public void bindThirdAccount(String str) {
        onJSClickThridAuth(str);
    }

    @JavascriptInterface
    public void onJSClickThridAuth(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        String string = ap.getString("account_type", parseJSONObjectFromString);
        String string2 = ap.getString("ext", parseJSONObjectFromString);
        if (!TextUtils.isEmpty(string)) {
            str = string;
        }
        if (this.bFa == null) {
            this.bFa = new s() {
                @Override
                public void onLoginStart() {
                    AndroidJsInterface.this.dM(0);
                }

                @Override
                public void onLoginSuccess(com.m4399.gamecenter.plugin.main.providers.user.d dVar) {
                    AndroidJsInterface.this.dM(1);
                }

                @Override
                public void onLoginFailed(String str2) {
                    ToastUtils.showToast(PluginApplication.getContext(), str2);
                    AndroidJsInterface.this.dM(-1);
                }
            };
        }
        HashMap hashMap = new HashMap();
        hashMap.put(UserCenterManager.KEY_SERVER_API_EXT, string2);
        UserCenterManager.getInstance().loginByThirdParty(this.mContext, UserAccountType.clientCodeOf(str), 1, hashMap, this.bFa);
    }

    public void dM(int i) {
        if (this.mFuncMaps != null) {
            invoke(this.mFuncMaps.get(com.m4399.gamecenter.plugin.main.manager.activities.a.THRIDPART_LOGIN_FINISH_FUNCTION_NAME), i + "");
        }
    }

    @JavascriptInterface
    public void onJSClickLogout() {
        Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
            @Override
            public void call(Object obj) {
                UserCenterManager.getInstance().logout(false);
            }
        });
    }

    @JavascriptInterface
    public void switchUser() {
        GameCenterRouterManager.getInstance().openAccountsManager(this.mContext, null, 0);
    }

    @JavascriptInterface
    public void onJsToBoxCoinRecord() {
        GameCenterRouterManager.getInstance().openRecord(this.mContext, null);
    }

    @Keep
    @JavascriptInterface
    public void onJsToBoxCoinRecord(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        Bundle bundle = new Bundle();
        bundle.putInt("com.m4399.gamecenter.tab.current.item", ap.getInt("tab_index", parseJSONObjectFromString));
        GameCenterRouterManager.getInstance().openRecord(this.mContext, bundle);
    }

    public boolean HW() {
        return ae.checkEmulatorAndParallel(this.mContext);
    }

    @JavascriptInterface
    public void onJsToDianle() {
        if (HW()) {
            return;
        }
        GameCenterRouterManager.getInstance().openEverydayTask(this.mContext, new int[0]);
        UMengEventUtils.onEvent("goto_gain_money");
    }

    @JavascriptInterface
    public void onJsToJiFenQian() {
        if (HW()) {
            return;
        }
        GameCenterRouterManager.getInstance().openPointWall(this.mContext, null);
    }

    @JavascriptInterface
    public void onJsToDailySign() {
        if (HW()) {
            return;
        }
        GameCenterRouterManager.getInstance().openEverydayTask(this.mContext, new int[0]);
    }

    @JavascriptInterface
    public void onJsToGiftDetails(String str) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gift.id", bc.toInt(str));
        GameCenterRouterManager.getInstance().openGiftDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToTagDetail(String str) {
        if ("newgame".equals(str)) {
            GameCenterRouterManager.getInstance().openHomeNewGameTab(this.mContext);
            return;
        }
        if ("crackgame".equals(str)) {
            Bundle bundle = new Bundle();
            bundle.putInt("intent.extra.tag.mLocalDataProvider.type", 2);
            GameCenterRouterManager.getInstance().openCrackGame(this.mContext, bundle, new int[0]);
        } else if ("girlgame".equals(str)) {
            Bundle bundle2 = new Bundle();
            bundle2.putInt("intent.extra.tag.mLocalDataProvider.type", 1);
            GameCenterRouterManager.getInstance().openCrackGame(this.mContext, bundle2, new int[0]);
        } else if ("netgame".equals(str)) {
            GameCenterRouterManager.getInstance().openNetGame(this.mContext);
        } else {
            "paygame".equals(str);
        }
    }

    @JavascriptInterface
    public void onJsToStrategyVideoDetail(int i, int i2) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.video.id", i);
        bundle.putInt("intent.extra.game.id", i2);
        GameCenterRouterManager.getInstance().openGameStrategyVideoDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToLiveAllGameCategory() {
        GameCenterRouterManager.getInstance().openLiveAllGameCategory(this.mContext, false);
    }

    @JavascriptInterface
    public void onJsToFriendsSearch(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.user.nick", str);
        GameCenterRouterManager.getInstance().openFriendsSearch(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToLiveSearch() {
        GameCenterRouterManager.getInstance().openLiveSearch(this.mContext, null);
    }

    @JavascriptInterface
    public void onJsToGiftBagDetails(String str) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        bundle.putInt("intent.extra.from.gift.detail", 0);
        GameCenterRouterManager.getInstance().openGiftGather(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJSToMyGiftList() {
        GameCenterRouterManager.getInstance().openGiftMy(this.mContext, null);
    }

    @JavascriptInterface
    public void openVideoRecord() {
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.record.video.from.long.click", true);
        bundle.putString("intent.extra.from.key", ZonePicPanel.PIC_PICKER_KEY);
        GameCenterRouterManager.getInstance().openVideoRecord(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToGiftCenter() {
        Bundle bundle = new Bundle();
        bundle.putInt("id", 5);
        GameCenterRouterManager.getInstance().openWelfareShop(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToTodayTopic(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("topic.id", str);
        GameCenterRouterManager.getInstance().openTopicDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void jumpToRecommend() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.FIND_GAME_TAB_KEY_RECOMMEND, new int[0]);
    }

    @JavascriptInterface
    public void jumpToClass() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.FIND_GAME_TAB_KEY_CATEGORY, 67108864);
    }

    @JavascriptInterface
    public void jumpToSpecial() {
        GameCenterRouterManager.getInstance().openSpecialList(this.mContext, new int[0]);
    }

    @JavascriptInterface
    public void jumpToRank() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.FIND_GAME_TAB_KEY_RANK, new int[0]);
    }

    @JavascriptInterface
    public void jumpToNews() {
        bj.openNewsList(this.mContext);
    }

    @JavascriptInterface
    public void jumpToZone() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.HOME_TAB_KEY_ZONE, new int[0]);
    }

    @JavascriptInterface
    public void jumpToZoneHome(String str) {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, ap.getInt("tab_index", ap.parseJSONObjectFromString(str)) == 0 ? com.m4399.gamecenter.plugin.main.manager.h.ZONE_TAB_KEY_FOLLOW : com.m4399.gamecenter.plugin.main.manager.h.ZONE_TAB_KEY_HOT, new int[0]);
    }

    @JavascriptInterface
    public void jumpToGameHub() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.HOME_TAB_KEY_GAME_HUB, new int[0]);
    }

    @JavascriptInterface
    public void jumpToSquare() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.HOME_TAB_KEY_PLAZA, new int[0]);
    }

    @JavascriptInterface
    public void jumpToMy() {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.HOME_TAB_KEY_MY, new int[0]);
    }

    @JavascriptInterface
    public void jumpToHomePage(String str) {
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, str, new int[0]);
    }

    @JavascriptInterface
    public void jumpToZoneDetail(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("zone.detail.id", String.valueOf(str));
        GameCenterRouterManager.getInstance().openZoneDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public String installedGames() {
        String str = "";
        for (LocalGameModel localGameModel : com.m4399.gamecenter.plugin.main.manager.ab.a.getInstance().getLastPlayGames()) {
            if (!TextUtils.isEmpty(str)) {
                str = str + ",";
            }
            str = str + localGameModel.getPackageName();
        }
        return str;
    }

    @JavascriptInterface
    public void startWebVideoPlayer(String str, String str2) {
        com.m4399.gamecenter.plugin.main.controllers.video.f.executeWebVideoPlay(this.mContext, str2);
    }

    @JavascriptInterface
    public void startVideoPlayer(String str, String str2) {
        com.m4399.gamecenter.plugin.main.controllers.video.f.openVideoPlay(this.mContext, str2, null, null, "活动接口", null);
    }

    @JavascriptInterface
    public void startVideoPlayer(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        String string = ap.getString("url", parseJSONObjectFromString);
        int i = ap.getInt("age_level", parseJSONObjectFromString);
        String string2 = ap.getString("screenshot", parseJSONObjectFromString);
        final int i2 = ap.getInt("id", ap.getJSONObject("game", ap.getJSONObject("ext", parseJSONObjectFromString)));
        com.m4399.gamecenter.plugin.main.controllers.video.f.openVideoPlay(this.mContext, string, i, string2, new IVideoGameInfo() {
            @Override
            public String getAppName() {
                return null;
            }

            @Override
            public String getDownloadUrl() {
                return null;
            }

            @Override
            public int getGamePrice() {
                return 0;
            }

            @Override
            public long getGameSize() {
                return 0L;
            }

            @Override
            public int getGameState() {
                return 0;
            }

            @Override
            public String getIconUrl() {
                return null;
            }

            @Override
            public String getPackageName() {
                return null;
            }

            @Override
            public String getUpdateTime() {
                return "";
            }

            @Override
            public boolean isPayGame() {
                return false;
            }

            @Override
            public int getAppId() {
                return i2;
            }
        }, "活动", null, null, null, null);
    }

    @JavascriptInterface
    public void jumpToUserRecommend() {
        GameCenterRouterManager.getInstance().openFriendRecommend(this.mContext);
    }

    @JavascriptInterface
    public void jumpToNewFunction() {
        GameCenterRouterManager.getInstance().openNewFeature(this.mContext);
    }

    @JavascriptInterface
    public void playVideo(String str, String str2) {
        com.m4399.gamecenter.plugin.main.controllers.video.f.openVideoPlay(this.mContext, str2, null, null, "活动接口", null);
    }

    @JavascriptInterface
    public void playVideo(String str, String str2, String str3) {
        com.m4399.gamecenter.plugin.main.controllers.video.f.openVideoPlay(this.mContext, str2, str3, null, "活动接口", null);
    }

    @JavascriptInterface
    public void onJsOpenSmallAssistant(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", str);
        bundle.putString("intent.extra.small.assistants.position", str2);
        GameCenterRouterManager.getInstance().openSmallAssistant(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToPlayH5Game(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        String string = ap.getString("gameUrl", parseJSONObjectFromString);
        int i = ap.getInt("gameId", parseJSONObjectFromString);
        if (TextUtils.isEmpty(string) && i == 0) {
            return;
        }
        boolean z = ap.getBoolean("isEgretGame", parseJSONObjectFromString);
        String string2 = ap.getString("gameName", parseJSONObjectFromString);
        int i2 = ap.getInt("landscape", parseJSONObjectFromString);
        int i3 = ap.getInt("openType", parseJSONObjectFromString);
        if (i > 0 && i3 == 1) {
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject();
            try {
                jSONObject.put(HttpFailureTable.COLUMN_PARAMS, jSONObject2);
                jSONObject.put(FastPlayRouterHelper.ROUTER, GameCenterRouterManager.URL_PLUGIN_MINIGAME_PLAY);
                jSONObject.put("package", PluginConstant.PLUGIN_PACKAGE_NAME_MINIGAME);
                jSONObject2.put("gameId", "" + i);
                GameCenterRouterManager.getInstance().openActivityByJson(this.mContext, jSONObject);
                return;
            } catch (JSONException e) {
                e.printStackTrace();
                return;
            }
        }
        if (z || TextUtils.isEmpty(string)) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.webview.title", string2);
        bundle.putString("intent.extra.webview.url", string);
        int i4 = 0;
        if (i2 != 0) {
            if (i2 == 1) {
                i4 = 2;
            } else if (i2 == 2) {
                i4 = 1;
            }
        }
        bundle.putInt("intent.extra.webview.screenorientation", i4);
        GameCenterRouterManager.getInstance().openHtml5WebActivity(this.mContext, bundle);
    }

    @JavascriptInterface
    public void gallery(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
        try {
            if (parseJSONObjectFromString.has("list")) {
                JSONArray jSONArray = parseJSONObjectFromString.getJSONArray("list");
                int length = jSONArray.length();
                for (int i = 0; i < length; i++) {
                    PicDetailModel picDetailModel = new PicDetailModel();
                    picDetailModel.parse(ap.getJSONObject(i, jSONArray));
                    arrayList.add(picDetailModel);
                }
                int i2 = parseJSONObjectFromString.has("index") ? parseJSONObjectFromString.getInt("index") : 0;
                Bundle bundle = new Bundle();
                bundle.putInt("intent.extra.picture.detail.position", i2);
                bundle.putParcelableArrayList("intent.extra.picture.url.list", arrayList);
                GameCenterRouterManager.getInstance().openPictureDetail(this.mContext, bundle);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @JavascriptInterface
    public void jumpToShopDressUp() {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 1);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void jumpToFamilyDressUpDetail(int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.icon.frame.id", i);
        GameCenterRouterManager.getInstance().openShopHeadgearDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsSendMsgToFriend(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        String string = ap.getString(RemoteMessageConst.MessageBody.MSG_CONTENT, parseJSONObjectFromString);
        String string2 = ap.getString("ptUid", parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.family.invite.content", string);
        if (!TextUtils.isEmpty(string2)) {
            bundle.putString("intent.extra.message.remark.name", ap.getString("nickName", parseJSONObjectFromString));
            bundle.putString("intent.extra.message.uid", string2);
            GameCenterRouterManager.getInstance().openMessageChat(this.mContext, bundle, new int[0]);
        } else {
            bundle.putString("intent.extra.goto.user.homepage.user.ptuid", string2);
            bundle.putInt("intent.extra.friends.type", 258);
            GameCenterRouterManager.getInstance().openUserFriendList(this.mContext, bundle);
        }
    }

    @JavascriptInterface
    public void onJsSetExtensionInfo(String str) {
        String string = ap.getString("extType", ap.parseJSONObjectFromString(str));
        Bundle bundle = new Bundle();
        bundle.putSerializable("intent.extra.shop.exchange.info.setting.type", Integer.valueOf(ShopExchangeHelper.getType(string)));
        bundle.putBoolean("intent.extra.shop.exchange.entity.contract.is.update", !TextUtils.isEmpty(UserCenterManager.getContractId()));
        GameCenterRouterManager.getInstance().openShopExchangeInfoSetting(this.mContext, bundle, 1);
    }

    @JavascriptInterface
    public void jumpToGoodsDetail(int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.goods.detail.id", i);
        GameCenterRouterManager.getInstance().openShopGoodsDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public String onJsGetPtUid() {
        return UserCenterManager.getPtUid();
    }

    @JavascriptInterface
    @Deprecated
    public void onJsToActivityList(int i, int i2) {
        Bundle bundle = new Bundle();
        if (i2 == 1) {
            bundle.putBoolean("intent.extra.is.default.selected.my.activity.tab", false);
            GameCenterRouterManager.getInstance().openAllActivities(this.mContext, bundle);
        } else if (i2 == 2) {
            bundle.putBoolean("intent.extra.is.default.selected.my.activity.tab", true);
            GameCenterRouterManager.getInstance().openAllActivities(this.mContext, bundle);
        } else {
            bundle.putSerializable("intent.extra.activity.list.type", Integer.valueOf(i2));
            bundle.putInt("intent.extra.activity.own.id", i);
            GameCenterRouterManager.getInstance().openActivitiesList(this.mContext, bundle);
        }
    }

    @JavascriptInterface
    public void jumpToShopExchange() {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 0);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void jumpToShop() {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 0);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, 67108864);
    }

    @JavascriptInterface
    public void onJsToMyTask() {
        GameCenterRouterManager.getInstance().openEverydayTask(this.mContext, new int[0]);
    }

    @JavascriptInterface
    public void jumpToPhoneGameActivities() {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.activity.list.type", 3);
        GameCenterRouterManager.getInstance().openActivitiesList(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openWallet() {
        GameCenterRouterManager.getInstance().openWallet(this.mContext, null);
    }

    @JavascriptInterface
    public void openWallet(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.source.type", str);
        bundle.putString("intent.extra.source.id", str2);
        GameCenterRouterManager.getInstance().openWallet(this.mContext, bundle);
    }

    @JavascriptInterface
    public String getSignResult(String str) {
        return AppNativeHelper.getServerApi(str);
    }

    @JavascriptInterface
    public String getPauth() {
        return (String) Config.getValue(SysConfigKey.AUTH_PAUTH);
    }

    @JavascriptInterface
    public void jumpToNewGame() {
        GameCenterRouterManager.getInstance().openHomeNewGameTab(this.mContext);
    }

    @JavascriptInterface
    public void jumpToGameDetailWithIndex(String str, int i) {
        if ("0".equalsIgnoreCase(str)) {
            ToastUtils.showToast(this.mContext, this.mContext.getString(R.string.live_no_such_game));
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        bundle.putInt("com.m4399.gamecenter.tab.current.item", i);
        GameCenterRouterManager.getInstance().openGameDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void openGameReviews() {
        GameCenterRouterManager.getInstance().openWeeklyFeatured(this.mContext, null);
    }

    @JavascriptInterface
    public void jumpToGameDetailWithVideoFlag(String str) {
        if ("0".equalsIgnoreCase(str)) {
            ToastUtils.showToast(this.mContext, this.mContext.getString(R.string.live_no_such_game));
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        bundle.putBoolean("intent.extra.game.detail.intro.show.more.video", true);
        GameCenterRouterManager.getInstance().openGameDetail(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void jumpToGameHubSubscribe() {
        UserCenterManager.checkIsLogin(this.mContext, new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Boolean bool, Object... objArr) {
                if (bool.booleanValue()) {
                    com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(AndroidJsInterface.this.mContext, com.m4399.gamecenter.plugin.main.manager.h.HOME_TAB_KEY_GAME_HUB, new int[0]);
                }
            }
        });
    }

    @JavascriptInterface
    public void jumpToGameHubAdd(String str, String str2, String str3, String str4, String str5) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.game.hub.post.title", str);
        bundle.putString("intent.extra.game.hub.add.post.content", str2);
        bundle.putInt("intent.extra.gamehub.id", bc.toInt(str3));
        bundle.putInt("intent.extra.game.forums.id", bc.toInt(str4));
        bundle.putString("intent.extra.gamehub.kind.id", str5);
        GameCenterRouterManager.getInstance().openGameHubPostPublish(this.mContext, bundle);
    }

    @Keep
    @JavascriptInterface
    public void jumpToGameHubAdd(String str, String str2, String str3, String str4, String str5, String str6) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.game.hub.post.title", str);
        bundle.putString("intent.extra.game.hub.add.post.content", str2);
        bundle.putInt("intent.extra.gamehub.id", bc.toInt(str3));
        bundle.putInt("intent.extra.game.forums.id", bc.toInt(str4));
        bundle.putString(GameHubDetailForumStyleActivity.INTENT_EXTRA_GAMEHUB_NAME, str6);
        bundle.putString("intent.extra.gamehub.kind.id", str5);
        GameCenterRouterManager.getInstance().openGameHubPostPublish(this.mContext, bundle);
    }

    @Keep
    @JavascriptInterface
    public void jumpToGameHubAddVideo(final String str, final String str2, final String str3, final String str4, final String str5, final String str6) {
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                final o oVar = new o();
                oVar.setGameHubId(str3);
                oVar.loadData(new ILoadPageEventListener() {
                    @Override
                    public void onBefore() {
                        AndroidJsInterface.this.f(true, "");
                    }

                    @Override
                    public void onSuccess() {
                        AndroidJsInterface.this.f(false, "");
                        if (oVar.canPostVideo()) {
                            Bundle bundle = new Bundle();
                            bundle.putString("intent.extra.game.hub.post.title", str);
                            bundle.putString("intent.extra.game.hub.add.post.content", str2);
                            bundle.putInt("intent.extra.gamehub.id", Integer.valueOf(str3).intValue());
                            bundle.putInt("intent.extra.game.forums.id", Integer.valueOf(str4).intValue());
                            bundle.putString(GameHubDetailForumStyleActivity.INTENT_EXTRA_GAMEHUB_NAME, str6);
                            bundle.putString("intent.extra.gamehub.kind.id", str5);
                            bundle.putBoolean("intent.extra.is.open.video.selected.page", true);
                            GameCenterRouterManager.getInstance().openGameHubPostPublish(AndroidJsInterface.this.mContext, bundle);
                            return;
                        }
                        new m(AndroidJsInterface.this.mContext).display(oVar.getPostVideoLockTitle(), oVar.getPostVideoLockText().split("<br>"), new String[]{AndroidJsInterface.this.mContext.getString(R.string.close)}, null);
                    }

                    @Override
                    public void onFailure(Throwable th, int i, String str7, int i2, JSONObject jSONObject) {
                        ToastUtils.showToast(PluginApplication.getContext(), HttpResultTipUtils.getFailureTip(PluginApplication.getContext(), th, i, str7));
                    }
                });
            }
        });
    }

    public void getShareActivityConfig() {
        invoke("set_share_config");
    }

    @Override
    @JavascriptInterface
    public void bindEvent(String str, String str2) {
        super.bindEvent(str, str2);
    }

    @Override
    @JavascriptInterface
    public void unbindEvent(String str, String str2) {
        super.bindEvent(str, str2);
    }

    @JavascriptInterface
    public void finishActivity() {
        if (this.mContext == null || !(this.mContext instanceof Activity)) {
            return;
        }
        ((Activity) this.mContext).finish();
    }

    @JavascriptInterface
    public void finishActivity(String str) {
        if (this.mContext == null || !(this.mContext instanceof Activity)) {
            return;
        }
        Intent intent = new Intent();
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        Iterator<String> keys = parseJSONObjectFromString.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            intent.putExtra(next, ap.getString(next, parseJSONObjectFromString));
        }
        ((Activity) this.mContext).setResult(-1, intent);
        ((Activity) this.mContext).finish();
    }

    @JavascriptInterface
    public void onClickUserPortraitByComment(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        String string = ap.getString("uid", parseJSONObjectFromString);
        String string2 = ap.getString("nickName", parseJSONObjectFromString);
        String string3 = ap.getString(PushConstants.CLICK_TYPE, parseJSONObjectFromString);
        if (!TextUtils.isEmpty(string)) {
            Bundle bundle = new Bundle();
            bundle.putString("intent.extra.goto.user.homepage.username", string2);
            bundle.putString("intent.extra.goto.user.homepage.user.ptuid", string);
            GameCenterRouterManager.getInstance().openUserHomePage(this.mContext, bundle);
        }
        if ("1".equals(string3)) {
            UMengEventUtils.onEvent("game_comment_user_icon");
        } else if ("2".equals(string3)) {
            UMengEventUtils.onEvent("news_comment_user_icon");
        } else if ("3".equals(string3)) {
            UMengEventUtils.onEvent("game_comment_user_icon");
        }
    }

    @JavascriptInterface
    public void playLiveRoom(int i) {
        ar.playLiveTv(this.mContext, i, "", -1, 0);
    }

    @JavascriptInterface
    public void playLiveMyGuard() {
        ar.openLiveMyGuard(this.mContext);
    }

    @JavascriptInterface
    public void playLiveGuardBuy(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        ar.openLiveMyGuard(this.mContext);
    }

    @JavascriptInterface
    public void openFollowAnchors() {
        GameCenterRouterManager.getInstance().openFollowedAnchorList(this.mContext);
    }

    @JavascriptInterface
    public void jumpToShopThemeDetail(int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.shop.theme.id", i);
        GameCenterRouterManager.getInstance().openShopThemeDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToShopTheme() {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 2);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void onJsToDianleWithoutLogin() {
        if (HW()) {
            return;
        }
        GameCenterRouterManager.getInstance().openEverydayTask(this.mContext, new int[0]);
        UMengEventUtils.onEvent("ad_me_shake_goto_gain_money");
    }

    @JavascriptInterface
    public void onJsToUserInfo(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        if (parseJSONObjectFromString == null) {
            return;
        }
        UserInfoModel userInfoModel = new UserInfoModel();
        userInfoModel.parse(parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.is.from.user.navi", true);
        bundle.putParcelable("intent.extra.goto.userinfo.model", userInfoModel);
        GameCenterRouterManager.getInstance().openUserInfo(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToAddFeed(String str) {
        final Bundle bundle;
        if (TextUtils.isEmpty(str)) {
            bundle = null;
        } else {
            JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
            int i = ap.getInt("id", parseJSONObjectFromString);
            String[] split = ap.getString("content", parseJSONObjectFromString).split("#", 3);
            bundle = new Bundle();
            bundle.putInt("extra.zone.publish.type", 4100);
            bundle.putString("topic.id", String.valueOf(i));
            bundle.putString("extra.topic.tip", split[1]);
            bundle.putString("extra.topic.content", split[2]);
        }
        Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
            @Override
            public void call(Object obj) {
                GameCenterRouterManager.getInstance().openZonePublish(AndroidJsInterface.this.mContext, bundle);
            }
        });
    }

    @JavascriptInterface
    public void jumpToMyZone() {
        if (UserCenterManager.isLogin().booleanValue()) {
            String nick = UserCenterManager.getNick();
            String ptUid = UserCenterManager.getPtUid();
            Bundle bundle = new Bundle();
            bundle.putString("intent.extra.goto.user.homepage.title.nick", nick);
            bundle.putString("intent.extra.goto.user.homepage.user.ptuid", ptUid);
            bundle.putString("intent.extra.tab.index", "feed");
            GameCenterRouterManager.getInstance().openUserHomePage(this.mContext, bundle);
            return;
        }
        GameCenterRouterManager.getInstance().openLogin(this.mContext, (Bundle) null);
    }

    @JavascriptInterface
    public void openUserMedal() {
        if (UserCenterManager.isLogin().booleanValue()) {
            openUserMedalList(UserCenterManager.getPtUid());
        } else {
            GameCenterRouterManager.getInstance().openLogin(this.mContext, (Bundle) null);
        }
    }

    @JavascriptInterface
    public void openUserHomePage(String str) {
        if (UserCenterManager.isLogin().booleanValue()) {
            String nick = UserCenterManager.getNick();
            String ptUid = UserCenterManager.getPtUid();
            Bundle bundle = new Bundle();
            bundle.putString("intent.extra.goto.user.homepage.title.nick", nick);
            bundle.putString("intent.extra.goto.user.homepage.user.ptuid", ptUid);
            bundle.putString("intent.extra.tab.index", str);
            GameCenterRouterManager.getInstance().openUserHomePage(this.mContext, bundle);
            return;
        }
        GameCenterRouterManager.getInstance().openLogin(this.mContext, (Bundle) null);
    }

    @JavascriptInterface
    public void openTopicCreate() {
        Bundle bundle = new Bundle();
        bundle.putInt("extra.zone.publish.type", 4114);
        GameCenterRouterManager.getInstance().openZonePublish(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openTopicMore() {
        GameCenterRouterManager.getInstance().openZoneCreateTopic(this.mContext, new Bundle(), false);
    }

    @JavascriptInterface
    public void openTopicAll(String str) {
        Bundle bundle = new Bundle();
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        if (parseJSONObjectFromString.has("category_id")) {
            bundle.putString("intent.extra.zone.topic.all.tag.id", ap.getString("category_id", parseJSONObjectFromString));
        }
        GameCenterRouterManager.getInstance().openZoneCreateTopic(this.mContext, bundle, false);
    }

    @JavascriptInterface
    public void openShopEmojiTab() {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", 3);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void openEmojiDetail(String str) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.shop.emoji.id", bc.toInt(str));
        GameCenterRouterManager.getInstance().openShopEmojiDetail(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openRecommendZone() {
        GameCenterRouterManager.getInstance().openZoneRecommend(this.mContext, null);
    }

    @JavascriptInterface
    public void openSandBox() {
        GameCenterRouterManager.getInstance().openSandBox(this.mContext);
    }

    @JavascriptInterface
    public void playLiveTv(String str) {
        ar.playLiveTv(this.mContext, str, "", -1, 0);
    }

    @JavascriptInterface
    public void jumpToSearchGame(String str) {
        Bundle bundle = new Bundle();
        bundle.putParcelable("intent.extra.search.hint", new SuggestSearchWordModel(str));
        GameCenterRouterManager.getInstance().openSearchGame(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToInstallSetting(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fargment_name", SettingActivity.SETTING_INSTALL_FRAGMENT);
        GameCenterRouterManager.getInstance().openSettings(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToSecondSettingPage(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fargment_name", str);
        GameCenterRouterManager.getInstance().openSettings(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToMyGames() {
        GameCenterRouterManager.getInstance().openMyGame(this.mContext, new int[0]);
    }

    @JavascriptInterface
    public void openGameComment(String str) {
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.comment.action.type", 1);
        bundle.putBoolean("intent.extra.comment.is.draft", false);
        bundle.putInt("intent.extra.game.id", bc.toInt(str));
        com.m4399.gamecenter.plugin.main.manager.w.a.getInstance().openGameCommentPage(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openGameCommentByJson(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        boolean z = ap.getBoolean("is_draft", parseJSONObjectFromString, true);
        int i = ap.getInt("game_id", parseJSONObjectFromString);
        int i2 = ap.getInt("star", parseJSONObjectFromString);
        boolean z2 = ap.getBoolean("from_game_detail", parseJSONObjectFromString, false);
        if (this.mContext instanceof GameDetailActivity) {
            ((GameDetailActivity) this.mContext).setCommentFromGamedetail(z2);
        }
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.comment.action.type", 1);
        if (i2 > 0) {
            bundle.putInt("intent.extra.comment.rating", i2);
        }
        if (z) {
            bundle.putInt("intent.extra.game.comment.add.dialog.type", ap.getInt("dialog_type", parseJSONObjectFromString));
        }
        bundle.putBoolean("intent.extra.comment.is.draft", z);
        bundle.putInt("intent.extra.game.id", i);
        com.m4399.gamecenter.plugin.main.manager.w.a.getInstance().openGameCommentPage(this.mContext, bundle);
    }

    @JavascriptInterface
    public void jumpToShopTab(int i) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.from.key", ShopActivity.FROM_WEB);
        bundle.putString("intent.extra.from.key.id", getId());
        bundle.putInt("com.m4399.gamecenter.tab.current.item", i);
        GameCenterRouterManager.getInstance().openShop(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void openWeb(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.webview.url", str);
        GameCenterRouterManager.getInstance().openWebViewActivity(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void openBrowser(String str) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(ap.getString("url", ap.parseJSONObjectFromString(str))));
        if (this.mContext != null) {
            this.mContext.startActivity(intent);
        }
    }

    @JavascriptInterface
    public void openLiveRank() {
        GameCenterRouterManager.getInstance().openLiveRank(this.mContext);
    }

    @JavascriptInterface
    public void openLiveCategory(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.category.tag.key", str);
        bundle.putString("intent.extra.category.tag.name", str2);
        GameCenterRouterManager.getInstance().openLiveAll(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openMyGames(int i) {
        Bundle bundle = new Bundle();
        bundle.putInt("tag.my.games.tab.index", i);
        GameCenterRouterManager.getInstance().openMyGame(this.mContext, bundle, new int[0]);
    }

    @JavascriptInterface
    public void openNewGame() {
        GameCenterRouterManager.getInstance().openNewGameVideo(this.mContext, null);
    }

    @JavascriptInterface
    public void jumpToMyTheme() {
        GameCenterRouterManager.getInstance().openShopMyTheme(this.mContext);
    }

    @JavascriptInterface
    public void onJsToUseHeadgear(int i) {
        UserCenterManager.setHeadGearId(i);
        com.m4399.gamecenter.plugin.main.providers.shop.ab abVar = new com.m4399.gamecenter.plugin.main.providers.shop.ab();
        abVar.setIconFrameId(i);
        abVar.loadData(null);
    }

    @JavascriptInterface
    public void toReserveArea() {
        GameCenterRouterManager.getInstance().openSubscribeGameList(this.mContext, null);
    }

    @JavascriptInterface
    public void onJsToIndependentGames() {
        GameCenterRouterManager.getInstance().openIndependGameList(this.mContext);
    }

    @JavascriptInterface
    public void onJsToIndependGameDeveloper(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.independgame.developer.id", str);
        bundle.putString("intent.extra.independgame.developer.umeng.path", "活动进入");
        GameCenterRouterManager.getInstance().openIndependGameDeveloper(this.mContext, bundle);
    }

    @JavascriptInterface
    public void toZoneRecommend(int i) {
        boolean z = false;
        boolean z2 = true;
        if (i == 0) {
            z = true;
        } else if (i != 1) {
            z2 = false;
        }
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.zone.show.recommend", z);
        bundle.putBoolean("intent.extra.zone.show.video.recommend", z2);
        GameCenterRouterManager.getInstance().openZoneRecommend(this.mContext, bundle);
    }

    @JavascriptInterface
    public String getManufacturer() {
        String romType = bk.getRomType();
        if (!TextUtils.isEmpty(romType)) {
            return romType.toLowerCase();
        }
        String str = Build.MANUFACTURER;
        return !TextUtils.isEmpty(str) ? str.toLowerCase() : "";
    }

    @JavascriptInterface
    public void openAppInfo(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.setData(Uri.fromParts("package", str, null));
        this.mContext.startActivity(intent);
    }

    @JavascriptInterface
    public void openTalentHall(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        boolean z = ap.getBoolean("is_subscribd", parseJSONObjectFromString);
        int i = ap.getInt(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, parseJSONObjectFromString);
        int i2 = ap.getInt(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_FORUMS_ID, parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.gamehub.isjoined", z);
        bundle.putInt("intent.extra.gamehub.id", i);
        bundle.putInt("intent.extra.game.forums.id", i2);
        GameCenterRouterManager.getInstance().openGameHubTalent(this.mContext, bundle);
    }

    @JavascriptInterface
    public void openHubDetail(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        int i = ap.getInt(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, parseJSONObjectFromString);
        int i2 = ap.getInt(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_FORUMS_ID, parseJSONObjectFromString);
        int i3 = ap.getInt("game_id", parseJSONObjectFromString);
        int i4 = ap.getInt("tab", parseJSONObjectFromString);
        int i5 = ap.getInt("kind_id", parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.gamehub.id", i);
        bundle.putInt("intent.extra.gamehub.forums.id", i2);
        bundle.putInt("intent.extra.gamehub.game.id", i3);
        bundle.putInt("intent.extra.game.hub.tab.id", i4);
        bundle.putInt("intent.extra.gamehub.kind.id", i5);
        GameCenterRouterManager.getInstance().openGameHubDetail(this.mContext, bundle, false, new int[0]);
    }

    @JavascriptInterface
    public void openPlayerRecommendList() {
        bj.openPlayerRecList(this.mContext);
        UMengEventUtils.onEvent("ad_game_user_recommend_tab", "活动");
    }

    @JavascriptInterface
    public void openMsgManager(final int i) {
        UserCenterManager.checkIsLogin(this.mContext, new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Boolean bool, Object... objArr) {
                Bundle bundle = new Bundle();
                bundle.putInt("intent.extra.tab.index", i);
                GameCenterRouterManager.getInstance().openMessage(AndroidJsInterface.this.mContext, bundle, new int[0]);
            }
        });
    }

    @JavascriptInterface
    public void webviewRquestFocus() {
        Observable.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
            @Override
            public void call(Object obj) {
                if (AndroidJsInterface.this.mWebView == null || ActivityStateUtils.isDestroy(AndroidJsInterface.this.mWebView.getContext())) {
                    return;
                }
                AndroidJsInterface.this.mWebView.getWebView().requestFocus();
            }
        });
    }

    @JavascriptInterface
    public void setStatTitle(String str) {
        if (this.mContext instanceof BaseActivity) {
            ((BaseActivity) this.mContext).getPageTracer().setTraceTitle(str);
        }
    }

    @JavascriptInterface
    public String getPageTrace() {
        return this.mContext instanceof BaseActivity ? StatManager.filterTrace(((BaseActivity) this.mContext).getPageTracer().getFullTrace()) : "";
    }

    @Keep
    @JavascriptInterface
    public void checkAppUpgrade(final String str) {
        if (this.mContext == null) {
            return;
        }
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
                com.m4399.gamecenter.plugin.main.manager.ac.a.getInstance().checkUpgradeInFeature(null, ap.getString("msg", parseJSONObjectFromString), ap.getBoolean("resume", parseJSONObjectFromString, true));
            }
        });
    }

    @Keep
    @JavascriptInterface
    public String getSMDeviceId() {
        return (String) Config.getValue(SysConfigKey.SM_DEVICE_ID);
    }

    @JavascriptInterface
    public void showBottomBar(String str) {
        if (this.mWebView == null) {
            return;
        }
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        final String string = ap.getString(u.COLUMN_ICON_URL, parseJSONObjectFromString);
        final String string2 = ap.getString("content", parseJSONObjectFromString);
        final String string3 = ap.getString("click_cb", parseJSONObjectFromString);
        Observable.just("").observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<String>() {
            @Override
            public void call(String str2) {
                if (AndroidJsInterface.this.mWebView == null) {
                    return;
                }
                AndroidJsInterface.this.mWebView.showBottombar(string, string2, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (TextUtils.isEmpty(string3)) {
                            return;
                        }
                        AndroidJsInterface.this.invoke(string3);
                    }
                });
            }
        });
    }

    @JavascriptInterface
    public void hideBottomBar() {
        if (this.mContext == null || this.mWebView == null) {
            return;
        }
        Observable.just("").observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<String>() {
            @Override
            public void call(String str) {
                if (AndroidJsInterface.this.mWebView != null) {
                    AndroidJsInterface.this.mWebView.hideBottomBar();
                }
            }
        });
    }

    @JavascriptInterface
    public String getCurrentPageTrace() {
        return StatManager.filterTrace(com.m4399.gamecenter.plugin.main.base.utils.a.c.getFullTrace(this.mContext));
    }

    @JavascriptInterface
    public String getRomType() {
        return bk.getRomType();
    }

    @JavascriptInterface
    public void openRecruitTestList() {
        GameCenterRouterManager.getInstance().openRecruitTester(this.mContext);
    }

    @JavascriptInterface
    public int isSupportRouterUrl(String str) {
        return GameCenterRouterManager.getInstance().containsUrl(str) ? 1 : 0;
    }

    @Keep
    @JavascriptInterface
    public void openActivityByJson(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        if (GameCenterRouterManager.getInstance().containsUrl(ap.getString(FastPlayRouterHelper.ROUTER, parseJSONObjectFromString))) {
            GameCenterRouterManager.getInstance().openActivityByJson(this.mContext, parseJSONObjectFromString);
        }
    }

    @Keep
    @JavascriptInterface
    public void openActivityByUrl(String str) {
        GameCenterRouterManager.getInstance().openActivityByProtocol(this.mContext, str);
    }

    @JavascriptInterface
    public void openTestGame() {
        GameCenterRouterManager.getInstance().openNewGameTestList(this.mContext);
    }

    @JavascriptInterface
    public void openHomeAndScrollToTop() {
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.jump.scroll.to.top", true);
        com.m4399.gamecenter.plugin.main.manager.h.getInstance().switchHomepageTab(this.mContext, com.m4399.gamecenter.plugin.main.manager.h.FIND_GAME_TAB_KEY_RECOMMEND, true, bundle, new int[0]);
    }

    @Keep
    @JavascriptInterface
    public String getDeviceInfo() {
        JSONObject jSONObject = new JSONObject();
        ap.putObject(am.w, t.getCpuModel(), jSONObject);
        ap.putObject(am.y, Integer.valueOf(Build.VERSION.SDK_INT), jSONObject);
        try {
            ap.putObject("network", NetworkStatusManager.getCurrentNetwork().getNetworkTypeName(), jSONObject);
            ap.putObject("memory", Long.valueOf(t.getTotalMemory()), jSONObject);
            ap.putObject("total_storage", Long.valueOf(StorageManager.getStorageVolumes().get(0).getTotalSpace()), jSONObject);
            ap.putObject("free_storage", Long.valueOf(StorageManager.getStorageVolumes().get(0).getFreeSpace()), jSONObject);
        } catch (Exception unused) {
        }
        return jSONObject.toString();
    }

    @JavascriptInterface
    @Deprecated
    public void openLevelMine() {
        openUserLevelPage(UserCenterManager.getPtUid());
    }

    @JavascriptInterface
    public void openUserLevelPage(String str) {
        if ((TextUtils.isEmpty(str) && UserCenterManager.isLogin().booleanValue()) || str.equals(UserCenterManager.getPtUid())) {
            GameCenterRouterManager.getInstance().openUserGrade(this.mContext);
            UMengEventUtils.onEvent("ad_me_level", "from", "来自前端方法调用");
        }
    }

    @JavascriptInterface
    public void openUserMedalList(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("intent.extra.user.uid", str);
        GameCenterRouterManager.getInstance().openUserMedalList(this.mContext, bundle);
    }

    @JavascriptInterface
    public void onJsToActivityList(int i, int i2, int i3, String str) {
        Bundle bundle = new Bundle();
        if (i2 == 1) {
            bundle.putBoolean("intent.extra.is.default.selected.my.activity.tab", false);
            bundle.putInt("intent.extra.activity.tab.id", i3);
            bundle.putString("intent.extra.activity.tag.key", str);
            GameCenterRouterManager.getInstance().openAllActivities(this.mContext, bundle);
            return;
        }
        if (i2 == 2) {
            bundle.putBoolean("intent.extra.is.default.selected.my.activity.tab", true);
            GameCenterRouterManager.getInstance().openAllActivities(this.mContext, bundle);
        } else {
            bundle.putSerializable("intent.extra.activity.list.type", Integer.valueOf(i2));
            bundle.putInt("intent.extra.activity.own.id", i);
            GameCenterRouterManager.getInstance().openActivitiesList(this.mContext, bundle);
        }
    }

    @JavascriptInterface
    public void openUserHomeMyVideoTab() {
        UserCenterManager.checkIsLogin(this.mContext, new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Boolean bool, Object... objArr) {
                if (bool.booleanValue()) {
                    Bundle bundle = new Bundle();
                    String nick = UserCenterManager.getNick();
                    String ptUid = UserCenterManager.getPtUid();
                    bundle.putString("intent.extra.goto.user.homepage.title.nick", nick);
                    bundle.putString("intent.extra.goto.user.homepage.user.ptuid", ptUid);
                    bundle.putString("intent.extra.tab.index", "video");
                    GameCenterRouterManager.getInstance().openUserHomePage(AndroidJsInterface.this.mContext, bundle);
                }
            }
        });
    }

    @JavascriptInterface
    public void openPlayerVideoPublish(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        int i = ap.getInt("game_id", parseJSONObjectFromString);
        String string = ap.getString(n.GAME_ICON, parseJSONObjectFromString);
        String string2 = ap.getString(n.GAME_NAME, parseJSONObjectFromString);
        int i2 = ap.getInt(ConstantsAPI.WXWebPage.KEY_ACTIVITY_ID, parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putInt("intent.extra.game.id", i);
        bundle.putString("intent.extra.game.name", string2);
        bundle.putString("intent.extra.game.icon", string);
        bundle.putInt("intent.extra.activity.id", i2);
        bundle.putInt("intent.extra.from.key", 3);
        GameCenterRouterManager.getInstance().openPlayerVideoPublish(this.mContext, bundle);
    }

    @JavascriptInterface
    public int getPublishedPlayerVideoId() {
        return com.m4399.gamecenter.plugin.main.manager.activities.a.getInstance().getPlayerVideoServerId();
    }

    @Keep
    @JavascriptInterface
    public void savePic(final String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        StoragePermissionManager.INSTANCE.checkStoragePermissions(this.mContext, new StoragePermissionManager.a() {
            @Override
            public void onFinish(boolean z) {
                if (z) {
                    Observable.just(str).map(new Func1<String, Boolean>() {
                        @Override
                        public Boolean call(String str2) {
                            String dCIMPictureSavePath = AlbumUtils.getDCIMPictureSavePath("invite_" + System.currentTimeMillis() + ".jpg");
                            try {
                                if (!new File(dCIMPictureSavePath).createNewFile()) {
                                    System.out.println("File already exists");
                                }
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                            try {
                                return Boolean.valueOf(AlbumUtils.saveBitmapByteArrayToMediaStore(BaseApplication.getApplication(), Base64.decode(str2, 0), dCIMPictureSavePath));
                            } catch (Exception e2) {
                                e2.printStackTrace();
                                return false;
                            }
                        }
                    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Boolean>() {
                        @Override
                        public void call(Boolean bool) {
                            if (bool.booleanValue()) {
                                ToastUtils.showToast(AndroidJsInterface.this.mContext, R.string.qrcode_save);
                            }
                        }
                    });
                } else {
                    ToastUtils.showToast(AndroidJsInterface.this.mContext, AndroidJsInterface.this.mContext.getString(R.string.save_fail));
                }
            }
        });
    }

    @Keep
    @JavascriptInterface
    public void openHebiRecharge(String str) {
        if (this.mContext == null) {
            return;
        }
        final JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        if (parseJSONObjectFromString.length() == 0) {
            return;
        }
        String string = ap.getString("source_type", parseJSONObjectFromString);
        String string2 = ap.getString("source_id", parseJSONObjectFromString);
        final Bundle bundle = new Bundle();
        if (!TextUtils.isEmpty(str)) {
            if (!TextUtils.isEmpty(string)) {
                bundle.putString("intent.extra.source.type", string);
            }
            if (!TextUtils.isEmpty(string2)) {
                bundle.putString("intent.extra.source.id", string2);
            }
        }
        bi.loadPlugin(this.mContext, new com.m4399.gamecenter.plugin.main.manager.plugin.d() {
            @Override
            public void onCancel() {
            }

            @Override
            public void onSuccess() {
                float f = ap.getFloat("money", parseJSONObjectFromString);
                if (f <= 0.0f) {
                    bi.invokeRechargeMethod("openHebiRecharge", AndroidJsInterface.this.mContext, bundle);
                    return;
                }
                String string3 = ap.getString("name", parseJSONObjectFromString);
                int ceil = (int) Math.ceil(f);
                bundle.putFloat("intent.extra.pay.game.price", f);
                bundle.putInt("intent.extra.pay.game.recharge_sum", ceil);
                bundle.putString("intent.extra.pay.game.name", string3);
                bi.invokeRechargeMethod("openHebiRecharge", BaseApplication.getApplication().getCurrentActivity(), bundle, new ILoadPageEventListener() {
                    @Override
                    public void onBefore() {
                    }

                    @Override
                    public void onFailure(Throwable th, int i, String str2, int i2, JSONObject jSONObject) {
                    }

                    @Override
                    public void onSuccess() {
                    }
                });
            }
        });
    }

    public void rechargeHebiCallback(int i) {
        invoke("rechargeHebiComplete", String.valueOf(i));
        bi.destroyRecharge();
    }

    @Keep
    @JavascriptInterface
    public void openCommonWebDialog(final String str) {
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                com.m4399.gamecenter.plugin.main.manager.ae.a.getInstance().showWebPanelDialog(AndroidJsInterface.this.mContext, str);
            }
        });
    }

    private void a(String str, a aVar) {
        if (TextUtils.isEmpty(str)) {
            if (aVar != null) {
                aVar.dR(null);
                return;
            }
            return;
        }
        String generateRandomCharAndNumber = bp.generateRandomCharAndNumber(10);
        this.ceW.put(generateRandomCharAndNumber, aVar);
        this.mWebView.loadJs("javascript:window.android.setResult(\"" + generateRandomCharAndNumber + "\"," + str + "())");
    }

    @Keep
    @JavascriptInterface
    public void setResult(String str, String str2) {
        a remove = this.ceW.remove(str);
        if (remove != null) {
            remove.dR(str2);
        }
    }

    @Keep
    @JavascriptInterface
    public void setExitInterceptor(String str) {
        this.ceX = ap.getString("function_name", ap.parseJSONObjectFromString(str));
    }

    public boolean onFinishComfirm() {
        if (TextUtils.isEmpty(this.ceX)) {
            return false;
        }
        a(this.ceX, new a() {
            @Override
            public void dR(String str) {
                if (bc.toInt(str) == 0) {
                    AndroidJsInterface.this.finishActivity();
                }
            }
        });
        return true;
    }

    @Keep
    @JavascriptInterface
    public void userFollow(final String str) {
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
                String string = ap.getString("uid", parseJSONObjectFromString);
                boolean z = ap.getBoolean(VideoPublishTaskMgr.ADD_TYPE, parseJSONObjectFromString);
                int i = JSONUtils.getInt("from", parseJSONObjectFromString);
                final String string2 = ap.getString("callback", parseJSONObjectFromString);
                AndroidJsInterface.this.mRxBusHandler.setFollowCallback(new RxBusHandler.a() {
                    @Override
                    public void onCallBack(JSONObject jSONObject) {
                        if (AndroidJsInterface.this.mWebView == null || TextUtils.isEmpty(string2)) {
                            return;
                        }
                        AndroidJsInterface.this.mWebView.loadJs(string2 + "(" + jSONObject.toString() + ")");
                    }
                });
                Bundle bundle = new Bundle();
                bundle.putString("intent.extra.user.uid", string);
                bundle.putString("intent.extra.is.follow", z ? "1" : "0");
                bundle.putString("intent.extra.is.follow", z ? "1" : "0");
                bundle.putInt("follow_from", i);
                GameCenterRouterManager.getInstance().doFollow(AndroidJsInterface.this.mContext, bundle);
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        RxBusHandler rxBusHandler = this.mRxBusHandler;
        if (rxBusHandler != null) {
            rxBusHandler.unregister();
        }
    }

    public static class RxBusHandler {
        private a cfz;

        public interface a {
            void onCallBack(JSONObject jSONObject);
        }

        public RxBusHandler() {
            RxBus.register(this);
        }

        public void unregister() {
            RxBus.unregister(this);
        }

        public void setFollowCallback(a aVar) {
            this.cfz = aVar;
        }

        @Keep
        @Subscribe(tags = {@Tag("tag.user.follow.success")})
        public void onFollowSuccess(Bundle bundle) {
            String string = bundle.getString("intent.extra.user.uid");
            boolean z = bundle.getBoolean("intent.extra.is.follow");
            a aVar = this.cfz;
            if (aVar != null) {
                aVar.onCallBack(ap.buildJSON("code", 100, "uid", string, VideoPublishTaskMgr.ADD_TYPE, Integer.valueOf(z ? 1 : 0)));
            }
        }

        @Keep
        @Subscribe(tags = {@Tag("tag.user.follow.fail")})
        public void onFolloFail(Bundle bundle) {
            a aVar = this.cfz;
            if (aVar != null) {
                aVar.onCallBack(ap.buildJSON("code", 0));
            }
        }
    }

    @JavascriptInterface
    public void onJsOpenVideo(String str) {
        JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
        int i = ap.getInt("type", parseJSONObjectFromString);
        String string = ap.getString("video_url", parseJSONObjectFromString);
        int i2 = ap.getInt("age_level", parseJSONObjectFromString);
        String string2 = ap.getString("video_thumb", parseJSONObjectFromString);
        Bundle bundle = new Bundle();
        bundle.putBoolean("intent.extra.video.play.statistic", true);
        if (i == 2) {
            bundle.putInt("intent.extra.video.id", ap.getInt("id", parseJSONObjectFromString));
            bundle.putBoolean("intent.extra.video.need.load.videourl", true);
        }
        if (i == 3) {
            int i3 = ap.getInt("id", parseJSONObjectFromString);
            int i4 = ap.getInt("thread_id", parseJSONObjectFromString);
            bundle.putBoolean("intent.extra.video.need.load.videourl", false);
            bundle.putInt("intent.extra.report.extra.forums.id", i3);
            bundle.putInt("intent.extra.gamehub.post.id", i4);
        }
        com.m4399.gamecenter.plugin.main.controllers.video.f.openVideoPlay(this.mContext, string, i2, string2, null, "", null, null, bundle, null);
    }

    @JavascriptInterface
    public void subscribeGame(final String str) {
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
                int i = ap.getInt("gameId", parseJSONObjectFromString);
                String string = ap.getString("name", parseJSONObjectFromString);
                String string2 = ap.getString("packageName", parseJSONObjectFromString);
                boolean z = ap.getBoolean("smsSubscribe", parseJSONObjectFromString);
                final String string3 = ap.getString("onFinish", parseJSONObjectFromString);
                new SubscribeGameManager().setContext(AndroidJsInterface.this.mContext).setAppId(i).setAppName(string).setAppPackage(string2).setSupportSms(z).subscribe(new Function1<Boolean, Unit>() {
                    @Override
                    public Unit invoke(Boolean bool) {
                        boolean booleanValue = bool.booleanValue();
                        AndroidJsInterface.this.invoke(string3, "{\"code\":" + (booleanValue ? 1 : 0) + "}");
                        return Unit.INSTANCE;
                    }
                });
            }
        });
    }

    @JavascriptInterface
    public String getAreaCode() {
        return (String) Config.getValue(SysConfigKey.USER_LAUNCHER_AREA);
    }

    @JavascriptInterface
    public void coupon(final String str) {
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                JSONObject parseJSONObjectFromString = ap.parseJSONObjectFromString(str);
                BaseCouponModel baseCouponModel = new BaseCouponModel();
                baseCouponModel.parse(parseJSONObjectFromString);
                CouponManagerImpl.getInstance().doActionByModel(AndroidJsInterface.this.mContext, baseCouponModel, new com.m4399.gamecenter.plugin.main.controllers.a() {
                    @Override
                    public void onSuccess() {
                        AndroidJsInterface.this.invoke("couponSuccess");
                    }

                    @Override
                    public void onFail() {
                        AndroidJsInterface.this.invoke("couponFail");
                    }
                });
            }
        });
    }

    @Keep
    @JavascriptInterface
    public String getTestInfo(int i) {
        JSONObject jSONObject = new JSONObject();
        ap.putObject("version", Integer.valueOf(v.getInstance().getLocalVersion(i)), jSONObject);
        boolean booleanValue = ((Boolean) Config.getValue(GameCenterConfigKey.WEB_VIEW_DEBUG_MODE)).booleanValue();
        boolean z = BaseApplication.getApplication().getStartupConfig().getReleaseMode() == 2;
        ap.putObject("openDebug", Boolean.valueOf(booleanValue), jSONObject);
        ap.putObject("isDeveloper", Boolean.valueOf(z), jSONObject);
        return jSONObject.toString();
    }

    @Keep
    @JavascriptInterface
    public String getPraiseImage() {
        JSONObject jSONObject = new JSONObject();
        ap.putObject("normal", PraiseHelper.INSTANCE.getPraiseNor(), jSONObject);
        ap.putObject("animate", PraiseHelper.INSTANCE.getPraiseWebAnimation(), jSONObject);
        ap.putObject("paised", PraiseHelper.INSTANCE.getPraisePressed(), jSONObject);
        return jSONObject.toString();
    }

    @Keep
    @JavascriptInterface
    public void checkContentPublishAuth(String str) {
        checkContentPublishAuth("huodong_huodong", str);
    }

    @Keep
    @JavascriptInterface
    public void checkContentPublishAuth(final String str, final String str2) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                AndroidJsInterface.this.af(str, str2);
            }
        });
    }

    public void af(String str, final String str2) {
        ContentPublishAuthManagerProxy.INSTANCE.getInstance().check(this.mContext, str, new com.m4399.gamecenter.plugin.main.listeners.f<Integer>() {
            @Override
            public void onChecking() {
            }

            @Override
            public void onCheckFinish(Integer num, Object... objArr) {
                ap.a aVar = new ap.a();
                aVar.put("code", 1);
                AndroidJsInterface.this.invoke(str2, aVar.get().toString());
            }
        });
    }

    @Keep
    @JavascriptInterface
    public String getEnv(String str) {
        return j.getEnv(str);
    }

    @Keep
    @JavascriptInterface
    public boolean isEnvExist(String str) {
        return j.isEnvExist(str);
    }

    @Keep
    @JavascriptInterface
    public String setEnv(String str, String str2) {
        return j.setEnv(str, str2);
    }

    @Keep
    @JavascriptInterface
    public void openCreatorCenter() {
        Activity activity = com.m4399.gamecenter.plugin.main.utils.a.getActivity(this.mContext);
        if (activity == null) {
            return;
        }
        if (activity instanceof CreatorCenterDescActivity) {
            ((CreatorCenterDescActivity) activity).onClickCreatorCenter();
        } else {
            GameCenterRouterManager.getInstance().openCreatorCenter(this.mContext);
        }
    }

    @Keep
    @JavascriptInterface
    public void showDialog(final String str) {
        RunHelper.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                j.showDialog(AndroidJsInterface.this, str);
            }
        });
    }

    @Keep
    @JavascriptInterface
    public boolean isGrantPermission(String str) {
        char c;
        String string = JSONUtils.getString("type", JSONUtils.parseJSONObjectFromString(str));
        int hashCode = string.hashCode();
        if (hashCode != -1884274053) {
            if (hashCode == 106642798 && string.equals("phone")) {
                c = 1;
            }
            c = 65535;
        } else {
            if (string.equals(DownloadTable.COLUMN_STORAGE)) {
                c = 0;
            }
            c = 65535;
        }
        String[] strArr = c != 0 ? c != 1 ? null : new String[]{"android.permission.READ_PHONE_STATE"} : new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"};
        if (strArr == null) {
            Timber.e("permission type not support:" + string, new Object[0]);
            return false;
        }
        return com.m4399.gamecenter.plugin.main.manager.permission.a.isPermissions(this.mContext, strArr);
    }

    @Keep
    @JavascriptInterface
    public void requestPermission(String str) {
        char c;
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        String string = JSONUtils.getString("type", parseJSONObjectFromString);
        int hashCode = string.hashCode();
        if (hashCode != -1884274053) {
            if (hashCode == 106642798 && string.equals("phone")) {
                c = 1;
            }
            c = 65535;
        } else {
            if (string.equals(DownloadTable.COLUMN_STORAGE)) {
                c = 0;
            }
            c = 65535;
        }
        if (c == 0) {
            JSONUtils.putObject("permissions", "android.permission.WRITE_EXTERNAL_STORAGE,android.permission.READ_EXTERNAL_STORAGE", parseJSONObjectFromString);
            requestPermissionOriginal(parseJSONObjectFromString.toString());
        } else {
            if (c != 1) {
                return;
            }
            JSONUtils.putObject("permissions", "android.permission.READ_PHONE_STATE", parseJSONObjectFromString);
            requestPermissionOriginal(parseJSONObjectFromString.toString());
        }
    }

    @Keep
    @JavascriptInterface
    public void requestPermissionOriginal(String str) {
        JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
        String string = JSONUtils.getString("permissions", parseJSONObjectFromString);
        final String[] strArr = {string};
        if (string.contains(",")) {
            strArr = string.split(",");
        }
        final String string2 = JSONUtils.getString("callbackFuncName", parseJSONObjectFromString);
        if (TextUtils.isEmpty(string) || TextUtils.isEmpty(string2)) {
            return;
        }
        if (JSONUtils.getBoolean("ignoreLogin", parseJSONObjectFromString)) {
            RunHelper.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    AndroidJsInterface.this.d(strArr, string2);
                }
            });
        } else {
            UserCenterManager.login(this.mContext, new OnCommonCallBack() {
                @Override
                public void onResult(int i, Bundle bundle) {
                    if (i == 0) {
                        RunHelper.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                AndroidJsInterface.this.d(strArr, string2);
                            }
                        });
                        return;
                    }
                    ap.a aVar = new ap.a();
                    aVar.put("code", 4);
                    aVar.put("msg", "must login first");
                    AndroidJsInterface.this.invoke(string2, aVar.toString());
                }
            });
        }
    }

    public void d(String[] strArr, final String str) {
        Activity activity = com.m4399.gamecenter.plugin.main.utils.a.getActivity(this.mContext);
        if (activity == null || strArr == null || strArr.length == 0 || TextUtils.isEmpty(str)) {
            return;
        }
        a.b bVar = new a.b() {
            @Override
            public void onSuccess() {
                ap.a aVar = new ap.a();
                aVar.put("code", 1);
                AndroidJsInterface.this.invoke(str, aVar.get().toString());
            }

            @Override
            public void onAutoRefused() {
                ap.a aVar = new ap.a();
                aVar.put("code", 3);
                aVar.put("msg", "auto refuse");
                AndroidJsInterface.this.invoke(str, aVar.get().toString());
            }

            @Override
            public void onManualRefused() {
                ap.a aVar = new ap.a();
                aVar.put("code", 2);
                aVar.put("msg", "manual refuse");
                AndroidJsInterface.this.invoke(str, aVar.get().toString());
            }
        };
        if (com.m4399.gamecenter.plugin.main.manager.permission.a.isPermissions(activity, strArr)) {
            bVar.onSuccess();
        } else {
            com.m4399.gamecenter.plugin.main.manager.permission.a.getInstance().requestPermisions(activity, strArr, bVar);
        }
    }
}