360手机助手 v5.2.50版本的 MD5 值为:087c008db9e518cd556c792742e6830c

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


package com.qihoo.appstore.webview;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import com.qihoo.appstore.R;
import com.qihoo.appstore.appgroup.talent.a.TalentBaseFragment;
import com.qihoo.appstore.appgroup.talent.a.TalentDetailActivity;
import com.qihoo.appstore.appgroup.topic.TopicAppDetailActivity;
import com.qihoo.appstore.appgroup.topic.TopicDetailActivity;
import com.qihoo.appstore.appinfopage.AppInfoActivity;
import com.qihoo.appstore.appinfopage.apppackage.AppInfoPlayVideoActivity;
import com.qihoo.appstore.base.BaseFragmentActivity;
import com.qihoo.appstore.base.BaseViewPager;
import com.qihoo.appstore.category.CategoryData;
import com.qihoo.appstore.common.CommonResultFeedBackActivity;
import com.qihoo.appstore.feedback.FeedbackNewActivity;
import com.qihoo.appstore.home.MainActivity;
import com.qihoo.appstore.hometips.LegoPreferenceActivity;
import com.qihoo.appstore.hongbao.HongBaoRemind;
import com.qihoo.appstore.hongbao.HongBaoShortCutService;
import com.qihoo.appstore.install.InstallManager;
import com.qihoo.appstore.install.InstallNotificationManager;
import com.qihoo.appstore.news.QihooNewsActivity;
import com.qihoo.appstore.personalcenter.UserinfoEditActivity;
import com.qihoo.appstore.personalcenter.personalpage.activity.DarenPersonalPageActivity;
import com.qihoo.appstore.personalcenter.personalpage.activity.PersonalPageActivity;
import com.qihoo.appstore.personalcenter.personalpage.data.User;
import com.qihoo.appstore.rank.RankMutiTabActivity;
import com.qihoo.appstore.rootcommand.utils.InstallUtils;
import com.qihoo.appstore.search.SearchActivity;
import com.qihoo.appstore.shake.ShakeActivity;
import com.qihoo.appstore.skinselect.SkinSelectActivity;
import com.qihoo.appstore.specialtopic.SpecialTopicActivity;
import com.qihoo.appstore.stat.StatHelper;
import com.qihoo.appstore.utils.ApplicationConfig;
import com.qihoo.download.base.QHDownloadResInfo;
import com.qihoo.productdatainfo.base.ApkResInfo;
import com.qihoo.productdatainfo.base.BaseResInfo;
import com.qihoo.productdatainfo.base.StartBookInfo;
import com.qihoo.utils.AndroidUtilsCompat;
import com.qihoo.utils.bn;
import com.qihoo.utils.cr;
import com.qihoo.utils.cu;
import com.qihoo.utils.de;
import com.tencent.open.SocialConstants;
import com.tencent.tauth.AuthActivity;
import java.io.File;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class JavascriptInterface {
    private static final int INSTALL_RECEIVER_CLOSE = 0;
    private static final int INSTALL_RECEIVER_OPEN = 1;
    private static final String TAG = "JavascriptInterface";
    public boolean hasBackKeyDownListenner;
    public boolean hasResumePauseLinner;
    private long lastOpenBookTime;
    private BroadcastReceiver mBroadcastReceiver;
    private Context mContext;
    public String mLockScreenData;
    private com.qihoo.appstore.share.ai mMonitor;
    private AppStoreWebView mWebView;
    private String pageIdNative;
    private String prePageIdNative;
    private String prePageLabelNative;
    public boolean hasInstallReceiver = false;
    private Queue mAsyncTasks = new ConcurrentLinkedQueue();
    private ag mInstallreceiver = new ag(this, null);

    public JavascriptInterface(Context context, AppStoreWebView appStoreWebView) {
        this.mContext = context;
        this.mWebView = appStoreWebView;
    }

    public void setSimpleShareRusultMonitor(com.qihoo.appstore.share.ai aiVar) {
        this.mMonitor = aiVar;
    }

    public void setScrollbackEnable(boolean z) {
        if (this.mContext instanceof BaseFragmentActivity) {
            ((BaseFragmentActivity) this.mContext).e(z);
        }
    }

    public void setBannerOnTouch(int i) {
        try {
            BaseViewPager.a = i != 1;
            setScrollbackEnable(i != 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setToolbarRightBtn(String str) {
        bn.b(TAG, "setToolbarRightBtn " + str);
        if (this.mContext != null && (this.mContext instanceof WebViewActivity)) {
            ((WebViewActivity) this.mContext).e(str);
        }
    }

    public boolean interceptClose(int i) {
        if (i == 1 && !com.qihoo.appstore.hometips.e.b() && !com.qihoo.appstore.hometips.e.c()) {
            com.qihoo.appstore.hometips.e.f().a(this.mContext, new r(this));
            return true;
        }
        close();
        return false;
    }

    public void close() {
        if (this.mContext instanceof Activity) {
            if (this.mContext instanceof MainActivity) {
                ((MainActivity) this.mContext).onBackPressed();
            } else {
                ((Activity) this.mContext).finish();
            }
        }
    }

    public void closeHalfPage() {
        close();
    }

    public void setOnBackKeyDownListenner(int i) {
        this.hasBackKeyDownListenner = i != 0;
    }

    public void clear() {
        Iterator it = this.mAsyncTasks.iterator();
        while (it.hasNext()) {
            ((AsyncTask) it.next()).cancel(true);
            it.remove();
        }
        removeDownloadListenner();
        if (this.hasInstallReceiver) {
            setInstallReceiver(0);
        }
        this.mWebView = null;
        this.mContext = null;
        this.mMonitor = null;
    }

    public void addDownloadListenner() {
        if (this.mWebView != null) {
            com.qihoo.downloadservice.h.d.a(this.mWebView);
        }
        IntentFilter intentFilter = new IntentFilter("appstore_delete_download_pkg");
        if (this.mBroadcastReceiver == null) {
            this.mBroadcastReceiver = new w(this);
        }
        android.support.v4.content.g.a(this.mContext.getApplicationContext()).a(this.mBroadcastReceiver, intentFilter);
    }

    public void removeDownloadListenner() {
        if (this.mWebView != null) {
            com.qihoo.downloadservice.h.d.b(this.mWebView);
        }
        android.support.v4.content.g.a(this.mContext.getApplicationContext()).a(this.mBroadcastReceiver);
        this.mBroadcastReceiver = null;
    }

    public void setInstallReceiver(int i) {
        this.hasInstallReceiver = i == 1;
        if (this.hasInstallReceiver) {
            this.mInstallreceiver.a(this.mContext.getApplicationContext());
        } else {
            this.mInstallreceiver.b(this.mContext.getApplicationContext());
        }
    }

    public void setResumePauseLinnersenr(int i) {
        this.hasResumePauseLinner = i != 0;
    }

    public String getClientInfo() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("version", com.qihoo.productdatainfo.b.b.a(5));
            jSONObject.put("pkgName", this.mContext.getPackageName());
            if (isCurrent360Url()) {
                jSONObject.put("imei", com.qihoo.productdatainfo.b.b.a(2));
                jSONObject.put("m", com.qihoo.productdatainfo.b.b.a(2));
                jSONObject.put("m2", com.qihoo.productdatainfo.b.b.a(3));
            }
            jSONObject.put("os", Build.VERSION.SDK_INT);
            jSONObject.put("netType", com.qihoo.utils.net.f.b());
            jSONObject.put("toid", ApplicationConfig.getInstance().getToID());
            jSONObject.put("soVersion", com.qihoo.appstore.utils.f.a(this.mContext));
            jSONObject.put("channel", com.qihoo.productdatainfo.b.b.a(7));
            jSONObject.put("supportSilentPush", true);
            jSONObject.put("ui_version", com.qihoo.appstore.widget.support.b.g);
            jSONObject.put("ui_nmode", com.qihoo.appstore.widget.support.b.b() ? 0 : 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jSONObject.toString();
    }

    public String getKeyFromSalt(String str) {
        return isCurrent360Url() ? com.qihoo.appstore.utils.f.a(this.mContext, str, com.qihoo.productdatainfo.b.b.a(3)) : "forbidden";
    }

    public int getEncrySoVersion() {
        if (isCurrent360Url()) {
            return com.qihoo.appstore.utils.f.a(this.mContext);
        }
        return -2;
    }

    public void openPage(String str) {
        bn.b(TAG, "openPage :" + str);
        if (str.startsWith("http://openbox.mobilem.360.cn/feedback2/")) {
            openPage2(str);
        } else {
            openPage1(str, -1);
        }
    }

    public void openPageWithCookie(String str, int i) {
        openPage1(str, i);
    }

    public void openPage1(String str, int i) {
        Intent intent = new Intent(this.mContext, (Class<?>) aw.a(str));
        intent.putExtra(SocialConstants.PARAM_URL, str);
        startCustomActivity(intent);
    }

    public void openPage2(String str) {
        Intent intent = new Intent(this.mContext, (Class<?>) FeedbackNewActivity.class);
        intent.putExtra(SocialConstants.PARAM_URL, str);
        startCustomActivity(intent);
    }

    public void openWebPage(String str) {
        bn.b(TAG, "openWebPage " + str);
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString(SocialConstants.PARAM_URL);
            String optString2 = jSONObject.optString("pageId");
            Intent intent = new Intent(this.mContext, (Class<?>) aw.a(optString));
            intent.putExtra(SocialConstants.PARAM_URL, optString);
            intent.putExtra("KEY_PAGE_ID", optString2);
            startCustomActivity(intent);
        } catch (Exception e) {
        }
    }

    public void goAppInfo(String str, int i) {
        AppInfoActivity.a(this.mContext, str, i == 1);
    }

    public boolean gotoPage(String str) {
        JSONObject jSONObject;
        String optString;
        if (str == null) {
            return false;
        }
        try {
            jSONObject = new JSONObject(str);
            optString = jSONObject.optString("page");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if ("detail".equals(optString)) {
            ApkResInfo apkResInfo = new ApkResInfo();
            apkResInfo.a(jSONObject);
            apkResInfo.aO = jSONObject.optString("soft_id");
            AppInfoActivity.a(this.mContext, apkResInfo);
            return true;
        }
        if ("category_list".equals(optString)) {
            String optString2 = jSONObject.optString("realtag");
            if (TextUtils.isEmpty(optString2)) {
                optString2 = jSONObject.optString("tag2");
            }
            CategoryData.JumpPageInfo jumpPageInfo = new CategoryData.JumpPageInfo();
            jumpPageInfo.a = jSONObject.optString(SocialConstants.PARAM_URL);
            jumpPageInfo.b = jSONObject.optString("name");
            jumpPageInfo.c = jSONObject.optString("tag");
            jumpPageInfo.d = optString2;
            jumpPageInfo.e = jSONObject.optString("cid");
            jumpPageInfo.f = jumpPageInfo.b;
            jumpPageInfo.g = jumpPageInfo.d;
            com.qihoo.appstore.recommend.autotitle.k.a(this.mContext, jumpPageInfo);
            return true;
        }
        if ("topic".equals(optString)) {
            Intent intent = new Intent(this.mContext, (Class<?>) SpecialTopicActivity.class);
            intent.putExtra(InstallNotificationManager.KEY_FROM, 1);
            startCustomActivity(intent);
            return true;
        }
        if ("home".equals(optString)) {
            String optString3 = jSONObject.optString("tab1", "newBest");
            jSONObject.optString("tab2", "new");
            if (!"newBest".equals(optString3) && !"soft".equals(optString3) && !"game".equals(optString3) && "download".equals(optString3)) {
            }
            startCustomActivity(new Intent(this.mContext, (Class<?>) MainActivity.class));
            return true;
        }
        if ("search".equals(optString)) {
            String optString4 = jSONObject.optString("kw");
            jSONObject.optString("input");
            jSONObject.optString("switchTag");
            jSONObject.optString("statParams");
            Intent intent2 = new Intent(this.mContext, (Class<?>) SearchActivity.class);
            intent2.putExtra("keyword", optString4);
            intent2.putExtra("statPageId", "webview");
            startCustomActivity(intent2);
            return true;
        }
        if ("tagdetail".equals(optString)) {
            return false;
        }
        if ("find_topic".equals(optString)) {
            String optString5 = jSONObject.optString("id");
            String optString6 = jSONObject.optString("callback");
            Intent intent3 = new Intent(this.mContext, (Class<?>) TopicDetailActivity.class);
            intent3.putExtra("topic_id", optString5);
            intent3.putExtra("callback", optString6);
            intent3.putExtra("KEY_PAGE_ID", "topic");
            intent3.putExtra("KEY_PAGE_LABEL", optString5);
            startCustomActivity(intent3);
            return true;
        }
        if ("topic_detail".equals(optString)) {
            String optString7 = jSONObject.optString("recomm_id");
            Intent intent4 = new Intent(this.mContext, (Class<?>) TopicAppDetailActivity.class);
            intent4.putExtra("recommend_id", optString7);
            startCustomActivity(intent4);
            return true;
        }
        if ("appgroupdetail".equals(optString)) {
            String optString8 = jSONObject.optString("id");
            int optInt = jSONObject.optInt("show_cmmt");
            String optString9 = jSONObject.optString("pageId");
            int optInt2 = jSONObject.optInt(SocialConstants.PARAM_TYPE);
            String optString10 = jSONObject.optString("title");
            Intent intent5 = new Intent(this.mContext, (Class<?>) TalentDetailActivity.class);
            intent5.putExtra("detail_id", optString8);
            intent5.putExtra("show_cmmt", optInt == 1);
            intent5.putExtra("KEY_PAGE_ID", optString9);
            intent5.putExtra("show_type", optInt2);
            if (!TextUtils.isEmpty(optString10)) {
                intent5.putExtra("title", optString10);
                intent5.putExtra("KEY_SHOW_TITLE", true);
            }
            startCustomActivity(intent5);
            return true;
        }
        if ("appGroup_main".equals(optString)) {
            return false;
        }
        if ("ShengHuoZhuShou".equals(optString)) {
            com.qihoo.appstore.recommend.autotitle.k.a(null, "@shenghuozs", null, this.mContext.getString(R.string.life_title), null, jSONObject.optString("fm"), this.mContext);
            return true;
        }
        if ("wallet".equals(optString)) {
            com.qihoo.appstore.personalcenter.d.a.a((Activity) this.mContext);
            return true;
        }
        if ("theme".equals(optString)) {
            startCustomActivity(new Intent(this.mContext, (Class<?>) SkinSelectActivity.class));
            return true;
        }
        if ("tfboys_setting".equals(optString)) {
            startCustomActivity(new Intent(this.mContext, (Class<?>) LegoPreferenceActivity.class));
            return true;
        }
        if ("user_info".equals(optString)) {
            startCustomActivity(new Intent(this.mContext, (Class<?>) UserinfoEditActivity.class));
            return true;
        }
        if ("hongbao".equals(optString)) {
            if (this.mContext instanceof Activity) {
                Intent intent6 = new Intent();
                intent6.setClassName("com.qihoo.notification", "com.qihoo.notification.MainActivity");
                com.qihoo.k.z.a((Activity) this.mContext, "com.qihoo.notification", intent6, this);
            }
            return true;
        }
        if ("softtable".equals(optString)) {
            String optString11 = jSONObject.optString("switchTab");
            Intent intent7 = new Intent(this.mContext, (Class<?>) RankMutiTabActivity.class);
            intent7.putExtra(SocialConstants.PARAM_URL, com.qihoo.productdatainfo.b.c.t());
            intent7.putExtra("title", this.mContext.getString(R.string.rank_soft));
            intent7.putExtra("rank_type", 2);
            intent7.putExtra("category_type", optString11);
            intent7.setFlags(536870912);
            startCustomActivity(intent7);
        } else if ("shake".equals(optString)) {
            Intent intent8 = new Intent(this.mContext, (Class<?>) ShakeActivity.class);
            intent8.putExtra("stat", "shakeweb");
            startCustomActivity(intent8);
        } else if ("soft_category_group".equals(optString)) {
            JSONObject optJSONObject = jSONObject.optJSONObject("extra");
            CategoryData.JumpPageInfo jumpPageInfo2 = new CategoryData.JumpPageInfo();
            jumpPageInfo2.b = optJSONObject.optString("title");
            jumpPageInfo2.c = optJSONObject.optString("tag");
            jumpPageInfo2.d = null;
            jumpPageInfo2.e = optJSONObject.optString("cid");
            jumpPageInfo2.f = jumpPageInfo2.b;
            jumpPageInfo2.g = "全部";
            JSONArray optJSONArray = optJSONObject.optJSONArray("title2");
            JSONArray optJSONArray2 = optJSONObject.optJSONArray("tag2");
            if (optJSONArray != null && optJSONArray2 != null) {
                jumpPageInfo2.h = new ArrayList();
                jumpPageInfo2.i = new ArrayList();
                int min = Math.min(optJSONArray.length(), optJSONArray2.length());
                for (int i = 0; i < min; i++) {
                    jumpPageInfo2.h.add(optJSONArray.optString(i));
                    jumpPageInfo2.i.add(optJSONArray2.optString(i));
                }
            }
            com.qihoo.appstore.recommend.autotitle.k.a(this.mContext, jumpPageInfo2);
        }
        return false;
    }

    public void openCPBook(String str) {
        if (System.currentTimeMillis() - this.lastOpenBookTime > 2000) {
            com.qihoo.appstore.book.b.a((Activity) this.mContext, new StartBookInfo(str), this.mContext);
        }
    }

    public void downloadFile(String str) {
        try {
            downloadFile(new JSONObject(str));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void downloadPic(String str, String str2) {
        if (isCurrent360Url()) {
            new com.qihoo.utils.thread.f("JavascriptInterface-downIcons").newThread(new x(this, str, str2)).start();
        }
    }

    private void downloadFile(JSONObject jSONObject) {
        int optInt = jSONObject.optInt("resType");
        String optString = jSONObject.optString("toast");
        if (optInt == 8) {
            com.qihoo.downloadservice.h.a.a(jSONObject.optString(SocialConstants.PARAM_URL), jSONObject.optString("logoUrl"), jSONObject.optString("resName"), jSONObject.optInt("notVisible"), this.pageIdNative);
        } else {
            BaseResInfo a = com.qihoo.j.b.a(optInt);
            a.a(jSONObject);
            QHDownloadResInfo a2 = com.qihoo.downloadservice.h.b.a(a.a());
            if (a2 == null) {
                QHDownloadResInfo a3 = com.qihoo.downloadservice.h.b.a(a, StatHelper.a(this.pageIdNative, this.prePageIdNative, "", this.prePageLabelNative, "", a.aO));
                a3.S = jSONObject.optInt("notVisible");
                com.qihoo.downloadservice.h.a.a(a3);
            } else if (a2.a == 193 || com.qihoo.download.base.a.i(a2.a)) {
                com.qihoo.downloadservice.h.a.a(a2);
            }
        }
        if (!TextUtils.isEmpty(optString)) {
            de.a(this.mContext, optString);
        } else {
            de.a(this.mContext, R.string.start_download_file);
        }
    }

    public void downloadApp(String str) {
        try {
            downloadApp(new JSONObject(str));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void downloadApps(String str) {
        try {
            JSONArray jSONArray = new JSONArray(str);
            int i = 0;
            while (true) {
                int i2 = i;
                if (i2 < jSONArray.length()) {
                    downloadApp((JSONObject) jSONArray.opt(i2));
                    i = i2 + 1;
                } else {
                    return;
                }
            }
        } catch (JSONException e) {
            if (bn.c()) {
                e.printStackTrace();
            }
        }
    }

    public boolean cancleAppDownload(String str) {
        if (str == null || str.isEmpty()) {
            return false;
        }
        QHDownloadResInfo b = com.qihoo.downloadservice.h.b.b(str);
        if (b != null) {
            com.qihoo.downloadservice.h.a.c(b);
        }
        return true;
    }

    public void pauseDownloadApp(String str) {
        QHDownloadResInfo b;
        if (str != null && !str.isEmpty() && (b = com.qihoo.downloadservice.h.b.b(str)) != null) {
            com.qihoo.downloadservice.h.a.b(b);
        }
    }

    private void downloadApp(JSONObject jSONObject) {
        if (jSONObject != null) {
            ApkResInfo apkResInfo = new ApkResInfo();
            apkResInfo.a(jSONObject);
            bn.a(!TextUtils.isEmpty(apkResInfo.w), "downloadApp: " + (this.mWebView == null ? null : this.mWebView.getUrl()) + " " + jSONObject.toString());
            apkResInfo.aO = jSONObject.optString("soft_id");
            if (apkResInfo.aV == null || apkResInfo.aV.equals("")) {
                apkResInfo.aV = jSONObject.optString("download_url");
            }
            apkResInfo.w = jSONObject.optString("version_code");
            apkResInfo.be = jSONObject.optLong("size");
            apkResInfo.y = jSONObject.optString("signature_md5");
            apkResInfo.bg = jSONObject.optString("apk_md5");
            apkResInfo.az = jSONObject.optInt("no_gift", 1);
            apkResInfo.aJ = false;
            String optString = jSONObject.optString("pageId", this.pageIdNative);
            String optString2 = jSONObject.optString("prePageId", this.prePageIdNative);
            String optString3 = jSONObject.optString("pageLabel", "");
            String optString4 = jSONObject.optString("prePageLabel", this.prePageLabelNative);
            String optString5 = jSONObject.optString("list_pos", "");
            String optString6 = jSONObject.optString("wifiAutoDownload");
            int optInt = jSONObject.optInt("autoInstall", -1);
            QHDownloadResInfo a = com.qihoo.downloadservice.h.b.a(apkResInfo.a());
            if (a == null) {
                QHDownloadResInfo a2 = com.qihoo.downloadservice.h.b.a(apkResInfo, StatHelper.a(optString, optString2, optString3, optString4, optString5, apkResInfo.aO));
                a2.a(optString, optString2, com.qihoo.utils.af.b(optString5), "", optString3);
                if (!TextUtils.isEmpty(optString6)) {
                    a2.j(optString6);
                }
                a2.O = optInt;
                com.qihoo.downloadservice.h.a.a(a2);
                return;
            }
            if (a.a == 193 || com.qihoo.download.base.a.i(a.a)) {
                if (!TextUtils.isEmpty(optString6)) {
                    a.j(optString6);
                }
                a.O = optInt;
                com.qihoo.downloadservice.h.a.a(a);
            }
        }
    }

    public boolean launchApp(String str) {
        PackageManager packageManager = this.mContext.getPackageManager();
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("apkid");
            Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(optString);
            String optString2 = jSONObject.optString("app_url");
            if (!TextUtils.isEmpty(optString2)) {
                launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(optString2));
                launchIntentForPackage.setFlags(268435456);
            }
            String optString3 = jSONObject.optString("componentInfo");
            if (!TextUtils.isEmpty(optString3)) {
                launchIntentForPackage = new Intent();
                launchIntentForPackage.setComponent(new ComponentName(optString3.split("/")[0], optString3.split("/")[1]));
            }
            if (launchIntentForPackage != null) {
                if ("com.qihoo.lockscreenad".equals(optString)) {
                    launchIntentForPackage.putExtra("iskill", false);
                    com.qihoo.k.b.a.a(launchIntentForPackage);
                }
                startCustomActivity(launchIntentForPackage);
                return true;
            }
        } catch (JSONException e) {
            if (bn.c()) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public void launcheWukongtv(String str) {
        try {
            if (com.qihoo.appstore.r.k.a().a(this.mContext, "com.wukongtv.wukongtv")) {
                String optString = new JSONObject(str).optString("roomid");
                Intent intent = new Intent("android.intent.action.MAIN");
                intent.addCategory("android.intent.category.LAUNCHER");
                intent.setComponent(new ComponentName("com.wukongtv.wukongtv", "com.wukongtv.wukongtv.splash.SplashAcitity"));
                intent.putExtra("jumpPakage", "com.wukongtv.wukongtv");
                intent.putExtra("jump", "com.wukongtv.wukongtv.video.WKVideoActivity");
                intent.putExtra("roomid", optString);
                startCustomActivity(intent);
            } else {
                downloadApp(str);
            }
        } catch (JSONException e) {
            bn.c(TAG, "launcheWukongtv error", e);
        }
    }

    public void getInstallApp(String str) {
        this.mAsyncTasks.add(new aa(this, str).execute(new Void[0]));
    }

    public void getInstatllApp(String str) {
        getInstallApp(str);
    }

    public void getAppStatus(String str, String str2) {
        StringBuilder sb = new StringBuilder("{");
        try {
            JSONArray jSONArray = new JSONArray(str);
            for (int i = 0; i < jSONArray.length(); i++) {
                if (sb.length() > 1) {
                    sb.append(",");
                }
                JSONObject jSONObject = (JSONObject) jSONArray.opt(i);
                String optString = jSONObject.optString("pkgName");
                sb.append("\"").append(optString).append("\":{\"status\":\"").append(com.qihoo.appstore.r.k.a().a(this.mContext.getApplicationContext(), optString) ? com.qihoo.appstore.appupdate.y.a().a(optString, String.valueOf(jSONObject.optInt("version", 0))) ? 2 : 1 : 0);
                sb.append("\"}");
            }
            sb.append("}");
            String str3 = str2 + "('" + sb.toString() + "')";
            if (this.mWebView != null) {
                this.mWebView.e(str3);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public int getApkVersionCode() {
        try {
            return this.mContext.getApplicationContext().getPackageManager().getPackageInfo(this.mContext.getApplicationContext().getPackageName(), 16384).versionCode;
        } catch (Exception e) {
            return -1;
        }
    }

    public void openUrlByWebBrowse(String str) {
        try {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.parse(str));
            intent.setFlags(268435456);
            startCustomActivity(intent);
        } catch (Exception e) {
        }
    }

    public String getLocalThirdAppList() {
        return queryAppList(com.qihoo.appstore.r.k.a().d());
    }

    public String getSystemAppList() {
        return queryAppList(com.qihoo.appstore.r.k.a().e());
    }

    private String queryAppList(List list) {
        try {
            JSONArray jSONArray = new JSONArray();
            if (list != null && list.size() > 0) {
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    com.qihoo.productdatainfo.base.n nVar = (com.qihoo.productdatainfo.base.n) it.next();
                    if (nVar.l != null && !TextUtils.equals(nVar.l.packageName, this.mContext.getPackageName())) {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("name", nVar.l.applicationInfo.loadLabel(this.mContext.getPackageManager()));
                        jSONObject.put("packagename", nVar.l.packageName);
                        jSONObject.put("versioncode", nVar.l.versionCode);
                        jSONObject.put("versionname", nVar.l.versionName);
                        if (!TextUtils.isEmpty(nVar.h)) {
                            jSONObject.put("signatures", nVar.h);
                        }
                        jSONArray.put(jSONObject);
                    }
                }
            }
            return jSONArray.toString();
        } catch (Throwable th) {
            return "[]";
        }
    }

    public int installAppFormFile(String str) {
        File file = new File(str);
        if (!file.exists()) {
            return -1;
        }
        try {
            Intent intent = new Intent();
            intent.addFlags(268435456);
            intent.setAction("android.intent.action.VIEW");
            intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
            startCustomActivity(intent);
            return 1;
        } catch (Exception e) {
            return -2;
        }
    }

    public void installAppFormId(String str) {
        QHDownloadResInfo b;
        if (str != null && !str.isEmpty() && isCurrent360Url() && (b = com.qihoo.downloadservice.h.b.b(str)) != null) {
            InstallManager.getInstance().forceInstall(b);
        }
    }

    public static String getDownloadApp() {
        Map d = com.qihoo.downloadservice.h.b.d();
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        Iterator it = d.entrySet().iterator();
        while (it.hasNext()) {
            QHDownloadResInfo qHDownloadResInfo = (QHDownloadResInfo) ((Map.Entry) it.next()).getValue();
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("id", qHDownloadResInfo.ad);
                jSONObject.put("pkgName", qHDownloadResInfo.ad);
                jSONObject.put("status", qHDownloadResInfo.a);
                jSONObject.put("versionCode", qHDownloadResInfo.ah);
                jSONObject.put("downPath", qHDownloadResInfo.r);
                sb.append(jSONObject.toString());
            } catch (Exception e) {
                if (bn.c()) {
                    e.printStackTrace();
                }
            }
            sb.append(",");
        }
        if (sb.length() > 2) {
            sb.deleteCharAt(sb.length() - 1);
        }
        sb.append("]");
        return sb.toString();
    }

    public boolean saveData(String str, String str2) {
        com.qihoo.storager.e.a(this.mContext, "webview_data", 0).edit().putString(str, str2).apply();
        return true;
    }

    public String getData(String str, String str2) {
        SharedPreferences a = com.qihoo.storager.e.a(this.mContext, "webview_data", 0);
        if (a.contains(str)) {
            return a.getString(str, str2);
        }
        if ("hb_p2p".equals(str)) {
            String e = com.qihoo.utils.ac.e(this.mContext);
            cu.a(a.edit().putString("hb_p2p", e));
            return e;
        }
        return str2;
    }

    public void showNoNetworkTip() {
        de.a(this.mContext, "当前没有可用网络,请检查您的网络设置");
    }

    public void shareToSNS(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            cr crVar = new cr(jSONObject.optString("content"), jSONObject.optString("imgUrl"));
            com.qihoo.appstore.share.c a = com.qihoo.appstore.share.a.a(crVar.a(), crVar.b());
            a.c(crVar.a());
            com.qihoo.appstore.share.s sVar = new com.qihoo.appstore.share.s((Activity) this.mContext, a.a(), false, this.mMonitor);
            if (!sVar.isShowing()) {
                sVar.show();
            }
        } catch (Exception e) {
            if (bn.c()) {
                e.printStackTrace();
            }
        }
    }

    public void setNativePageId(String str, String str2, String str3) {
        this.pageIdNative = str;
        this.prePageIdNative = str2;
        this.prePageLabelNative = str3;
    }

    private void startCustomActivity(Intent intent) {
        if (intent != null && this.mContext != null && (this.mContext instanceof Activity)) {
            this.mContext.startActivity(intent);
        }
    }

    public void showReplyForAppGroup(String str, String str2, String str3) {
        if (this.mContext instanceof TalentDetailActivity) {
            ((TalentDetailActivity) this.mContext).a(str, str2, str3);
        }
    }

    public void showTopicReplyDialog(String str, String str2) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            jSONObject.optString("username");
            jSONObject.optString("userpic");
            String optString = jSONObject.optString("hint");
            if (this.mContext instanceof TopicDetailActivity) {
                ((TopicDetailActivity) this.mContext).a(str2, optString);
            } else if (this.mContext instanceof TopicAppDetailActivity) {
                ((TopicAppDetailActivity) this.mContext).a(str2, optString);
            }
        } catch (Exception e) {
            bn.a(TAG, "showTopicReplyDialog error", e);
        }
    }

    public void hideTopicReplyLayout() {
        if (this.mContext instanceof TopicDetailActivity) {
            ((TopicDetailActivity) this.mContext).c();
        }
    }

    public void showLoginDialogForTopic(String str, String str2) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            jSONObject.optString("username");
            jSONObject.optString("userpic");
            jSONObject.optString("title");
            if (this.mContext instanceof TopicDetailActivity) {
                ((TopicDetailActivity) this.mContext).a(str2);
            }
        } catch (Exception e) {
            bn.c(TAG, "showLoginDialogForTopic failed. userinfo = " + str + ", callback = " + str2, e);
        }
    }

    public void hideCommentDialogForDiscover() {
        if (this.mContext instanceof TalentDetailActivity) {
            ((TalentDetailActivity) this.mContext).e();
        }
    }

    public void showAppGroupBlackDialog() {
        com.qihoo.appstore.appgroup.common.a.b.b(this.mContext);
    }

    private boolean isCurrent360Url() {
        if (this.mWebView != null) {
            return com.qihoo.productdatainfo.b.c.E(this.mWebView.getUrl());
        }
        return false;
    }

    public void goBack() {
        bn.b(TAG, "goBack :");
        if (this.mWebView != null && this.mWebView.canGoBack()) {
            this.mWebView.goBack();
        } else {
            close();
        }
    }

    public boolean hasLogin() {
        return com.qihoo360.accounts.a.x.a().e();
    }

    public void tryLogin(String str) {
        if (!com.qihoo360.accounts.a.x.a().e()) {
            com.qihoo360.accounts.a.x.a().a(this.mContext);
        }
    }

    public void tryLoginNew(String str) {
        if (!hasLogin() && !TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                jSONObject.optBoolean("isInput");
                jSONObject.optString("route");
                com.qihoo360.accounts.a.x.a().a(this.mContext);
            } catch (Exception e) {
                bn.c(TAG, "tryLoginNew error", e);
            }
        }
    }

    public void login(String str) {
        bn.b(TAG, "login appkey-->" + str);
        com.qihoo.appstore.LifeHelper.h.a().a(this.mContext, "innerWebView", str, new ab(this));
    }

    public void getUserInfo(String str) {
        com.qihoo.appstore.LifeHelper.h.a().a(this.mContext, str, new ac(this));
    }

    public String getCurrentUserInfo() {
        String str = "{}";
        if (com.qihoo360.accounts.a.x.a().e() && this.mWebView != null && isCurrent360Url()) {
            com.qihoo360.accounts.a.w d = com.qihoo360.accounts.a.x.a().d();
            JSONObject jSONObject = new JSONObject();
            try {
                String str2 = d.f;
                if (TextUtils.isEmpty(str2)) {
                    str2 = d.d;
                }
                if (TextUtils.isEmpty(str2)) {
                    str2 = d.a;
                }
                jSONObject.put("name", str2);
                jSONObject.put("avatar", d.h);
                jSONObject.put("isDefaltAvatar", d.g);
                jSONObject.put("qid", d.b);
                str = jSONObject.toString();
                bn.b(TAG, "getCurrentUserInfo-->" + str);
            } catch (JSONException e) {
            }
        }
        return str;
    }

    public void addPhoneNum() {
        com.qihoo.appstore.LifeHelper.h.a().b(this.mContext, "innerWebView", new ad(this));
    }

    public void getCurrentPosition(String str, String str2, JSONObject jSONObject) {
        com.qihoo.appstore.LifeHelper.h.a().a(this.mContext, jSONObject, new ae(this, str, str2));
    }

    public void openPaymentsPage(String str) {
        com.qihoo.appstore.LifeHelper.h.a().d(this.mContext, str, new af(this));
    }

    public void paymentByOrderInfo(String str) {
        com.qihoo.appstore.LifeHelper.h.a().e(this.mContext, str, new s(this));
    }

    public void pay(String str, String str2) {
        com.qihoo.appstore.LifeHelper.h.a().a(this.mContext, "innerWebView", str, str2, new t(this));
    }

    public void lifePay(String str, String str2) {
        com.qihoo.appstore.LifeHelper.h.a().b(this.mContext, "innerWebView", str, new u(this, str2));
    }

    public void showMessage(String str) {
        bn.b(TAG, "showMessage");
        de.a(this.mContext, str);
    }

    public void addOpenAppListener(String str) {
        if (this.mWebView != null) {
            this.mWebView.d(str);
        }
    }

    public void showAppGroupPraiseToast() {
        com.qihoo.appstore.appgroup.common.a.b.a(this.mContext);
    }

    public boolean supportStreamApp() {
        return true;
    }

    public boolean launchStreamApp(String str) {
        com.qihoo.appstore.plugin.c.a.a(this.mContext, str, (String) null);
        return true;
    }

    public boolean launchStreamApp(String str, String str2) {
        com.qihoo.appstore.plugin.c.a.a(this.mContext, str, str2);
        return true;
    }

    public boolean lunchStreamAppFromUrl(String str) {
        com.qihoo.appstore.plugin.c.a.a(this.mContext, str);
        return true;
    }

    public void gotoPersonalPageNew(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject != null) {
                gotoPersonalPage(jSONObject.optString("uid"), jSONObject.optString("username"), jSONObject.optString("avatar"), jSONObject.optInt("verify"));
            }
        } catch (Exception e) {
            bn.c(TAG, "gotoPersonalPageNew error", e);
        }
    }

    private void gotoPersonalPage(String str, String str2, String str3, int i) {
        Intent intent;
        User user = new User(str2, str, str3, i);
        if (i == 1 || i == 2) {
            intent = new Intent(this.mContext, (Class<?>) DarenPersonalPageActivity.class);
        } else {
            intent = new Intent(this.mContext, (Class<?>) PersonalPageActivity.class);
        }
        intent.putExtra("user", user);
        startCustomActivity(intent);
    }

    public void addCPBook(String str) {
        com.qihoo.appstore.book.b.a((Activity) this.mContext, new StartBookInfo(str), this.mContext);
    }

    public void simpleShareToSNS(String str) {
        bn.b(TAG, "simpleShareToSNS: " + str);
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString(InstallUtils.PM_INSTALL_PACKAGE_TO_DEFAULT);
            String optString2 = jSONObject.optString("weixin");
            String optString3 = jSONObject.optString("weixinUrl");
            String optString4 = jSONObject.optString("weixinThumbnailUrl");
            String optString5 = jSONObject.optString("weixinTitle");
            String optString6 = jSONObject.optString("wxTimeLinePic");
            String optString7 = jSONObject.optString("wxFriendPic");
            String optString8 = jSONObject.optString("weiboImg");
            boolean optBoolean = jSONObject.optBoolean("showSms", true);
            boolean optBoolean2 = jSONObject.optBoolean("showMore", true);
            boolean optBoolean3 = jSONObject.optBoolean("needMonitor", false);
            boolean optBoolean4 = jSONObject.optBoolean("showQQ", true);
            boolean optBoolean5 = jSONObject.optBoolean("showQQZone", true);
            boolean optBoolean6 = jSONObject.optBoolean("showSina", true);
            boolean optBoolean7 = jSONObject.optBoolean("showTimeLine", true);
            boolean optBoolean8 = jSONObject.optBoolean("showWxFriend", true);
            int optInt = jSONObject.optInt("sourceType", 0);
            if (TextUtils.isEmpty(optString2)) {
                optString2 = optString;
            }
            com.qihoo.appstore.share.c a = com.qihoo.appstore.share.a.a(optString);
            a.a(optBoolean2);
            if (optBoolean) {
                a.a(optString);
            }
            if (optBoolean6) {
                com.qihoo.appstore.share.h hVar = new com.qihoo.appstore.share.h();
                hVar.b = optString8;
                hVar.a = optString;
                a.a(hVar);
            }
            if (optBoolean8) {
                com.qihoo.appstore.share.f fVar = new com.qihoo.appstore.share.f();
                fVar.d = optString4;
                fVar.c = optString3;
                fVar.b = optString2;
                fVar.a = optString5;
                fVar.e = optString7;
                fVar.f = optInt;
                a.a(fVar);
            }
            if (optBoolean7) {
                com.qihoo.appstore.share.g gVar = new com.qihoo.appstore.share.g();
                gVar.d = optString4;
                gVar.c = optString3;
                gVar.b = optString2;
                gVar.a = optString5;
                gVar.e = optString6;
                gVar.f = optInt;
                a.a(gVar);
            }
            if (optBoolean4) {
                com.qihoo.appstore.share.d dVar = new com.qihoo.appstore.share.d();
                dVar.d = optString4;
                dVar.c = optString3;
                dVar.b = optString2;
                dVar.a = optString5;
                dVar.f = optInt;
                a.a(dVar);
            }
            if (optBoolean5) {
                com.qihoo.appstore.share.e eVar = new com.qihoo.appstore.share.e();
                eVar.d = optString4;
                eVar.c = optString3;
                eVar.b = optString2;
                eVar.a = optString5;
                eVar.e = optString6;
                eVar.f = optInt;
                a.a(eVar);
            }
            com.qihoo.appstore.share.s sVar = new com.qihoo.appstore.share.s((Activity) this.mContext, a.a(), optBoolean3, this.mMonitor);
            if (!sVar.isShowing()) {
                sVar.show();
            }
        } catch (Exception e) {
        }
    }

    public void copyToClipboard(String str) {
        if (Build.VERSION.SDK_INT >= 11) {
            ((ClipboardManager) this.mContext.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("label", str));
        } else {
            ((android.text.ClipboardManager) this.mContext.getSystemService("clipboard")).setText(str);
        }
    }

    public void showReport(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                new com.qihoo.appstore.appgroup.common.view.a(this.mContext).a(jSONObject.optString(SocialConstants.PARAM_TYPE), jSONObject.optString("tid"), jSONObject.optString("sub_tid"), jSONObject.optString("content"), jSONObject.optString("nickname"));
            } catch (Exception e) {
                bn.c(TAG, "showReport error", e);
            }
        }
    }

    public boolean checkIsEmulator() {
        return com.qihoo.utils.am.a(this.mContext);
    }

    public boolean isSupportFeature(String str) {
        return "wallet".equals(str);
    }

    public void checkUpdate() {
        FeedbackNewActivity.b(this.mContext);
    }

    public void submitFeedback(String str) {
        if (this.mContext != null) {
            if ((this.mContext instanceof FeedbackNewActivity) || (this.mContext instanceof CommonResultFeedBackActivity)) {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    String optString = jSONObject.optString("msg");
                    String optString2 = jSONObject.optString("contact");
                    String optString3 = jSONObject.optString("imageurl");
                    boolean equals = jSONObject.optString("senderrorreport").equals("1");
                    String optString4 = jSONObject.optString("category");
                    String optString5 = jSONObject.optString("selectCategory");
                    if (this.mContext instanceof FeedbackNewActivity) {
                        ((FeedbackNewActivity) this.mContext).a(optString, optString2, optString3, equals, optString4, optString5);
                    } else if (this.mContext instanceof CommonResultFeedBackActivity) {
                        ((CommonResultFeedBackActivity) this.mContext).a(optString, optString2, optString3, equals, optString4);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void showFeedBack() {
        openPage2("http://openbox.mobilem.360.cn/feedback2/");
    }

    public void shownewfeedback(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("id");
            jSONObject.optString("name");
            jSONObject.optString("category");
            if (!TextUtils.isEmpty(optString) && TextUtils.isDigitsOnly(optString)) {
                openPage2("http://openbox.mobilem.360.cn/feedback2/detail?showSearch=0&type=" + optString);
            } else {
                de.a(this.mContext, "反馈地址不存在");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void Video_toDetail(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            com.qihoo.appstore.search.module.video.b.a(jSONObject.optString("videoId"), jSONObject.optString("title"), jSONObject.optString("cat"), this.mContext);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public boolean isSupportPlayVideo() {
        return true;
    }

    public void onStat(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            StatHelper.a(jSONObject.optString("event_id"), jSONObject.optString(AuthActivity.ACTION_KEY), jSONObject.optString("label"), jSONObject.optString("refer"), jSONObject.optString("property"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void notifyClient(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                if ("checkin".equals(new JSONObject(str).optString(SocialConstants.PARAM_TYPE))) {
                    com.qihoo.appstore.personalcenter.c.a.b();
                    com.qihoo.appstore.personalcenter.c.a.a(this.mContext, com.qihoo360.accounts.a.x.a().d().b, (com.qihoo.appstore.personalcenter.c.c) null);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void createQuickLink(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                int optInt = jSONObject.optInt(SocialConstants.PARAM_TYPE);
                switch (optInt) {
                    case 1:
                    case 2:
                        String optString = jSONObject.optString(SocialConstants.PARAM_URL);
                        com.qihoo.appstore.utils.ad.a(this.mContext, jSONObject.optString("logo"), jSONObject.optString("name"), optString, optInt, (com.qihoo.appstore.utils.af) null);
                        break;
                    case 3:
                        HongBaoShortCutService.a(this.mContext);
                        break;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void addCalendarEvent(String str) {
        com.qihoo.appstore.utils.c.a(this.mContext, str);
    }

    public void deleteCalendarEvent(String str) {
        com.qihoo.appstore.utils.c.b(this.mContext, str);
    }

    public void startPlugin(String str) {
        String str2;
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                String optString = jSONObject.optString("pkgName");
                String optString2 = jSONObject.optString("compent");
                String optString3 = jSONObject.optString("intentUri");
                Intent intent = new Intent();
                if (!TextUtils.isEmpty(optString3)) {
                    try {
                        intent = Intent.parseUri(optString3, 1);
                        if (TextUtils.isEmpty(optString)) {
                            optString = intent.getComponent() != null ? intent.getComponent().getPackageName() : null;
                        }
                        str2 = optString;
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }
                    if (!TextUtils.isEmpty(optString2)) {
                        intent.setClassName(str2, optString2);
                    }
                    if (!(this.mContext instanceof Activity)) {
                        com.qihoo.k.z.a((Activity) this.mContext, str2, intent, this.mContext);
                        return;
                    }
                    return;
                }
                str2 = optString;
                if (!TextUtils.isEmpty(optString2)) {
                }
                if (!(this.mContext instanceof Activity)) {
                }
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
    }

    public void startPluginUNSAFE(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                String optString = new JSONObject(str).optString("intentUri");
                if (!TextUtils.isEmpty(optString)) {
                    try {
                        Intent parseUri = Intent.parseUri(optString, 4);
                        if (this.mContext instanceof Activity) {
                            String str2 = parseUri.getPackage();
                            com.qihoo.k.z.a((Activity) this.mContext, TextUtils.isEmpty(str2) ? parseUri.getComponent().getPackageName() : str2, parseUri, this.mContext);
                        }
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }
                }
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
    }

    public int getSkinType() {
        return com.qihoo.appstore.widget.support.b.a() ? 1 : 0;
    }

    public void startOutSideLink(String str, String str2, boolean z) {
        if (allowAccess()) {
            try {
                Intent intent = new Intent(str);
                if (!TextUtils.isEmpty(str2)) {
                    intent = new Intent(str, Uri.parse(str2));
                }
                if (z) {
                    intent.addFlags(268435456);
                }
                intent.putExtra("source_from", "360appstore");
                this.mContext.startActivity(intent);
            } catch (Exception e) {
            }
        }
    }

    private boolean allowAccess() {
        return com.qihoo.productdatainfo.b.c.D(this.mWebView.getUrl());
    }

    public static void gameUnionDeskOnWebClick(String str, String str2) {
        com.qihoo.appstore.plugin.gift.b.a(str, str2);
    }

    public static void gameUnionDeskGoToIndex() {
        com.qihoo.appstore.plugin.gift.b.a();
    }

    public static void gameUnionGoToGiftList(String str, String str2) {
        com.qihoo.appstore.plugin.gift.b.b(str, str2);
    }

    public static void gameUnionGoToGiftDetail(String str) {
        com.qihoo.appstore.plugin.gift.b.a(str);
    }

    public void updateAppGroupTags(String str) {
        bn.b(TAG, "Json:" + str);
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                jSONObject.optInt(SocialConstants.PARAM_TYPE);
                jSONObject.optString("id");
                TalentBaseFragment.d = true;
                TalentBaseFragment.e = "";
            } catch (JSONException e) {
                bn.c(TAG, "error", e);
            }
        }
    }

    public void experienceApp(String str) {
        if (isCurrent360Url()) {
            HongBaoRemind.a().a(this.mContext, str);
        }
    }

    public String getLockAdData() {
        return this.mLockScreenData;
    }

    public void setLockScreenAdData(String str) {
        com.qihoo.k.b.a.b(this.mContext, str);
    }

    public void startCocosGame(String str, String str2) {
        com.qihoo.appstore.cocosplay.c.a(this.mContext, str, str2);
    }

    public void reloadHijackPage() {
        this.mWebView.f();
    }

    public void playVideoByUrl(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("name");
            String optString2 = jSONObject.optString(SocialConstants.PARAM_URL);
            AppInfoPlayVideoActivity.a(this.mContext, optString, jSONObject.optInt("orientation"), optString2, false);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void playVideo(String str) {
        if (this.mContext instanceof WebVideoActivity) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                ((WebVideoActivity) this.mContext).a(jSONObject.optString("videoUrl"), jSONObject.optString("articleId"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void checkApps(String str) {
        if (isCurrent360Url()) {
            this.mAsyncTasks.add(new v(this, str).execute(new Void[0]));
        } else if (this.mWebView != null) {
            this.mWebView.e(str + "(" + ((Object) null) + ")");
        }
    }

    public void uninstallApp(String str) {
        PackageInfo b;
        if (!TextUtils.isEmpty(str) && isCurrent360Url() && (b = com.qihoo.utils.l.b(this.mContext, str)) != null) {
            InstallManager.getInstance().uninstall(this.mContext, b);
        }
    }

    public void startOutSideLinkByAssignName(String str, String str2, String str3, boolean z) {
        if (allowAccess()) {
            try {
                Intent intent = new Intent();
                intent.setClassName(str, str2);
                if (z) {
                    intent.addFlags(268435456);
                }
                intent.putExtra("source_from", "360appstore");
                intent.putExtra("params", str3);
                this.mContext.startActivity(intent);
            } catch (Exception e) {
            }
        }
    }

    public void openNewsDetails(String str, boolean z) {
        if (AndroidUtilsCompat.a()) {
            if (z) {
                try {
                    QihooNewsActivity.a(this.mContext, 8008, 1, "youlike");
                } catch (Exception e) {
                    return;
                }
            }
            com.qihoo.appstore.news.a.m.a(this.mContext, this.mContext.getPackageName(), str);
            StatHelper.b("news_sub_flow_detail", String.valueOf(8008), "1", "youlike");
        }
    }

    public void openNewsPortPage(String str, String str2) {
        if (AndroidUtilsCompat.a()) {
            Intent intent = new Intent(this.mContext, (Class<?>) QihooNewsActivity.class);
            Bundle bundle = new Bundle();
            if (!TextUtils.isEmpty(str)) {
                ArrayList arrayList = new ArrayList();
                arrayList.add(str);
                bundle.putString("extra_key_initial_template_list", com.qihoo360.newssdk.d.a.a.a(arrayList));
            }
            bundle.putString("extra_key_channel", str2);
            bundle.putInt("extra_key_refer_scene", 8008);
            bundle.putInt("extra_key_refer_subscene", 1);
            intent.putExtras(bundle);
            this.mContext.startActivity(intent);
            StatHelper.b("news_sub_flow", String.valueOf(8008), "1", "youlike");
        }
    }
}