Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23

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


package com.my.target;

import android.graphics.Rect;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.ConsoleMessage;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.core.app.NotificationCompat;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.inmobi.media.dl;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.my.target.g5;
import java.net.URI;
import java.util.ArrayList;
import org.json.JSONObject;

public class b5 {

    public final String f6925a;
    public final WebViewClient b = new c();
    public b c;
    public g5 d;
    public boolean e;
    public boolean f;

    public interface b {
        void a(b5 b5Var, WebView webView);

        void a(boolean z);

        boolean a(float f, float f2);

        boolean a(int i, int i2, int i3, int i4, boolean z, int i5);

        boolean a(Uri uri);

        boolean a(ConsoleMessage consoleMessage, b5 b5Var);

        boolean a(String str);

        boolean a(String str, JsResult jsResult);

        boolean a(boolean z, d5 d5Var);

        void b(Uri uri);

        void c();

        void d();

        boolean f();

        void g();
    }

    public class c extends WebViewClient {
        public c() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            b5.this.b();
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            j9.a("MraidBridge: Error - " + str);
            super.onReceivedError(webView, i, str, str2);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
            b5.this.a(webResourceRequest.getUrl());
            return true;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            b5.this.a(Uri.parse(str));
            return true;
        }
    }

    public static class d {
        public static int a(String str) {
            if (str == null) {
                return 53;
            }
            char c = 65535;
            switch (str.hashCode()) {
                case -1364013995:
                    if (str.equals("center")) {
                        c = 1;
                        break;
                    }
                    break;
                case -1314880604:
                    if (str.equals(dl.DEFAULT_POSITION)) {
                        c = 6;
                        break;
                    }
                    break;
                case -1012429441:
                    if (str.equals("top-left")) {
                        c = 0;
                        break;
                    }
                    break;
                case -655373719:
                    if (str.equals("bottom-left")) {
                        c = 2;
                        break;
                    }
                    break;
                case 1163912186:
                    if (str.equals("bottom-right")) {
                        c = 3;
                        break;
                    }
                    break;
                case 1288627767:
                    if (str.equals("bottom-center")) {
                        c = 5;
                        break;
                    }
                    break;
                case 1755462605:
                    if (str.equals("top-center")) {
                        c = 4;
                        break;
                    }
                    break;
            }
            if (c == 0) {
                return 51;
            }
            if (c == 1) {
                return 17;
            }
            if (c == 2) {
                return 83;
            }
            if (c == 3) {
                return 85;
            }
            if (c != 4) {
                return c != 5 ? 53 : 81;
            }
            return 49;
        }
    }

    public class e extends WebChromeClient {
        public e() {
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            j9.a("MraidBridge: JS console message - " + consoleMessage.message() + " - at line " + consoleMessage.lineNumber());
            return b5.this.c != null ? b5.this.c.a(consoleMessage, b5.this) : super.onConsoleMessage(consoleMessage);
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            return b5.this.c != null ? b5.this.c.a(str2, jsResult) : super.onJsAlert(webView, str, str2, jsResult);
        }
    }

    public class f implements g5.a {
        public f() {
        }

        @Override
        public void a(boolean z) {
            if (b5.this.c != null) {
                b5.this.c.a(z);
            }
        }

        @Override
        public void c() {
            if (b5.this.c != null) {
                b5.this.c.c();
            }
        }
    }

    public b5(String str) {
        this.f6925a = str;
    }

    public static b5 b(String str) {
        return new b5(str);
    }

    public final String a(Rect rect) {
        return rect.left + "," + rect.top + "," + rect.width() + "," + rect.height();
    }

    public void a() {
        this.d = null;
    }

    public void a(Uri uri) {
        b bVar;
        String scheme = uri.getScheme();
        String host = uri.getHost();
        if ("mytarget".equals(scheme)) {
            if ("onloadmraidjs".equals(host)) {
                j9.a("MraidBridge: JS call onLoad");
            }
            j9.a("MraidBridge: Got mytarget scheme - " + uri);
            return;
        }
        if (!CampaignEx.JSON_KEY_MRAID.equals(scheme)) {
            try {
                new URI(uri.toString());
                g5 g5Var = this.d;
                if (g5Var == null || !g5Var.g() || (bVar = this.c) == null) {
                    return;
                }
                bVar.b(uri);
                return;
            } catch (Throwable unused) {
                j9.a("MraidBridge: Invalid MRAID URL - " + uri);
                a("", "Mraid command sent an invalid URL");
                return;
            }
        }
        if (host.contains(",")) {
            host = host.substring(0, host.indexOf(",")).trim();
        }
        j9.a("MraidBridge: Got mraid command - " + uri);
        String uri2 = uri.toString();
        JSONObject jSONObject = null;
        c5 c5Var = new c5(host, this.f6925a);
        c(c5Var.toString());
        int indexOf = uri2.indexOf("{");
        int lastIndexOf = uri2.lastIndexOf("}") + 1;
        if (indexOf >= 0 && lastIndexOf > 0 && indexOf < lastIndexOf) {
            try {
                if (lastIndexOf <= uri2.length()) {
                    jSONObject = new JSONObject(uri2.substring(indexOf, lastIndexOf));
                }
            } catch (Throwable th) {
                a(c5Var.toString(), th.getMessage());
                return;
            }
        }
        a(c5Var, jSONObject);
    }

    public void a(b bVar) {
        this.c = bVar;
    }

    public void a(f5 f5Var) {
        a("mraidbridge.setScreenSize(" + b(f5Var.d()) + ");window.mraidbridge.setMaxSize(" + b(f5Var.c()) + ");window.mraidbridge.setCurrentPosition(" + a(f5Var.a()) + ");window.mraidbridge.setDefaultPosition(" + a(f5Var.b()) + ")");
        StringBuilder sb = new StringBuilder();
        sb.append("mraidbridge.fireSizeChangeEvent(");
        sb.append(b(f5Var.a()));
        sb.append(")");
        a(sb.toString());
    }

    public void a(g5 g5Var) {
        this.d = g5Var;
        WebSettings settings = g5Var.getSettings();
        if (settings != null) {
            settings.setJavaScriptEnabled(true);
            if (IronSourceConstants.AD_UNIT_IS_MEDIATION_STATE.equals(this.f6925a)) {
                settings.setMediaPlaybackRequiresUserGesture(false);
            }
        }
        this.d.setScrollContainer(false);
        this.d.setVerticalScrollBarEnabled(false);
        this.d.setHorizontalScrollBarEnabled(false);
        this.d.setWebViewClient(this.b);
        this.d.setWebChromeClient(new e());
        this.d.setVisibilityChangedListener(new f());
    }

    public final void a(String str) {
        if (this.d == null) {
            j9.a("MraidBridge: Attempted to inject Javascript into MRAID WebView while was not attached - \n\t" + str);
            return;
        }
        String str2 = "javascript:window." + str + ";";
        j9.a("MraidBridge: Injecting Javascript into MRAID WebView " + hashCode() + " - " + str2);
        this.d.a(str2);
    }

    public void a(String str, String str2) {
        a("mraidbridge.fireErrorEvent(" + JSONObject.quote(str2) + ", " + JSONObject.quote(str) + ")");
    }

    public void a(ArrayList<String> arrayList) {
        a("mraidbridge.setSupports(" + TextUtils.join(",", arrayList) + ")");
    }

    public void a(boolean z) {
        if (z != this.f) {
            a("mraidbridge.setIsViewable(" + z + ")");
        }
        this.f = z;
    }

    public boolean a(c5 c5Var, JSONObject jSONObject) {
        g5 g5Var;
        String c5Var2 = c5Var.toString();
        if (c5Var.f6938a && (g5Var = this.d) != null && !g5Var.g()) {
            a(c5Var2, "Cannot execute this command unless the user clicks");
            return false;
        }
        if (this.c == null) {
            a(c5Var2, "Invalid state to execute this command");
            return false;
        }
        if (this.d == null) {
            a(c5Var2, "The current WebView is being destroyed");
            return false;
        }
        c5Var2.hashCode();
        char c2 = 65535;
        switch (c5Var2.hashCode()) {
            case -1910759310:
                if (c5Var2.equals("vpaidInit")) {
                    c2 = 0;
                    break;
                }
                break;
            case -1886160473:
                if (c5Var2.equals("playVideo")) {
                    c2 = 1;
                    break;
                }
                break;
            case -1289167206:
                if (c5Var2.equals("expand")) {
                    c2 = 2;
                    break;
                }
                break;
            case -934437708:
                if (c5Var2.equals("resize")) {
                    c2 = 3;
                    break;
                }
                break;
            case -733616544:
                if (c5Var2.equals("createCalendarEvent")) {
                    c2 = 4;
                    break;
                }
                break;
            case 0:
                if (c5Var2.equals("")) {
                    c2 = 5;
                    break;
                }
                break;
            case 3417674:
                if (c5Var2.equals(TtmlNode.TEXT_EMPHASIS_MARK_OPEN)) {
                    c2 = 6;
                    break;
                }
                break;
            case 94756344:
                if (c5Var2.equals("close")) {
                    c2 = 7;
                    break;
                }
                break;
            case 133423073:
                if (c5Var2.equals("setOrientationProperties")) {
                    c2 = '\b';
                    break;
                }
                break;
            case 459238621:
                if (c5Var2.equals("storePicture")) {
                    c2 = '\t';
                    break;
                }
                break;
            case 624734601:
                if (c5Var2.equals("setResizeProperties")) {
                    c2 = '\n';
                    break;
                }
                break;
            case 892543864:
                if (c5Var2.equals("vpaidEvent")) {
                    c2 = 11;
                    break;
                }
                break;
            case 1797992422:
                if (c5Var2.equals("playheadEvent")) {
                    c2 = '\f';
                    break;
                }
                break;
        }
        switch (c2) {
            case 0:
                this.c.g();
                return true;
            case 1:
                j9.a("MraidBridge: playVideo is currently unsupported");
                return false;
            case 2:
                return this.c.a(jSONObject != null ? Uri.parse(jSONObject.getString("url")) : null);
            case 3:
                return this.c.f();
            case 4:
                j9.a("MraidBridge: createCalendarEvent is currently unsupported");
                return false;
            case 5:
                a(c5Var2, "Unspecified MRAID Javascript command");
                return false;
            case 6:
                if (jSONObject == null) {
                    a(c5Var2, "open params cannot be null");
                    return false;
                }
                this.c.b(Uri.parse(jSONObject.getString("url")));
                return true;
            case 7:
                this.c.d();
                return true;
            case '\b':
                if (jSONObject == null) {
                    a(c5Var2, "setOrientationProperties params cannot be null");
                    return false;
                }
                boolean z = jSONObject.getBoolean("allowOrientationChange");
                String string = jSONObject.getString("forceOrientation");
                d5 a2 = d5.a(string);
                if (a2 != null) {
                    return this.c.a(z, a2);
                }
                a(c5Var2, "wrong orientation " + string);
                return false;
            case '\t':
                j9.a("MraidBridge: storePicture is currently unsupported");
                return false;
            case '\n':
                if (jSONObject != null) {
                    return this.c.a(jSONObject.getInt("width"), jSONObject.getInt("height"), jSONObject.getInt("offsetX"), jSONObject.getInt("offsetY"), jSONObject.optBoolean("allowOffscreen", false), d.a(jSONObject.optString("customClosePosition")));
                }
                a(c5Var2, "setResizeProperties params cannot be null");
                return false;
            case 11:
                if (jSONObject != null) {
                    return this.c.a(jSONObject.getString(NotificationCompat.CATEGORY_EVENT));
                }
                a(c5Var2, "vpaidEvent params cannot be null");
                return false;
            case '\f':
                if (jSONObject != null) {
                    return this.c.a((float) jSONObject.getDouble("remain"), (float) jSONObject.getDouble(IronSourceConstants.EVENTS_DURATION));
                }
                a(c5Var2, "playheadEvent params cannot be null");
                return false;
            default:
                return true;
        }
    }

    public final String b(Rect rect) {
        return rect.width() + "," + rect.height();
    }

    public final void b() {
        if (this.e) {
            return;
        }
        this.e = true;
        b bVar = this.c;
        if (bVar != null) {
            bVar.a(this, this.d.getWebView());
        }
    }

    public final void c(String str) {
        a("mraidbridge.nativeComplete(" + JSONObject.quote(str) + ")");
    }

    public boolean c() {
        g5 g5Var = this.d;
        return g5Var != null && g5Var.h();
    }

    public void d() {
        a("mraidbridge.fireReadyEvent()");
    }

    public void d(String str) {
        a("mraidbridge.setPlacementType(" + JSONObject.quote(str) + ")");
    }

    public void e(String str) {
        a("mraidbridge.setState(" + JSONObject.quote(str) + ")");
    }

    public void f(String str) {
        g5 g5Var = this.d;
        if (g5Var == null) {
            j9.a("MraidBridge: MRAID bridge called setContentHtml before WebView was attached");
        } else {
            this.e = false;
            g5Var.a("https://ad.mail.ru/", str, "text/html", "UTF-8", null);
        }
    }
}