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

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


package cooperation.qzone.webviewplugin;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.mobileqq.magicface.model.MagicfaceResLoader;
import com.tencent.mobileqq.webview.swift.JsBridgeListener;
import com.tencent.mobileqq.webview.swift.WebViewPlugin;
import com.tencent.mobileqq.webview.swift.WebviewPluginEventConfig;
import com.tencent.open.base.MD5Utils;
import com.tencent.qphone.base.util.QLog;
import common.config.service.QzoneConfig;
import cooperation.qzone.QzoneGiftFullScreenActionManager;
import cooperation.qzone.QzoneGiftFullScreenViewController;
import cooperation.qzone.remote.logic.RemoteHandleConst;
import cooperation.qzone.remote.logic.RemoteHandleManager;
import cooperation.qzone.remote.logic.WebEventListener;
import java.io.File;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class QZonePassivePraiseJsPlugin extends QzoneInternalWebViewPlugin implements WebEventListener {
    public static final String f98779a = "Qzone";
    public static final String f98780b = "http://h5.qzone.qq.com/gift/detail?_wv=2097155&_proxy=1&uin={uin}&ugcid={ugcid}";
    private static final String f98781c = "QZoneGiftFullScreenJsPlugin";
    private QzoneGiftFullScreenViewController f70931a;
    private String d = "";

    @Override
    public boolean a(JsBridgeListener jsBridgeListener, String str, String str2, String str3, String... strArr) {
        if (!"Qzone".equals(str2) || this.f98823a == null || this.f98823a.mRuntime == null) {
            return false;
        }
        if (QZoneJsConstants.Y.equalsIgnoreCase(str3)) {
            a(this.f98823a, this.f98823a.mRuntime, strArr);
            return true;
        } else if (QZoneJsConstants.Z.equalsIgnoreCase(str3)) {
            RemoteHandleManager.a().a(this);
            b(this.f98823a, this.f98823a.mRuntime, strArr);
            return true;
        } else if (QZoneJsConstants.aa.equalsIgnoreCase(str3)) {
            c(this.f98823a, this.f98823a.mRuntime, strArr);
            return true;
        } else {
            return false;
        }
    }

    private void a(WebViewPlugin webViewPlugin, WebViewPlugin.PluginRuntime pluginRuntime, String[] strArr) {
        String str;
        JSONException e;
        if (strArr != null && strArr.length > 0 && strArr[0] != null) {
            String str2 = "";
            try {
                JSONObject jSONObject = new JSONObject(strArr[0]);
                str = jSONObject.getString("zipUrl");
                try {
                    str2 = jSONObject.getString("callback");
                } catch (JSONException e2) {
                    e = e2;
                    e.printStackTrace();
                    if (TextUtils.isEmpty(str)) {
                    }
                    return;
                }
            } catch (JSONException e3) {
                str = "";
                e = e3;
            }
            if (TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
                File file = new File(QzoneGiftFullScreenActionManager.b(MD5Utils.d(str)) + MagicfaceResLoader.a());
                int i = (file.exists() && file.isDirectory()) ? 1 : 0;
                if (this.f98823a != null) {
                    this.f98823a.callJs("window." + str2 + "({checked:" + i + "})");
                }
            }
        }
    }

    private void b(WebViewPlugin webViewPlugin, WebViewPlugin.PluginRuntime pluginRuntime, String[] strArr) {
        pluginRuntime.m9632a().getHandler(QzoneDeviceTagJsPlugin.class).post(new yid(this, strArr));
    }

    private void c(WebViewPlugin webViewPlugin, WebViewPlugin.PluginRuntime pluginRuntime, String[] strArr) {
        String str;
        JSONException e;
        if (strArr != null && strArr.length > 0 && strArr[0] != null) {
            String str2 = "";
            try {
                JSONObject jSONObject = new JSONObject(strArr[0]);
                str = jSONObject.getString("zipUrl");
                try {
                    str2 = jSONObject.getString("callback");
                } catch (JSONException e2) {
                    e = e2;
                    e.printStackTrace();
                    if (TextUtils.isEmpty(str2)) {
                    }
                }
            } catch (JSONException e3) {
                str = "";
                e = e3;
            }
            if (TextUtils.isEmpty(str2)) {
                String replace = str.replace(MagicfaceResLoader.f, MagicfaceResLoader.a());
                String b2 = QzoneGiftFullScreenActionManager.b(MD5Utils.d(replace));
                File file = new File(b2);
                if (file.exists() && file.isDirectory()) {
                    this.f70931a = new QzoneGiftFullScreenViewController(this.f98823a.mRuntime.a());
                    if (QzoneGiftFullScreenViewController.m10907a()) {
                        this.f70931a.a(replace, b2, true, new yie(this, str2));
                    }
                }
            }
        }
    }

    @Override
    public void onWebEvent(String str, Bundle bundle) {
        if (bundle != null && bundle.containsKey("data")) {
            Bundle bundle2 = bundle.getBundle("data");
            if (bundle2 == null) {
                if (QLog.isColorLevel()) {
                    QLog.e(f98781c, 2, "call js function,bundle is empty");
                }
            } else if (RemoteHandleConst.p.equals(str)) {
                int i = bundle2.getInt(RemoteHandleConst.ay);
                String str2 = "-1";
                if (i > 0) {
                    if (i < 100) {
                        str2 = String.format("%.1f", Double.valueOf(i * 0.01d));
                    } else {
                        str2 = "1";
                    }
                }
                if (this.f98823a != null && !TextUtils.isEmpty(this.d)) {
                    this.f98823a.callJs("window." + this.d + "({download:" + str2 + "})");
                }
            }
        }
    }

    @Override
    public void a(Intent intent, byte b2, int i) {
        super.a(intent, b2, i);
    }

    @Override
    public void mo11113a() {
        super.mo11113a();
    }

    @Override
    public boolean a(String str, long j, Map map) {
        int indexOf;
        if (j == WebviewPluginEventConfig.u) {
            String config = QzoneConfig.getInstance().getConfig(QzoneConfig.MAIN_KEY_H5URL, QzoneConfig.SECONDARY_QZONE_GIFTDETAILPAGE, "http://h5.qzone.qq.com/gift/detail?_wv=2097155&_proxy=1&uin={uin}&ugcid={ugcid}");
            if (!TextUtils.isEmpty(config) && (indexOf = config.indexOf("?")) != -1) {
                String substring = config.substring(0, indexOf);
                if (!TextUtils.isEmpty(str) && str.startsWith(substring) && this.f70931a != null) {
                    this.f70931a.m10908b();
                }
            }
        }
        return super.a(str, j, map);
    }
}