TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.jsp;

import NS_MOBILE_FEEDS.e_attribute;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import com.sixgod.pluginsdk.common.Constants;
import com.tencent.biz.qrcode.util.QRUtils;
import com.tencent.biz.webviewplugin.Share;
import com.tencent.biz.widgets.XChooserActivity;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.activity.DirectForwardActivity;
import com.tencent.mobileqq.activity.ForwardRecentActivity;
import com.tencent.mobileqq.activity.aio.rebuild.PublicAccountChatPie;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.data.AccountDetail;
import com.tencent.mobileqq.forward.ForwardConstants;
import com.tencent.mobileqq.forward.ForwardPluginShareStructMsgOption;
import com.tencent.mobileqq.persistence.EntityManager;
import com.tencent.mobileqq.pluginsdk.BasePluginActivity;
import com.tencent.mobileqq.service.gamecenter.AppLaucherHelper;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.AbsStructMsg;
import com.tencent.mobileqq.structmsg.StructMsgFactory;
import com.tencent.mobileqq.utils.PackageUtil;
import com.tencent.mobileqq.webview.swift.JsBridgeListener;
import com.tencent.mobileqq.webview.swift.WebUiBaseInterface;
import com.tencent.mobileqq.webview.swift.WebViewPlugin;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserMiscHandler;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserShareMenuHandler;
import com.tencent.mobileqq.webviewplugin.WebUiUtils;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.open.agent.report.ReportCenter;
import com.tencent.open.agent.report.ReportDef;
import com.tencent.qphone.base.util.BaseApplication;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.tim.wxapi.WXShareHelper;
import cooperation.qzone.QZoneShareManager;
import cooperation.readinjoy.ReadInJoyHelper;
import java.util.ArrayList;
import java.util.HashMap;
import mqq.app.MobileQQ;
import oicq.wlogin_sdk.tools.util;
import org.json.JSONException;
import org.json.JSONObject;
public class QQApiPlugin extends WebViewPlugin {
    static final String A = "src_a_actionData";
    static final String B = "src_i_actionData";
    public static final String C = "editable";
    public static final String D = "policy";
    public static final String E = "isCreator";
    public static final String F = "singleLineTitle";
    public static final String G = "contentEdited";
    public static final String H = "isNewCreate";
    public static final String I = "groupCode";
    public static final String J = "domainId";
    public static final String K = "localPadId";
    public static final String L = "cover_url";
    public static final String M = "source_name";
    public static final String N = "article_id";
    public static final String O = "QQApi";
    public static final String P = "serviceID";
    public static final String Q = "FilterTIMFriends";
    protected static final String S = "shareMsg";
    public static final byte f90031a = 1;
    public static final String f24522a = "QQApi";
    static final byte f90032b = 2;
    public static final String f24523b = "title";
    public static final String f90033c = "type";
    public static final String d = "miniprogram_image_url";
    static final String e = "desc";
    static final String f = "share_url";
    static final String g = "shareUrl";
    static final String h = "image_url";
    static final String i = "imageUrl";
    static final String j = "shareElement";
    static final String k = "shareQQType";
    static final String l = "flash_url";
    static final String m = "callback";
    static final String n = "keepShareUrl";
    static final String o = "share_type";
    static final String p = "shareType";
    static final String q = "toUin";
    static final String r = "uinType";
    static final String s = "appid";
    static final String t = "back";
    static final String u = "report";
    static final String v = "sourceName";
    static final String w = "src_iconUrl";
    static final String x = "src_webActionUrl";
    static final String y = "src_action";
    static final String z = "src_actionData";
    public String R;
    public String T;
    Context f24524a;
    private WebUiUtils.QQBrowserBaseActivityInterface f24525a;
    private WebUiUtils.WebFeaturesInterface f24526a;
    private WebUiUtils.WebShareInterface f24527a;
    private WebUiUtils.WebShareReportInterface f24528a;
    private WebUiUtils.WebUiMethodInterface f24529a;
    public QQProgressDialog f24530a;
    public WXShareHelper.WXShareListener f24531a;

    public QQApiPlugin() {
        this.mPluginNameSpace = "QQApi";
    }

    @Override
    public void onCreate() {
        super.onCreate();
        this.f24524a = a();
        WebUiBaseInterface a2 = this.mRuntime.a(this.mRuntime.a());
        if (a2 != null && (a2 instanceof WebUiUtils.WebUiMethodInterface)) {
            this.f24529a = (WebUiUtils.WebUiMethodInterface) a2;
        }
        WebUiBaseInterface a3 = this.mRuntime.a(this.mRuntime.a());
        if (a3 != null && (a3 instanceof WebUiUtils.QQBrowserBaseActivityInterface)) {
            this.f24525a = (WebUiUtils.QQBrowserBaseActivityInterface) a3;
        }
        WebUiBaseInterface a4 = this.mRuntime.a(this.mRuntime.a());
        if (a4 != null && (a4 instanceof WebUiUtils.WebFeaturesInterface)) {
            this.f24526a = (WebUiUtils.WebFeaturesInterface) a4;
        }
        WebUiBaseInterface a5 = this.mRuntime.a(this.mRuntime.a());
        if (a5 != null && (a5 instanceof WebUiUtils.WebShareReportInterface)) {
            this.f24528a = (WebUiUtils.WebShareReportInterface) a5;
        }
        WebUiBaseInterface a6 = this.mRuntime.a(this.mRuntime.a());
        if (a6 != null && (a6 instanceof WebUiUtils.WebShareInterface)) {
            this.f24527a = (WebUiUtils.WebShareInterface) a6;
        }
    }

    @Override
    public void onDestroy() {
        if (this.f24530a != null && this.f24530a.isShowing()) {
            this.f24530a.dismiss();
        }
        if (this.f24531a != null) {
            WXShareHelper.a().b(this.f24531a);
        }
        super.onDestroy();
    }

    @Override
    public boolean handleJsRequest(JsBridgeListener jsBridgeListener, String str, String str2, String str3, String... strArr) {
        Object obj = null;
        if ("QQApi".equals(str2)) {
            boolean z2 = jsBridgeListener != null && jsBridgeListener.f34580a;
            addOpenApiListenerIfNeeded(str3, jsBridgeListener);
            int length = strArr.length;
            if ("isAppInstalled".equals(str3) && length == 1) {
                obj = Boolean.valueOf(PackageUtil.m9255a(this.f24524a, strArr[0]));
            } else if ("checkAppInstalled".equals(str3) && length == 1) {
                obj = PackageUtil.m9254a(this.f24524a, strArr[0]);
            } else if ("checkAppInstalledBatch".equals(str3) && length == 1) {
                obj = PackageUtil.b(this.f24524a, strArr[0]);
            } else if ("isAppInstalledBatch".equals(str3) && length == 1) {
                obj = PackageUtil.c(this.f24524a, strArr[0]);
            } else if ("startAppWithPkgName".equals(str3) && length == 1) {
                obj = Boolean.valueOf(PackageUtil.a(this.f24524a, strArr[0], null));
            } else if ("startAppWithPkgNameAndOpenId".equals(str3) && length == 2) {
                obj = Boolean.valueOf(PackageUtil.a(this.f24524a, strArr[0], strArr[1]));
            } else if ("getOpenidBatch".equals(str3) && length == 1) {
                obj = a(strArr[0]);
            } else if ("launchAppWithTokens".equals(str3) && (length == 1 || length == 4)) {
                if (length == 1) {
                    m6802a(strArr[0]);
                } else if (length == 4) {
                    a(strArr[0], strArr[1], strArr[2], strArr[3], null, "");
                }
            } else if ("getAppsVerionCodeBatch".equals(str3) && length == 1) {
                obj = PackageUtil.d(this.f24524a, strArr[0]);
            } else if ("setShareURL".equals(str3) && length == 1) {
                obj = Boolean.valueOf(m6803a(strArr[0]));
            } else if ("setShareInfo".equals(str3) && length == 1) {
                obj = Boolean.valueOf(m6804b(strArr[0]));
            } else if ("setToolHiddenFlags".equals(str3) && length == 1) {
                b(strArr[0]);
            } else if (S.equals(str3) && length == 1) {
                a(strArr[0], z2);
            } else if ("shareText".equals(str3) && length == 1) {
                c(strArr[0]);
            } else if (!"shareHypertext".equals(str3) || length != 1) {
                return false;
            } else {
                d(strArr[0]);
            }
            if (z2) {
                callJs4OpenApiIfNeeded(str3, 0, obj);
            } else {
                jsBridgeListener.a(obj);
            }
            return true;
        }
        return false;
    }

    public String a(String str) {
        String str2 = "";
        if (this.f24526a != null) {
            str2 = this.f24526a.a(str);
            if (QLog.isColorLevel()) {
                QLog.d("gamecenter", 2, "<--getOpenidBatch result=" + str2);
            }
        }
        return str2;
    }

    public void m6802a(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            a(jSONObject.optString("appID"), jSONObject.optString("paramsStr"), jSONObject.optString(Constants.KEY_PKG_NAME), jSONObject.optString("flags"), jSONObject.optString("type"), jSONObject.optString("subappid"));
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.d("launchAppWithTokens", 2, "parse params error");
            }
            e2.printStackTrace();
        }
    }

    public void a(String str, String str2, String str3, String str4, String str5, String str6) {
        QQAppInterface qQAppInterface;
        int i2;
        if (QLog.isColorLevel()) {
            QLog.d("gamecenter", 2, "launchAppWithTokens " + str3);
        }
        AppLaucherHelper appLaucherHelper = new AppLaucherHelper();
        if (this.f24525a != null) {
            qQAppInterface = this.mRuntime.m9632a();
        } else if (!(this.f24524a instanceof BaseActivity)) {
            qQAppInterface = null;
        } else {
            qQAppInterface = ((BaseActivity) this.f24524a).app;
        }
        if (qQAppInterface != null) {
            int i3 = e_attribute._IsFrdCommentFamousFeed;
            try {
                int parseInt = Integer.parseInt(str4);
                if ((67108864 & parseInt) == 67108864) {
                    i3 = 335544320;
                }
                if ((536870912 & parseInt) == 536870912) {
                    i3 |= 536870912;
                }
                if ((parseInt & 4194304) == 4194304) {
                    i3 |= 4194304;
                }
                i2 = i3;
            } catch (Exception e2) {
                i2 = 268435456;
            }
            ReportController.b(null, "dc01331", "", "", "Game", "Launch_game", 0, 0, str, "", "", "");
            boolean z2 = false;
            String str7 = "tencentwtlogin" + str + "://";
            if (util.FILE_DIR.equals(str5)) {
                PackageManager packageManager = this.f24524a.getPackageManager();
                Intent intent = new Intent(XChooserActivity.i);
                intent.setData(Uri.parse(str7));
                if (packageManager != null && packageManager.queryIntentActivities(intent, 0).size() > 0) {
                    z2 = true;
                }
            }
            if (z2) {
                String str8 = "";
                if (this.mRuntime != null && this.mRuntime.m9631a() != null) {
                    str8 = this.mRuntime.m9631a().getUrl();
                } else if (QLog.isColorLevel()) {
                    QLog.d(getClass().getSimpleName(), 2, "launchAppWithWlogin webview is null");
                }
                appLaucherHelper.a(str7, this.f24524a, str8, qQAppInterface, str, str3, i2, str6);
                return;
            }
            appLaucherHelper.a(qQAppInterface, this.f24524a, str, str2, str3, i2);
        }
    }

    public boolean m6803a(String str) {
        return this.f24527a != null && this.f24527a.setShareUrl(str);
    }

    public boolean m6804b(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        if (QLog.isColorLevel()) {
            QLog.d("QQApi", 2, "setShareInfo been called");
        }
        Bundle bundle = new Bundle();
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("title");
            String optString2 = jSONObject.optString("desc");
            String optString3 = jSONObject.optString(f);
            String optString4 = jSONObject.optString("image_url");
            String optString5 = jSONObject.optString("type");
            String optString6 = jSONObject.optString(d);
            String optString7 = jSONObject.optString("cover_url");
            String optString8 = jSONObject.optString("source_name");
            String optString9 = jSONObject.optString("article_id");
            boolean optBoolean = jSONObject.optBoolean(C, true);
            String optString10 = jSONObject.optString(D);
            boolean optBoolean2 = jSONObject.optBoolean(E, false);
            String optString11 = jSONObject.optString(F);
            boolean optBoolean3 = jSONObject.optBoolean(G);
            boolean optBoolean4 = jSONObject.optBoolean(H);
            String optString12 = jSONObject.optString("groupCode");
            String optString13 = jSONObject.optString(J);
            String optString14 = jSONObject.optString(K);
            if (!TextUtils.isEmpty(optString7)) {
                bundle.putString("cover_url", optString7);
            }
            if (!TextUtils.isEmpty(optString5)) {
                bundle.putString("type", optString5);
            }
            if (!TextUtils.isEmpty(optString6)) {
                bundle.putString(d, optString6);
            }
            if (!TextUtils.isEmpty(optString8)) {
                bundle.putString("source_name", optString8);
            }
            if (!TextUtils.isEmpty(optString9)) {
                bundle.putString("article_id", optString9);
            }
            if (!TextUtils.isEmpty(optString11)) {
                bundle.putString(F, optString11);
            }
            bundle.putBoolean(C, optBoolean);
            bundle.putBoolean(E, optBoolean2);
            if (!TextUtils.isEmpty(optString10)) {
                bundle.putString(D, optString10);
            }
            bundle.putBoolean(G, optBoolean3);
            bundle.putBoolean(H, optBoolean4);
            if (!TextUtils.isEmpty(optString12)) {
                bundle.putString("groupCode", optString12);
            }
            if (!TextUtils.isEmpty(optString13)) {
                bundle.putString(J, optString13);
            }
            if (!TextUtils.isEmpty(optString14)) {
                bundle.putString(K, optString14);
            }
            WebUiBaseInterface a2 = this.mRuntime.a(this.mRuntime.a());
            if (a2 != null && (a2 instanceof WebUiUtils.WebShareInterface)) {
                bundle.putInt(Share.f6796r, 1);
                return ((WebUiUtils.WebShareInterface) a2).setSummary(optString, optString2, optString3, optString4, bundle);
            }
            return false;
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.d("QQApi", 2, "setShareInfo param error");
            }
            return false;
        }
    }

    public void b(String str) {
        try {
            int parseInt = Integer.parseInt(str, 10);
            SwiftBrowserMiscHandler swiftBrowserMiscHandler = (SwiftBrowserMiscHandler) super.getBrowserComponent(32);
            if (swiftBrowserMiscHandler != null) {
                swiftBrowserMiscHandler.f34774a.sendMessage(swiftBrowserMiscHandler.f34774a.obtainMessage(0, parseInt, 0));
            }
        } catch (NumberFormatException e2) {
        }
    }

    public void a(Activity activity) {
        if (this.f24530a == null) {
            if (this.f24527a != null) {
                this.f24530a = this.f24527a.getShare().m1828a();
            } else if (activity.getClass().getName().equalsIgnoreCase("com.tencent.qqreadinjoy.detailspage.ReadInJoyArticleDetailActivity")) {
                if (activity instanceof WebUiUtils.WebShareInterface) {
                    this.f24530a = ((WebUiUtils.WebShareInterface) activity).getShare().m1828a();
                } else {
                    this.f24530a = new QQProgressDialog(activity, activity.getResources().getDimensionPixelSize(R.dimen.f39450title_bar_height));
                }
            } else if (activity instanceof WebUiUtils.WebShareInterface) {
                this.f24530a = ((WebUiUtils.WebShareInterface) activity).getShare().m1828a();
            } else {
                this.f24530a = new QQProgressDialog(activity, activity.getResources().getDimensionPixelSize(R.dimen.f39450title_bar_height));
            }
        }
    }

    public void a(String str, boolean z2) {
        if (!TextUtils.isEmpty(str)) {
            this.R = null;
            try {
                JSONObject jSONObject = new JSONObject(str);
                Activity a2 = this.mRuntime.a();
                String optString = jSONObject.optString(z2 ? p : o, "0");
                String string = jSONObject.getString("title");
                String string2 = jSONObject.getString("desc");
                String string3 = jSONObject.getString(z2 ? g : f);
                String optString2 = jSONObject.optString(z2 ? "imageUrl" : "image_url");
                String optString3 = jSONObject.optString(j);
                String optString4 = jSONObject.optString(l);
                String optString5 = jSONObject.optString(Q);
                int i2 = 0;
                if (TextUtils.isEmpty(optString2)) {
                    i2 = 1;
                }
                if (TextUtils.isEmpty(string2)) {
                    i2 |= 2;
                }
                int i3 = TextUtils.isEmpty(string) ? i2 | 4 : i2;
                Bundle bundle = new Bundle();
                bundle.putString(ReportDef.RemoteColumn.f96075a, "102");
                bundle.putString("act_type", "94");
                bundle.putString("intext_1", "" + (i3 == 0 ? 0 : 1));
                bundle.putString("intext_2", "" + i3);
                bundle.putString("stringext_1", "" + string3);
                ReportCenter.a().a(bundle, "", this.mRuntime.m9632a().getAccount(), false);
                int optInt = jSONObject.optInt("shareQQType", 13);
                this.R = jSONObject.optString("callback");
                boolean optBoolean = jSONObject.optBoolean(n, false);
                HashMap hashMap = new HashMap();
                if (!optBoolean && string3 != null && string3.length() > 180) {
                    hashMap.put(f, string3);
                }
                if (optString2 != null && optString2.length() > 30 && !"2".equals(optString) && !"3".equals(optString)) {
                    hashMap.put("image_url", optString2);
                }
                if (optString4 != null && optString4.length() > 30) {
                    hashMap.put(l, optString4);
                }
                if (!hashMap.isEmpty()) {
                    if (this.f24530a == null) {
                        a(a2);
                    }
                    if (!this.f24530a.isShowing()) {
                        this.f24530a.b(R.string.f64560name_res_0x7f0a180f);
                        this.f24530a.show();
                    }
                    ThreadManager.a(new seh(this, hashMap, string3, optString2, optString4, optString, jSONObject, string, string2, optString3, optInt, optString5, a2), 8, null, true);
                } else if ("1".equals(optString)) {
                    a(jSONObject, optString, string, string2, string3, optString2, optString3, optString4);
                } else if ("2".equals(optString) || "3".equals(optString)) {
                    b(jSONObject, optString, string, string2, string3, optString2, optString3, optString4);
                } else {
                    a(jSONObject, optString, string, string2, string3, optString2, optString3, optString4, optInt, optString5);
                }
            } catch (JSONException e2) {
                if (QLog.isColorLevel()) {
                    QLog.d("QQApi", 2, "shareMsg error: " + e2.toString());
                }
            }
        }
    }

    public void a(JSONObject jSONObject, String str, String str2, String str3, String str4, String str5, String str6, String str7) {
        Activity a2 = this.mRuntime.a();
        if (this.f24530a == null) {
            a(a2);
        }
        if (this.f24530a != null && this.f24530a.isShowing()) {
            this.f24530a.dismiss();
        }
        Bundle bundle = new Bundle();
        bundle.putString("title", str2);
        bundle.putString("desc", str3);
        bundle.putString(AppConstants.Key.bf, str4);
        bundle.putString("from", SwiftBrowserShareMenuHandler.f34814a);
        ArrayList<String> arrayList = new ArrayList<>(1);
        arrayList.add(str5);
        bundle.putStringArrayList("image_url", arrayList);
        bundle.putLong(AppConstants.Key.aU, 0L);
        if (this.f24528a != null && this.f24529a != null) {
            bundle.putString(PublicAccountChatPie.au, this.f24528a.mo9628f());
            bundle.putString(PublicAccountChatPie.av, this.f24528a.g());
            bundle.putString(PublicAccountChatPie.ax, this.f24529a.getCurrentUrl());
            bundle.putBoolean("from_web", true);
            if (this.f24528a.h() != null && !"".equals(this.f24528a.h())) {
                bundle.putString(PublicAccountChatPie.az, this.f24528a.h());
            }
        }
        if (!QZoneShareManager.m10878a(this.mRuntime.m9632a(), a(), bundle, (DialogInterface.OnDismissListener) null, this.f24525a != null ? this.f24525a.a(this, (byte) 1, true) : 1)) {
            QRUtils.a(2, (int) R.string.f64557name_res_0x7f0a180c);
            if (!TextUtils.isEmpty(this.R)) {
                callJs(this.R, "false");
            } else {
                callJs4OpenApiIfNeeded(S, 0, "false");
            }
        }
    }

    public void b(JSONObject jSONObject, String str, String str2, String str3, String str4, String str5, String str6, String str7) {
        Activity a2 = this.mRuntime.a();
        int i2 = -1;
        if (!WXShareHelper.a().m10253a()) {
            i2 = R.string.f64448name_res_0x7f0a179f;
        } else if (!WXShareHelper.a().m10254b()) {
            i2 = R.string.f64449name_res_0x7f0a17a0;
        }
        if (i2 != -1) {
            QRUtils.a(0, i2);
            if (this.f24530a == null) {
                a(a2);
            }
            if (this.f24530a != null && this.f24530a.isShowing()) {
                this.f24530a.dismiss();
                return;
            }
            return;
        }
        HashMap hashMap = new HashMap(1);
        sej sejVar = new sej(this, str, str4, hashMap, str6, str2, str3, str7);
        if (TextUtils.isEmpty(str5)) {
            sejVar.run();
            return;
        }
        if (this.f24530a == null) {
            a(a2);
        }
        if (!this.f24530a.isShowing()) {
            this.f24530a.b(R.string.f64560name_res_0x7f0a180f);
            this.f24530a.show();
        }
        ThreadManager.a(new sel(this, str5, hashMap, sejVar, str, str4), 8, null, false);
    }

    public void a(JSONObject jSONObject, String str, String str2, String str3, String str4, String str5, String str6, String str7, int i2, String str8) {
        int optInt;
        String str9;
        Activity a2 = this.mRuntime.a();
        Intent intent = new Intent();
        String optString = jSONObject.optString("toUin");
        int optInt2 = jSONObject.optInt("uinType", 0);
        if (optString != null && optString.length() >= 5) {
            intent.setClass(this.f24524a, DirectForwardActivity.class);
            intent.putExtra("toUin", optString);
            intent.putExtra("uinType", optInt2);
        } else {
            intent.setClass(this.f24524a, ForwardRecentActivity.class);
        }
        intent.putExtra(ForwardConstants.p, true);
        String str10 = (str2 == null || str2.length() <= 45) ? str2 : str2.substring(0, 45) + "…";
        if (str3 != null && str3.length() > 60) {
            str3 = str3.substring(0, 60) + "…";
        }
        if (str8.equals("1")) {
            intent.putExtra(ForwardConstants.al, 1);
        }
        if (i2 <= 0) {
            i2 = 13;
        }
        intent.putExtra(ForwardConstants.W_, ForwardConstants.Y_);
        intent.putExtra("title", str10);
        intent.putExtra("desc", str3);
        intent.putExtra(AppConstants.Key.bf, str4);
        intent.putExtra("shareQQType", i2);
        intent.putExtra(AppConstants.Key.G, 1001);
        intent.putExtra(AppConstants.Key.aU, jSONObject.optLong("appid", -1L));
        intent.putExtra(AppConstants.Key.aS, "com.tencent.tim");
        intent.putExtra(AppConstants.Key.bh, str5);
        BaseApplication context = BaseApplicationImpl.getContext();
        Object[] objArr = new Object[1];
        if (str10 == null) {
            str10 = "";
        }
        objArr[0] = str10;
        intent.putExtra(AppConstants.Key.bJ, context.getString(R.string.f60751name_res_0x7f0a092c, objArr));
        if (jSONObject.has("contentAction")) {
            intent.putExtra(AppConstants.Key.bR, jSONObject.getString("contentAction"));
        }
        if (jSONObject.has("actionData")) {
            intent.putExtra(AppConstants.Key.bU, jSONObject.getString("actionData"));
        }
        if (jSONObject.has("sourceAction")) {
            intent.putExtra(AppConstants.Key.bW, jSONObject.getString("sourceAction"));
        }
        if (jSONObject.has("isShareFlag")) {
            intent.putExtra(AppConstants.Key.bI, Integer.parseInt(jSONObject.getString("isShareFlag")));
        }
        if (jSONObject.has("srcActionData")) {
            intent.putExtra(AppConstants.Key.bX, jSONObject.getString("srcActionData"));
        }
        if (jSONObject.has("appName")) {
            intent.putExtra("app_name", jSONObject.getString("appName"));
        }
        if ("audio".equals(str6)) {
            optInt = 2;
            intent.putExtra(AppConstants.Key.bl, str7);
        } else {
            optInt = jSONObject.optInt("req_type", 1);
            if (optInt == 2) {
                intent.putExtra(AppConstants.Key.bl, jSONObject.getString(AppConstants.Key.bl));
            }
        }
        intent.putExtra("req_type", optInt);
        if (jSONObject.has("report")) {
            intent.putExtra("report", jSONObject.getString("report"));
        }
        intent.putExtra(DirectForwardActivity.e, MobileQQ.getMobileQQ().getProcessName());
        boolean optBoolean = jSONObject.optBoolean("back", false);
        if (jSONObject.has(ForwardPluginShareStructMsgOption.g)) {
            optBoolean = jSONObject.getBoolean(ForwardPluginShareStructMsgOption.g);
        }
        intent.putExtra(ForwardPluginShareStructMsgOption.g, optBoolean);
        if (jSONObject.has("serviceID")) {
            intent.putExtra(AppConstants.Key.ez, jSONObject.getString("serviceID"));
        }
        long optLong = jSONObject.optLong("appid", 0L);
        if (optLong > 0) {
            AppInterface m9632a = this.mRuntime.m9632a();
            if (m9632a != null) {
                if (this.f24530a == null) {
                    a(a2);
                }
                if (!this.f24530a.isShowing()) {
                    this.f24530a.b(R.string.f64560name_res_0x7f0a180f);
                    this.f24530a.show();
                }
                intent.putExtra(AppConstants.Key.cb, Long.toString(optLong));
                Share.a(m9632a, this.f24524a, m9632a.getAccount(), optLong, 3000L, new sem(this, intent));
                return;
            }
            return;
        }
        if (this.f24530a == null) {
            a(a2);
        }
        if (this.f24530a != null && this.f24530a.isShowing()) {
            this.f24530a.dismiss();
        }
        String optString2 = jSONObject.optString("puin", null);
        String optString3 = optString2 == null ? jSONObject.optString("oaUin") : optString2;
        if (!TextUtils.isEmpty(optString3)) {
            EntityManager createEntityManager = this.mRuntime.m9632a().getEntityManagerFactory(this.mRuntime.m9632a().getAccount()).createEntityManager();
            AccountDetail accountDetail = (AccountDetail) createEntityManager.a(AccountDetail.class, optString3);
            createEntityManager.m7241a();
            String optString4 = jSONObject.optString(y, "");
            String str11 = null;
            if (TextUtils.isEmpty(optString4)) {
                if (accountDetail == null) {
                    str9 = null;
                } else {
                    str9 = accountDetail.name;
                }
                if (TextUtils.isEmpty(str9) && jSONObject.has("sourceName")) {
                    str9 = jSONObject.optString("sourceName");
                }
                if (TextUtils.isEmpty(str9)) {
                    str9 = optString3;
                }
            } else {
                if (jSONObject.has("sourceName")) {
                    str11 = jSONObject.optString("sourceName");
                }
                if (TextUtils.isEmpty(str11) && accountDetail != null) {
                    str11 = accountDetail.name;
                }
                str9 = TextUtils.isEmpty(str11) ? optString3 : str11;
            }
            if (str9.equalsIgnoreCase(this.f24524a.getString(R.string.f62461name_res_0x7f0a0fda))) {
                boolean equalsIgnoreCase = str9.equalsIgnoreCase(this.f24524a.getString(R.string.f62461name_res_0x7f0a0fda));
                String str12 = equalsIgnoreCase ? ReadInJoyHelper.av : ReadInJoyHelper.aw;
                String str13 = equalsIgnoreCase ? ReadInJoyHelper.ax : ReadInJoyHelper.ay;
                String str14 = equalsIgnoreCase ? ReadInJoyHelper.az : ReadInJoyHelper.aA;
                intent.putExtra(PublicAccountChatPie.az, optString3);
                intent.putExtra(AppConstants.Key.bW, "plugin");
                intent.putExtra(AppConstants.Key.bY, str12);
                intent.putExtra(AppConstants.Key.bZ, str13);
                intent.putExtra(AppConstants.Key.bS, str12);
                intent.putExtra(AppConstants.Key.ca, str14);
                intent.putExtra("app_name", str9);
            } else {
                String optString5 = jSONObject.optString(x, "");
                String optString6 = jSONObject.optString(z, "");
                String optString7 = jSONObject.optString(A, "");
                String optString8 = jSONObject.optString(B, "");
                if (TextUtils.isEmpty(optString4) || (("web".equals(optString4) && TextUtils.isEmpty(optString5)) || (!"web".equals(optString4) && TextUtils.isEmpty(optString6) && (TextUtils.isEmpty(optString7) || TextUtils.isEmpty(optString8))))) {
                    String format = String.format("mqqapi://app/action?pkg=com.tencent.mobileqq&cmp=com.tencent.biz.pubaccount.AccountDetailActivity&uin=%s", optString3);
                    String format2 = String.format("mqqapi://card/show_pslcard?src_type=internal&card_type=public_account&uin=%s&version=1", optString3);
                    intent.putExtra(AppConstants.Key.bW, "plugin");
                    intent.putExtra(AppConstants.Key.bY, format);
                    intent.putExtra(AppConstants.Key.bZ, format2);
                } else {
                    intent.putExtra(AppConstants.Key.bW, optString4);
                    if ("web".equals(optString4)) {
                        intent.putExtra(AppConstants.Key.bV, optString5);
                        intent.putExtra(AppConstants.Key.bK, optString5);
                    } else {
                        if (!TextUtils.isEmpty(optString6)) {
                            intent.putExtra(AppConstants.Key.bX, optString6);
                        }
                        if (!TextUtils.isEmpty(optString7)) {
                            intent.putExtra(AppConstants.Key.bY, optString7);
                        }
                        if (!TextUtils.isEmpty(optString8)) {
                            intent.putExtra(AppConstants.Key.bZ, optString8);
                        }
                    }
                }
                intent.putExtra(PublicAccountChatPie.az, optString3);
                intent.putExtra("app_name", str9);
                String optString9 = jSONObject.optString(w, "");
                if (TextUtils.isEmpty(optString9)) {
                    intent.putExtra(AppConstants.Key.ca, "http://url.cn/JS8oE7");
                } else {
                    intent.putExtra(AppConstants.Key.ca, optString9);
                }
            }
        } else if (jSONObject.has("sourceName")) {
            String optString10 = jSONObject.optString("sourceName");
            intent.putExtra("app_name", optString10);
            if ("手Q阅读".equals(optString10) && jSONObject.has("srcIconUrl")) {
                intent.putExtra(AppConstants.Key.ca, jSONObject.optString("srcIconUrl"));
            }
        } else {
            intent.putExtra("app_name", this.f24524a.getString(R.string.f60750name_res_0x7f0a092b));
        }
        if (this.f24528a != null && this.f24529a != null) {
            intent.putExtra(PublicAccountChatPie.au, this.f24528a.mo9628f());
            intent.putExtra(PublicAccountChatPie.av, this.f24528a.g());
            intent.putExtra(PublicAccountChatPie.ax, this.f24529a.getCurrentUrl());
            intent.putExtra("from_web", true);
            if (this.f24528a.h() != null && !"".equals(this.f24528a.h())) {
                intent.putExtra(PublicAccountChatPie.az, this.f24528a.h());
            }
        }
        AbsStructMsg a3 = StructMsgFactory.a(intent.getExtras());
        if (a3 == null) {
            if (QLog.isColorLevel()) {
                QLog.d("QQApi", 2, "build struct msg fail");
            }
            if (!TextUtils.isEmpty(this.R)) {
                callJs(this.R, "false");
                return;
            } else {
                callJs4OpenApiIfNeeded(S, 0, "false");
                return;
            }
        }
        intent.putExtra(AppConstants.Key.ci, a3.getBytes());
        startActivityForResult(intent, (byte) 1);
    }

    public void c(String str) {
        if (!TextUtils.isEmpty(str)) {
            this.R = null;
            try {
                JSONObject jSONObject = new JSONObject(str);
                Intent intent = new Intent(this.f24524a, ForwardRecentActivity.class);
                intent.putExtra("isFromShare", true);
                String optString = jSONObject.optString("toUin");
                int optInt = jSONObject.optInt("uinType", 0);
                if (optString != null && optString.length() >= 5) {
                    intent.setClass(this.f24524a, DirectForwardActivity.class);
                    intent.putExtra("toUin", optString);
                    intent.putExtra("uinType", optInt);
                }
                intent.putExtra(AppConstants.Key.G, -1);
                intent.putExtra(AppConstants.Key.F, jSONObject.optString("text"));
                this.R = jSONObject.optString("callback");
                if (jSONObject.has("report")) {
                    intent.putExtra("report", jSONObject.getString("report"));
                }
                intent.putExtra(DirectForwardActivity.e, MobileQQ.getMobileQQ().getProcessName());
                startActivityForResult(intent, (byte) 1);
            } catch (JSONException e2) {
                if (QLog.isColorLevel()) {
                    QLog.d("QQApi", 2, "shareText error: " + e2.getMessage());
                }
            }
        }
    }

    public void d(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if ("0".equals(jSONObject.optString(o, "0"))) {
                    Intent intent = new Intent(this.f24524a, ForwardRecentActivity.class);
                    intent.putExtra(ForwardConstants.W_, ForwardConstants.Y_);
                    intent.putExtra(AppConstants.Key.G, -4);
                    intent.putExtra(DirectForwardActivity.e, MobileQQ.getMobileQQ().getProcessName());
                    intent.putExtra("req_type", 3);
                    intent.putExtra(ForwardPluginShareStructMsgOption.g, false);
                    intent.putExtra(ForwardConstants.p, true);
                    intent.putExtra(AppConstants.Key.F, jSONObject.optString("text"));
                    intent.putExtra(AppConstants.Key.cb, jSONObject.optString("srcName"));
                    intent.putExtra(AppConstants.Key.ca, jSONObject.optString("srcIconUrl"));
                    intent.putExtra(AppConstants.Key.bV, jSONObject.optString("srcUrl"));
                    AbsStructMsg a2 = StructMsgFactory.a(intent.getExtras());
                    if (a2 == null) {
                        if (QLog.isColorLevel()) {
                            QLog.d("QQApi", 2, "build struct msg fail");
                        }
                    } else {
                        intent.putExtra(AppConstants.Key.ci, a2.getBytes());
                    }
                    startActivityForResult(intent, (byte) 1);
                }
            } catch (JSONException e2) {
                if (QLog.isColorLevel()) {
                    QLog.d("QQApi", 2, "shareHyperText error: " + e2.getMessage());
                }
            }
        }
    }

    @Override
    public void onActivityResult(Intent intent, byte b2, int i2) {
        super.onActivityResult(intent, b2, i2);
        if (b2 == 1) {
            if (!TextUtils.isEmpty(this.R)) {
                String str = this.R;
                String[] strArr = new String[1];
                strArr[0] = i2 == -1 ? "true" : "false";
                callJs(str, strArr);
                return;
            }
            callJs4OpenApiIfNeeded(S, 0, i2 == -1 ? "true" : "false");
        }
    }

    private Context a() {
        Activity a2 = this.mRuntime.a();
        while (a2 != null && (a2 instanceof BasePluginActivity)) {
            a2 = ((BasePluginActivity) a2).getOutActivity();
        }
        return a2;
    }
}