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

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


package com.tencent.mobileqq.cloudfile.wps;

import com.tencent.mobileqq.app.automator.StepFactory;
import com.tencent.mobileqq.webview.swift.JsBridgeListener;
import com.tencent.mobileqq.webview.swift.WebViewPlugin;
import com.tencent.qphone.base.BaseConstants;
import com.tencent.qphone.base.util.QLog;
import java.util.Iterator;
import org.json.JSONException;
import org.json.JSONObject;
public class WpsApiPlugin extends WebViewPlugin {
    public static final String f88720a = "wps";

    public WpsApiPlugin() {
        this.mPluginNameSpace = f88720a;
    }

    @Override
    public boolean handleJsRequest(JsBridgeListener jsBridgeListener, String str, String str2, String str3, String... strArr) {
        JSONObject jSONObject;
        String next;
        if (!f88720a.equals(str2)) {
            QLog.e(this.TAG, 1, "pkg is wrong");
            return false;
        } else if (strArr.length != 1) {
            QLog.e(this.TAG, 1, "args.length is wrong");
            return false;
        } else {
            addOpenApiListenerIfNeeded(str3, jsBridgeListener);
            try {
                jSONObject = new JSONObject(strArr[0]);
                QLog.i(this.TAG, 1, "call[" + str3 + StepFactory.f18879b);
                Iterator<String> keys = jSONObject.keys();
                while (keys.hasNext()) {
                    QLog.i(this.TAG, 1, keys.next() + ":" + jSONObject.getString(next));
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
            if ("downloadFileUrl".equals(str3)) {
                ((WpsFilePreviewFragment) this.mRuntime.m9633a()).a(jSONObject.getString("url"), jSONObject.getString("sha"));
                return true;
            } else if ("setFileMeta".equals(str3)) {
                String string = jSONObject.getString("fileid");
                String str4 = "https://drive.wps.cn/view/p/" + string + "?from=tim&timestamp=" + System.currentTimeMillis();
                String string2 = jSONObject.getString("sha");
                String string3 = jSONObject.getString("name");
                Long valueOf = Long.valueOf(jSONObject.getLong("size"));
                if (this.mRuntime.m9633a() instanceof WPSListWebFragment) {
                    ((WPSListWebFragment) this.mRuntime.m9633a()).a(string2, string3, string, valueOf.longValue(), str4);
                } else if (this.mRuntime.m9633a() instanceof WpsFilePreviewFragment) {
                    ((WpsFilePreviewFragment) this.mRuntime.m9633a()).a(string2, string3, string, valueOf, str4);
                }
                return true;
            } else if ("setWpsUserInfo".equals(str3)) {
                ((WPSListWebFragment) this.mRuntime.m9633a()).f();
                return true;
            } else if ("previewFinish".equals(str3)) {
                ((WpsFilePreviewFragment) this.mRuntime.m9633a()).f();
                return true;
            } else if (BaseConstants.BROADCAST_USERSYNC_EXIT.equals(str3)) {
                this.mRuntime.a().finish();
                return true;
            } else {
                if ("openDirectory".equals(str3)) {
                    ((WPSListWebFragment) this.mRuntime.m9633a()).a(jSONObject.getString("url"));
                    return true;
                }
                return false;
            }
        }
    }
}