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

以下内容为反编译后的 QZoneGiftFullScreenJsPlugin.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.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 QZoneGiftFullScreenJsPlugin extends QzoneInternalWebViewPlugin implements WebEventListener {
    public static final String f98764a = "Qzone";
    public static final String f98765b = "http://h5.qzone.qq.com/gift/detail?_wv=2097155&_proxy=1&uin={uin}&ugcid={ugcid}";
    private static final String f98766c = "QZoneGiftFullScreenJsPlugin";
    private QzoneGiftFullScreenViewController f70919a;
    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.V.equalsIgnoreCase(str3)) {
            a(this.f98823a, this.f98823a.mRuntime, strArr);
            return true;
        } else if (QZoneJsConstants.W.equalsIgnoreCase(str3)) {
            RemoteHandleManager.a().a(this);
            b(this.f98823a, this.f98823a.mRuntime, strArr);
            return true;
        } else if (QZoneJsConstants.X.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("giftid");
                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.a(str) + MagicfaceResLoader.a());
                int i = (file.exists() && file.isDirectory()) ? 1 : 0;
                if (this.f98823a != null) {
                    this.f98823a.callJs("window." + str2 + "({checkGift:" + i + "})");
                }
            }
        }
    }

    private void b(WebViewPlugin webViewPlugin, WebViewPlugin.PluginRuntime pluginRuntime, String[] strArr) {
        pluginRuntime.m9632a().getHandler(QzoneDeviceTagJsPlugin.class).post(new yhy(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("giftid");
                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)) {
                String a2 = QzoneGiftFullScreenActionManager.a(str);
                File file = new File(a2);
                if (file.exists() && file.isDirectory()) {
                    this.f70919a = new QzoneGiftFullScreenViewController(this.f98823a.mRuntime.a());
                    if (QzoneGiftFullScreenViewController.m10907a()) {
                        this.f70919a.a(str, a2, new yhz(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(f98766c, 2, "call js function,bundle is empty");
                }
            } else if (RemoteHandleConst.n.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 + "({downloadGift:" + 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.f70919a != null) {
                    this.f70919a.m10908b();
                }
            }
        }
        return super.a(str, j, map);
    }
}