Snaptube v4.40.0.4401610版本的 MD5 值为:ca2b95dcff63007195db02a6c93091b9

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


package o;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.webkit.JsPromptResult;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import com.snaptube.premium.app.PhoenixApplication;
import com.snaptube.premium.configs.Config;
import java.util.List;
import o.atv;
import o.cbq;
import org.json.JSONException;
import org.json.JSONObject;
public class cbm extends cbq.Cif implements Handler.Callback {
    private final Handler f19387;
    private cgo f19388;
    private boolean f19392;
    private cgg f19393;
    private Handler f19395 = new Handler(this);
    private boolean f19389 = false;
    boolean f19390 = false;
    String f19391 = null;
    private Handler f19394 = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message message) {
            switch (message.what) {
                case 1:
                    cbm.this.f19393.m20716().m20721((String) message.obj, true, Boolean.toString(PhoenixApplication.m10913().m10923() ? false : true), true);
                    return true;
                case 2:
                    JSONObject jSONObject = (JSONObject) message.obj;
                    try {
                        String string = jSONObject.getString("callbackId");
                        if (!PhoenixApplication.m10913().m10923()) {
                            cbm.this.f19393.m20716().m20721(string, false, "User is Viper", true);
                            return true;
                        }
                        try {
                            bmn.m18063(jSONObject.getInt(com.appnext.base.b.c.iX));
                            cbm.this.f19393.m20716().m20721(string, true, "success", true);
                            return true;
                        } catch (JSONException e) {
                            cbm.this.f19393.m20716().m20721(string, false, "Lack of param: day", true);
                            return true;
                        }
                    } catch (JSONException e2) {
                        cdz.m20416(e2);
                        return true;
                    }
                default:
                    return false;
            }
        }
    });

    public static boolean m19932() {
        return cgg.m20706();
    }

    public cbm(Handler handler) {
        this.f19387 = handler;
    }

    public void m19936(boolean z) {
        this.f19389 = z;
    }

    @Override
    @SuppressLint({"AddJavascriptInterface"})
    public void mo12391(Context context, WebView webView) {
        super.mo12391(context, webView);
        this.f19393 = new cgg("$" + cgq.m20753(5), cau.m19848());
        this.f19388 = new cgo(context.getApplicationContext(), this.f19395, this.f19393.m20716());
        this.f19388.m20743(Config.m11134());
        this.f19388.m20745(this.f19389);
        this.f19388.m20746(Config.m11145());
        this.f19393.m20712("ui", this.f19388);
        this.f19393.m20712("coins", new cgl(context.getApplicationContext(), this.f19394, this.f19393.m20716()));
        this.f19393.m20710(context, PhoenixApplication.m10917().m18679());
        webView.addJavascriptInterface(this.f19393, this.f19393.m20717());
    }

    @Override
    public void mo19938() {
        super.mo19938();
        this.f19395.removeCallbacksAndMessages(null);
        this.f19393.m20715();
        this.f19393 = null;
    }

    @Override
    public WebResourceResponse mo12394(WebView webView, String str) {
        cgg cggVar = this.f19393;
        if (cggVar != null) {
            return cggVar.m20708(str);
        }
        return null;
    }

    @Override
    public boolean mo19937(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
        if (this.f19393.m20714(str2, str3, jsPromptResult)) {
            return true;
        }
        return super.mo19937(webView, str, str2, str3, jsPromptResult);
    }

    @Override
    public void mo19943(WebView webView, String str) {
        super.mo19943(webView, str);
        m19933(webView.getUrl());
    }

    @Override
    public void mo12392(WebView webView, String str) {
        super.mo12392(webView, str);
        this.f19392 = false;
    }

    @Override
    public void mo12393(WebView webView, String str) {
        super.mo12393(webView, str);
        m19933(webView.getUrl());
    }

    public void m19940() {
        m19934("{\"button\":\"single\"}");
    }

    public void m19942() {
        m19934("{\"button\":\"multi\"}");
    }

    public void m19934(String str) {
        this.f19388.m20744("download.click", str);
    }

    public void m19939(String str) {
        if (this.f19392) {
            this.f19388.m20744("report.screenview", str);
            this.f19390 = false;
            return;
        }
        this.f19390 = true;
        this.f19391 = str;
    }

    public void m19941(String str) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("id", str);
        } catch (JSONException e) {
        }
        this.f19388.m20744("extract.cancel", jSONObject.toString());
    }

    private void m19933(String str) {
        if (m19959() != null && !TextUtils.isEmpty(str) && !this.f19392) {
            this.f19392 = true;
            this.f19393.m20718();
            if (this.f19390) {
                this.f19388.m20744("report.screenview", str);
                this.f19390 = false;
            }
            String m20709 = this.f19393.m20709(!(Build.VERSION.SDK_INT >= 19), false, false, cau.m19847());
            if (Build.VERSION.SDK_INT >= 19) {
                try {
                    m19958().evaluateJavascript(m20709, null);
                    return;
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                    m19958().loadUrl(String.format("javascript:%s;", m20709));
                    return;
                }
            }
            m19958().loadUrl(String.format("javascript:%s;", m20709));
        }
    }

    @Override
    public boolean handleMessage(Message message) {
        String str;
        switch (message.what) {
            case 1:
                if (message.arg1 == 1) {
                    this.f19387.sendEmptyMessage(6);
                    return true;
                } else if (message.arg1 == 2) {
                    this.f19387.sendEmptyMessage(16);
                    return true;
                } else if (message.arg1 == 3) {
                    this.f19387.sendEmptyMessage(9);
                    return true;
                } else if (message.arg1 == 5) {
                    this.f19387.sendEmptyMessage(20);
                    return true;
                } else if (message.arg1 == 4) {
                    this.f19387.sendEmptyMessage(21);
                    return true;
                } else {
                    return true;
                }
            case 2:
                this.f19387.obtainMessage(7, message.obj).sendToTarget();
                return true;
            case 3:
                if (message.obj instanceof azt) {
                    this.f19387.obtainMessage(5, ((azt) message.obj).m16147()).sendToTarget();
                    return true;
                }
                return false;
            case 4:
                this.f19387.obtainMessage(17, byl.m19444((JSONObject) message.obj)).sendToTarget();
                return true;
            case 5:
                this.f19387.obtainMessage(18, byf.m19393((JSONObject) message.obj)).sendToTarget();
                return true;
            case 6:
                if (message.obj instanceof azz) {
                    List<azw> m16261 = ((azz) message.obj).m16261();
                    if (m16261 == null || m16261.isEmpty()) {
                        return false;
                    }
                    this.f19387.obtainMessage(19, message.obj).sendToTarget();
                    return true;
                }
                return false;
            case 7:
                if (message.obj == null || !(message.obj instanceof String)) {
                    return false;
                }
                this.f19387.obtainMessage(22, message.obj).sendToTarget();
                return true;
            case 8:
                if (message.obj instanceof azx) {
                    this.f19387.obtainMessage(23, message.obj).sendToTarget();
                    return true;
                }
                return false;
            case 9:
                String str2 = (String) message.obj;
                atv.InterfaceC0314 mo15324 = ((bns) cds.m20403(m19959())).mo15303().mo15324();
                if (mo15324 == null) {
                    str = "";
                } else {
                    str = mo15324.mo15330().mo15299();
                }
                this.f19393.m20716().m20721(str2, !TextUtils.isEmpty(str), str, true);
                return true;
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
            default:
                return false;
            case 16:
                this.f19387.obtainMessage(24, message.obj).sendToTarget();
                return true;
            case 17:
                this.f19387.obtainMessage(25).sendToTarget();
                return true;
            case 18:
                this.f19387.obtainMessage(32).sendToTarget();
                return true;
        }
    }

    public void m19935(byj byjVar, String str) {
        String m19426 = byjVar.m19426();
        cav.m19853("plugin_js_bridge", "sharePickRespond " + m19426);
        this.f19393.m20716().m20721(str, true, m19426, true);
    }
}