GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5

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


package com.amazon.device.ads;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.exoplayer2.C;
import com.google.android.gms.common.internal.ImagesContract;
import java.io.IOException;
import java.util.Locale;

public class DTBAdViewSupportClient extends WebViewClient {
    static final String AMAZON_APP_STORE_LINK = "https://www.amazon.com/gp/mas/dl/android?";
    static final String AMAZON_SCHEME = "amzn";
    static final String GOOGLE_PLAY_STORE_LINK = "https://play.google.com/store/apps/";
    static final String LOG_TAG = DTBAdViewSupportClient.class.getSimpleName();
    static final String MARKET_SCHEME = "market";
    static final String MOBILE_SHOPPING_SCHEME = "com.amazon.mobile.shopping";
    static final String MOBILE_SHOPPING_WEB_SCHEME = "com.amazon.mobile.shopping.web";
    Context context;
    DTBAdMRAIDController controller;

    public DTBAdViewSupportClient(Context context, DTBAdMRAIDController dTBAdMRAIDController) {
        this.context = context;
        this.controller = dTBAdMRAIDController;
    }

    @Override
    public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
        DtbLog.debug(LOG_TAG, "Should intercept Resource url: " + str);
        if (matchesLocalInjectionUrl(str)) {
            return createImageInjectionResponse(str.substring(str.lastIndexOf(47) + 1));
        }
        return super.shouldInterceptRequest(webView, str);
    }

    private boolean matchesLocalInjectionUrl(String str) {
        return ImagesContract.LOCAL.equals(Uri.parse(str.toLowerCase(Locale.US)).getScheme());
    }

    private WebResourceResponse createImageInjectionResponse(String str) {
        try {
            return new WebResourceResponse("image/png", C.UTF8_NAME, this.context.getAssets().open(str));
        } catch (IOException unused) {
            DtbLog.error(LOG_TAG, "Failed to get injection response: " + str);
            return null;
        }
    }

    private WebResourceResponse createInjectionResponse(String str) {
        try {
            return new WebResourceResponse("text/javascript", C.UTF8_NAME, this.context.getAssets().open(str));
        } catch (IOException unused) {
            DtbLog.error(LOG_TAG, "Failed to get injection response: " + str);
            return null;
        }
    }

    @Override
    public void onPageFinished(WebView webView, String str) {
        DtbLog.debug(LOG_TAG, "Page finished:" + str);
        if (webView instanceof DTBAdView) {
            if (str.contains("MRAID_ENV")) {
                this.controller.onPageLoad();
            } else if (str.equals("https://c.amazon-adsystem.com/")) {
                this.controller.onPageLoad();
            }
        }
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView webView, String str) {
        if (this.controller.isTwoPartExpand()) {
            return false;
        }
        return openUrl(str);
    }

    @Override
    public void onLoadResource(WebView webView, String str) {
        DtbLog.debug(LOG_TAG, "Load Resource:" + str);
    }

    private boolean openUrl(String str) {
        Intent intent;
        int indexOf;
        int i;
        Uri parse = Uri.parse(str);
        PackageManager packageManager = this.context.getPackageManager();
        if (MOBILE_SHOPPING_WEB_SCHEME.equals(parse.getScheme()) && (indexOf = str.indexOf("//")) >= 0 && (i = indexOf + 2) < str.length()) {
            AdRegistration.getCurrentActivity().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://" + str.substring(i))));
            this.controller.onAdLeftApplication();
            return true;
        }
        try {
            if (MOBILE_SHOPPING_SCHEME.equals(parse.getScheme())) {
                if (packageManager.getLaunchIntentForPackage("com.amazon.mShop.android.shopping") != null) {
                    intent = new Intent("android.intent.action.VIEW");
                    intent.setData(parse);
                } else {
                    Intent intent2 = new Intent("android.intent.action.VIEW");
                    intent2.setData(parse);
                    int indexOf2 = str.indexOf("products/");
                    if (indexOf2 > 0) {
                        intent2.setData(Uri.parse("https://www.amazon.com/dp/" + str.substring(indexOf2 + 9)));
                    }
                    intent = intent2;
                }
                AdRegistration.getCurrentActivity().startActivity(intent);
                this.controller.onAdLeftApplication();
                return true;
            }
            if (!"market".equals(parse.getScheme()) && !AMAZON_SCHEME.equals(parse.getScheme())) {
                Intent intent3 = new Intent("android.intent.action.VIEW");
                intent3.setData(parse);
                AdRegistration.getCurrentActivity().startActivity(intent3);
                this.controller.onAdLeftApplication();
                return true;
            }
            try {
                try {
                    Intent intent4 = new Intent("android.intent.action.VIEW");
                    intent4.setData(parse);
                    AdRegistration.getCurrentActivity().startActivity(intent4);
                    this.controller.onAdLeftApplication();
                    return true;
                } catch (ActivityNotFoundException unused) {
                    DtbLog.debug(LOG_TAG, "App stores and browsers not found");
                    return false;
                }
            } catch (ActivityNotFoundException unused2) {
                DTBAdUtil.directAppStoreLinkToBrowser(this.controller, parse);
                return true;
            }
        } catch (ActivityNotFoundException unused3) {
            DtbLog.error(LOG_TAG, "Activity not found com.amazon.mobile.shopping");
            return false;
        }
    }

    @Override
    public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
        super.onReceivedError(webView, webResourceRequest, webResourceError);
        if (Build.VERSION.SDK_INT >= 23) {
            this.controller.onLoadError(webResourceError.getDescription().toString(), webResourceError.getErrorCode());
        } else {
            this.controller.onLoadError();
        }
    }
}