MD5 校验值:d7f913ab91d7343430e85d5ce2e5aff0
UrlAction.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.mopub.common; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.text.TextUtils; import com.huawei.hms.framework.common.hianalytics.CrashHianalyticsData; import com.mopub.common.BrowserAgentManager; 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 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[] f18657b; public final boolean f18658a; public enum b extends UrlAction { public b(String str, int i10, boolean z10) { super(str, i10, z10, null); } @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { String host = uri.getHost(); UrlHandler.MoPubSchemeListener moPubSchemeListener = urlHandler.f18663c; if ("finishLoad".equalsIgnoreCase(host)) { moPubSchemeListener.onFinishLoad(); return; } if ("close".equalsIgnoreCase(host)) { moPubSchemeListener.onClose(); return; } if ("failLoad".equalsIgnoreCase(host)) { moPubSchemeListener.onFailLoad(); } else { if (CrashHianalyticsData.EVENT_ID_CRASH.equals(host)) { moPubSchemeListener.onCrash(); return; } throw new IntentNotResolvableException("Could not handle MoPub Scheme url: " + uri); } } @Override public boolean shouldTryHandlingUrl(Uri uri) { return "mopub".equalsIgnoreCase(uri.getScheme()); } } static { boolean z10 = false; b bVar = new b("HANDLE_MOPUB_SCHEME", 0, false); HANDLE_MOPUB_SCHEME = bVar; UrlAction urlAction = new UrlAction("IGNORE_ABOUT_SCHEME", 1, z10) { @Override public 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 = urlAction; UrlAction urlAction2 = new UrlAction("HANDLE_PHONE_SCHEME", 2, 1 == true ? 1 : 0) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { Intents.launchActionViewIntent(context, uri, "Could not handle intent with URI: " + uri + "\n\tIs this intent supported on your phone?"); } @Override public boolean shouldTryHandlingUrl(Uri uri) { String scheme = uri.getScheme(); return "tel".equalsIgnoreCase(scheme) || "voicemail".equalsIgnoreCase(scheme) || "sms".equalsIgnoreCase(scheme) || "mailto".equalsIgnoreCase(scheme) || "geo".equalsIgnoreCase(scheme) || "google.streetview".equalsIgnoreCase(scheme); } }; HANDLE_PHONE_SCHEME = urlAction2; UrlAction urlAction3 = new UrlAction("OPEN_NATIVE_BROWSER", 3, 1 == true ? 1 : 0) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { String str2 = "Unable to load mopub native browser url: " + uri; try { Intents.launchIntentForUserClick(context, Intents.intentForNativeBrowserScheme(uri), str2); } catch (UrlParseException e10) { StringBuilder a10 = u.f.a(str2, "\n\t"); a10.append(e10.getMessage()); throw new IntentNotResolvableException(a10.toString()); } } @Override public boolean shouldTryHandlingUrl(Uri uri) { String scheme = uri.getScheme(); return Constants.HTTPS.equalsIgnoreCase(scheme) ? BrowserAgentManager.getBrowserAgent() == BrowserAgentManager.BrowserAgent.NATIVE : "mopubnativebrowser".equalsIgnoreCase(scheme); } }; OPEN_NATIVE_BROWSER = urlAction3; UrlAction urlAction4 = new UrlAction("OPEN_APP_MARKET", 4, 1 == true ? 1 : 0) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { Intents.launchApplicationUrl(context, uri); } @Override public boolean shouldTryHandlingUrl(Uri uri) { if (!uri.isHierarchical()) { return false; } String scheme = uri.getScheme(); String host = uri.getHost(); boolean z11 = "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/"); String queryParameter = uri.getQueryParameter("id"); return (!z11 || TextUtils.isEmpty(queryParameter) || "null".equals(queryParameter)) ? false : true; } }; OPEN_APP_MARKET = urlAction4; UrlAction urlAction5 = new UrlAction("OPEN_IN_APP_BROWSER", 5, 1 == true ? 1 : 0) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { if (urlHandler.f18665e) { return; } Intents.showMoPubBrowserForUrl(context, uri, str); } @Override public boolean shouldTryHandlingUrl(Uri uri) { return Constants.HTTPS.equalsIgnoreCase(uri.getScheme()); } }; OPEN_IN_APP_BROWSER = urlAction5; UrlAction urlAction6 = new UrlAction("HANDLE_SHARE_TWEET", 6, 1 == true ? 1 : 0) { @Override public 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 e10) { StringBuilder a10 = u.f.a(str2, "\n\t"); a10.append(e10.getMessage()); throw new IntentNotResolvableException(a10.toString()); } } @Override public boolean shouldTryHandlingUrl(Uri uri) { Preconditions.checkNotNull(uri); return "mopubshare".equalsIgnoreCase(uri.getScheme()) && "tweet".equalsIgnoreCase(uri.getHost()); } }; HANDLE_SHARE_TWEET = urlAction6; UrlAction urlAction7 = new UrlAction("FOLLOW_DEEP_LINK_WITH_FALLBACK", 7, 1 == true ? 1 : 0) { @Override public 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'."); } if (Intents.canLaunchApplicationUrl(context, parse)) { Intents.launchApplicationUrl(context, parse); TrackingRequest.makeTrackingHttpRequest(queryParameters, context); } else { 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 unused) { 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 = urlAction7; UrlAction urlAction8 = new UrlAction("FOLLOW_DEEP_LINK", 8, 1 == true ? 1 : 0) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { if (!"intent".equalsIgnoreCase(uri.getScheme())) { Intents.launchApplicationUrl(context, uri); return; } try { Intents.launchApplicationIntent(context, Intent.parseUri(uri.toString(), 1)); } catch (URISyntaxException unused) { StringBuilder a10 = android.support.v4.media.b.a("Intent uri had invalid syntax: "); a10.append(uri.toString()); throw new IntentNotResolvableException(a10.toString()); } } @Override public boolean shouldTryHandlingUrl(Uri uri) { return !TextUtils.isEmpty(uri.getScheme()); } }; FOLLOW_DEEP_LINK = urlAction8; UrlAction urlAction9 = new UrlAction("NOOP", 9, z10) { @Override public void a(Context context, Uri uri, UrlHandler urlHandler, String str) { } @Override public boolean shouldTryHandlingUrl(Uri uri) { return false; } }; NOOP = urlAction9; f18657b = new UrlAction[]{bVar, urlAction, urlAction2, urlAction3, urlAction4, urlAction5, urlAction6, urlAction7, urlAction8, urlAction9}; } public UrlAction(String str, int i10, boolean z10, b bVar) { this.f18658a = z10; } public static UrlAction valueOf(String str) { return (UrlAction) Enum.valueOf(UrlAction.class, str); } public static UrlAction[] values() { return (UrlAction[]) f18657b.clone(); } public abstract void a(Context context, Uri uri, UrlHandler urlHandler, String str); public void handleUrl(UrlHandler urlHandler, Context context, Uri uri, boolean z10, String str) { MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, "Ad event URL: " + uri); if (this.f18658a && !z10) { throw new IntentNotResolvableException("Attempted to handle action without user interaction."); } a(context, uri, urlHandler, str); } public abstract boolean shouldTryHandlingUrl(Uri uri); }