导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - UrlAction.java 源代码

正在查看: BetterTogether v3.0.0 应用的 UrlAction.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mopub.common;

import a0.g0;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.google.android.gms.measurement.AppMeasurement;
import com.google.firebase.iid.YdH.laTObzJtIQ;
import com.mopub.common.Constants;
import com.mopub.common.MoPub;
import com.mopub.common.Preconditions;
import com.mopub.common.UrlHandler;
import com.mopub.common.logging.MoPubLog;
import com.mopub.common.util.Intents;
import com.mopub.exceptions.IntentNotResolvableException;
import com.mopub.exceptions.UrlParseException;
import com.mopub.network.TrackingRequest;
import ek.bMsI.PYSJ;
import java.net.URISyntaxException;
import java.util.List;

public abstract class UrlAction {
    public static final UrlAction FOLLOW_DEEP_LINK;
    public static final UrlAction FOLLOW_DEEP_LINK_WITH_FALLBACK;
    public static final UrlAction HANDLE_MOPUB_SCHEME;
    public static final UrlAction HANDLE_PHONE_SCHEME;
    public static final UrlAction HANDLE_SHARE_TWEET;
    public static final UrlAction IGNORE_ABOUT_SCHEME;
    public static final UrlAction NOOP;
    public static final UrlAction OPEN_APP_MARKET;
    public static final UrlAction OPEN_IN_APP_BROWSER;
    public static final UrlAction OPEN_NATIVE_BROWSER;
    public static final UrlAction[] e;
    public final boolean d;

    static {
        UrlAction urlAction = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                String host = uri.getHost();
                UrlHandler.MoPubSchemeListener moPubSchemeListener = urlHandler.c;
                if ("finishLoad".equalsIgnoreCase(host)) {
                    moPubSchemeListener.onFinishLoad();
                    return;
                }
                if ("close".equalsIgnoreCase(host)) {
                    moPubSchemeListener.onClose();
                } else if ("failLoad".equalsIgnoreCase(host)) {
                    moPubSchemeListener.onFailLoad();
                } else {
                    if (!AppMeasurement.CRASH_ORIGIN.equals(host)) {
                        throw new IntentNotResolvableException(g0.h("Could not handle MoPub Scheme url: ", uri));
                    }
                    moPubSchemeListener.onCrash();
                }
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return "mopub".equalsIgnoreCase(uri.getScheme());
            }
        };
        HANDLE_MOPUB_SCHEME = urlAction;
        UrlAction urlAction2 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, "Link to about page ignored.");
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return "about".equalsIgnoreCase(uri.getScheme());
            }
        };
        IGNORE_ABOUT_SCHEME = urlAction2;
        UrlAction urlAction3 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                Intents.launchActionViewIntent(context, uri, PYSJ.OZpwq + uri + "\n\tIs this intent supported on your phone?");
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                String scheme = uri.getScheme();
                return laTObzJtIQ.ooieypQtzhcJlO.equalsIgnoreCase(scheme) || "voicemail".equalsIgnoreCase(scheme) || "sms".equalsIgnoreCase(scheme) || "mailto".equalsIgnoreCase(scheme) || "geo".equalsIgnoreCase(scheme) || "google.streetview".equalsIgnoreCase(scheme);
            }
        };
        HANDLE_PHONE_SCHEME = urlAction3;
        UrlAction urlAction4 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                String h = g0.h("Unable to load mopub native browser url: ", uri);
                try {
                    Intents.launchIntentForUserClick(context, Intents.intentForNativeBrowserScheme(uri), h);
                } catch (UrlParseException e2) {
                    StringBuilder m = og.m.m(h, "\n\t");
                    m.append(e2.getMessage());
                    throw new IntentNotResolvableException(m.toString());
                }
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                String scheme = uri.getScheme();
                return "https".equalsIgnoreCase(scheme) ? MoPub.getBrowserAgent() == MoPub.BrowserAgent.NATIVE : "mopubnativebrowser".equalsIgnoreCase(scheme);
            }
        };
        OPEN_NATIVE_BROWSER = urlAction4;
        UrlAction urlAction5 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                Intents.launchApplicationUrl(context, uri);
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                String scheme = uri.getScheme();
                String host = uri.getHost();
                return "play.google.com".equalsIgnoreCase(host) || "market.android.com".equalsIgnoreCase(host) || "market".equalsIgnoreCase(scheme) || uri.toString().toLowerCase().startsWith("play.google.com/") || uri.toString().toLowerCase().startsWith("market.android.com/");
            }
        };
        OPEN_APP_MARKET = urlAction5;
        UrlAction urlAction6 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                if (urlHandler.e) {
                    return;
                }
                Intents.showMoPubBrowserForUrl(context, uri, str);
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return "https".equalsIgnoreCase(uri.getScheme());
            }
        };
        OPEN_IN_APP_BROWSER = urlAction6;
        UrlAction urlAction7 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                Preconditions.checkNotNull(context);
                Preconditions.checkNotNull(uri);
                String str2 = "Could not handle share tweet intent with URI " + uri;
                try {
                    Intents.launchIntentForUserClick(context, Intent.createChooser(Intents.intentForShareTweet(uri), "Share via"), str2);
                } catch (UrlParseException e2) {
                    StringBuilder m = og.m.m(str2, "\n\t");
                    m.append(e2.getMessage());
                    throw new IntentNotResolvableException(m.toString());
                }
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                Preconditions.checkNotNull(uri);
                return "mopubshare".equalsIgnoreCase(uri.getScheme()) && "tweet".equalsIgnoreCase(uri.getHost());
            }
        };
        HANDLE_SHARE_TWEET = urlAction7;
        UrlAction urlAction8 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                if (!"navigate".equalsIgnoreCase(uri.getHost())) {
                    throw new IntentNotResolvableException("Deeplink+ URL did not have 'navigate' as the host.");
                }
                try {
                    String queryParameter = uri.getQueryParameter("primaryUrl");
                    List<String> queryParameters = uri.getQueryParameters("primaryTrackingUrl");
                    String queryParameter2 = uri.getQueryParameter("fallbackUrl");
                    List<String> queryParameters2 = uri.getQueryParameters("fallbackTrackingUrl");
                    if (queryParameter == null) {
                        throw new IntentNotResolvableException("Deeplink+ did not have 'primaryUrl' query param.");
                    }
                    Uri parse = Uri.parse(queryParameter);
                    if (shouldTryHandlingUrl(parse)) {
                        throw new IntentNotResolvableException("Deeplink+ had another Deeplink+ as the 'primaryUrl'.");
                    }
                    try {
                        Intents.launchApplicationUrl(context, parse);
                        TrackingRequest.makeTrackingHttpRequest(queryParameters, context);
                    } catch (IntentNotResolvableException unused) {
                        if (queryParameter2 == null) {
                            throw new IntentNotResolvableException("Unable to handle 'primaryUrl' for Deeplink+ and 'fallbackUrl' was missing.");
                        }
                        if (shouldTryHandlingUrl(Uri.parse(queryParameter2))) {
                            throw new IntentNotResolvableException("Deeplink+ URL had another Deeplink+ URL as the 'fallbackUrl'.");
                        }
                        urlHandler.handleUrl(context, queryParameter2, true, queryParameters2);
                    }
                } catch (UnsupportedOperationException unused2) {
                    throw new IntentNotResolvableException("Deeplink+ URL was not a hierarchical URI.");
                }
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return "deeplink+".equalsIgnoreCase(uri.getScheme());
            }
        };
        FOLLOW_DEEP_LINK_WITH_FALLBACK = urlAction8;
        UrlAction urlAction9 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
                if (!Constants.INTENT_SCHEME.equalsIgnoreCase(uri.getScheme())) {
                    Intents.launchApplicationUrl(context, uri);
                    return;
                }
                try {
                    Intents.launchApplicationIntent(context, Intent.parseUri(uri.toString(), 1));
                } catch (URISyntaxException unused) {
                    throw new IntentNotResolvableException("Intent uri had invalid syntax: " + uri.toString());
                }
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return !TextUtils.isEmpty(uri.getScheme());
            }
        };
        FOLLOW_DEEP_LINK = urlAction9;
        UrlAction urlAction10 = new UrlAction() {
            @Override
            public final void a(Context context, Uri uri, UrlHandler urlHandler, String str) {
            }

            @Override
            public boolean shouldTryHandlingUrl(Uri uri) {
                return false;
            }
        };
        NOOP = urlAction10;
        e = new UrlAction[]{urlAction, urlAction2, urlAction3, urlAction4, urlAction5, urlAction6, urlAction7, urlAction8, urlAction9, urlAction10};
    }

    public UrlAction(String str, int i, boolean z) {
        this.d = z;
    }

    public static UrlAction valueOf(String str) {
        return (UrlAction) Enum.valueOf(UrlAction.class, str);
    }

    public static UrlAction[] values() {
        return (UrlAction[]) e.clone();
    }

    public abstract void a(Context context, Uri uri, UrlHandler urlHandler, String str);

    public void handleUrl(UrlHandler urlHandler, Context context, Uri uri, boolean z, String str) throws IntentNotResolvableException {
        MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, g0.h("Ad event URL: ", uri));
        if (this.d && !z) {
            throw new IntentNotResolvableException("Attempted to handle action without user interaction.");
        }
        a(context, uri, urlHandler, str);
    }

    public abstract boolean shouldTryHandlingUrl(Uri uri);
}