- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
213 lines
8.8 KiB
Java
213 lines
8.8 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.PackageManager;
|
|
import android.graphics.Color;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.webkit.URLUtil;
|
|
import com.applovin.impl.sdk.utils.CollectionUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.sdk.AppLovinWebViewActivity;
|
|
import com.facebook.share.internal.ShareConstants;
|
|
import com.google.android.gms.drive.DriveFile;
|
|
import com.tapjoy.TapjoyConstants;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class tp {
|
|
public static boolean b(Uri uri) {
|
|
return uri != null && "applovin".equalsIgnoreCase(uri.getScheme()) && "com.applovin.sdk".equalsIgnoreCase(uri.getHost()) && "/adservice/deeplink".equals(uri.getPath());
|
|
}
|
|
|
|
public class a extends p {
|
|
final /* synthetic */ String a;
|
|
final /* synthetic */ com.applovin.impl.adview.a b;
|
|
final /* synthetic */ com.applovin.impl.sdk.j c;
|
|
|
|
public a(String str, com.applovin.impl.adview.a aVar, com.applovin.impl.sdk.j jVar) {
|
|
this.a = str;
|
|
this.b = aVar;
|
|
this.c = jVar;
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityCreated(Activity activity, Bundle bundle) {
|
|
if (activity instanceof AppLovinWebViewActivity) {
|
|
((AppLovinWebViewActivity) activity).loadUrl(this.a, null);
|
|
gc.c(this.b.e(), this.b.i(), this.b.k());
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityDestroyed(Activity activity) {
|
|
if (activity instanceof AppLovinWebViewActivity) {
|
|
gc.a(this.b.e(), this.b.i(), this.b.k());
|
|
this.c.e().b(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void a(Uri uri, com.applovin.impl.sdk.ad.b bVar, com.applovin.impl.sdk.j jVar) {
|
|
String queryParameter = uri.getQueryParameter(com.ironsource.nb.q);
|
|
if (URLUtil.isValidUrl(queryParameter)) {
|
|
jVar.X().e(com.applovin.impl.sdk.network.d.b().d(StringUtils.appendQueryParameter(queryParameter, "clcode", bVar.getClCode())).a(false).b(Boolean.parseBoolean(uri.getQueryParameter("fire_from_webview"))).a());
|
|
return;
|
|
}
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().b("UriUtils", "Could not find postback url to fire from query in original uri: " + uri);
|
|
}
|
|
}
|
|
|
|
public static void b(Uri uri, com.applovin.impl.sdk.ad.b bVar, com.applovin.impl.sdk.j jVar) {
|
|
String emptyIfNull = StringUtils.emptyIfNull(uri.getQueryParameter("error"));
|
|
String emptyIfNull2 = StringUtils.emptyIfNull(uri.getQueryParameter("exception"));
|
|
String emptyIfNull3 = StringUtils.emptyIfNull(uri.getQueryParameter("details"));
|
|
HashMap<String, String> hashMap = CollectionUtils.hashMap(ShareConstants.FEED_SOURCE_PARAM, emptyIfNull);
|
|
CollectionUtils.putStringIfValid("top_main_method", emptyIfNull2, hashMap);
|
|
CollectionUtils.putStringIfValid("details", emptyIfNull3, hashMap);
|
|
if (bVar != null) {
|
|
hashMap.putAll(ma.a(bVar));
|
|
}
|
|
jVar.E().a(la.S, (Map) hashMap);
|
|
}
|
|
|
|
public static Bundle a(Uri uri) {
|
|
Bundle bundle = new Bundle();
|
|
for (String str : uri.getQueryParameterNames()) {
|
|
bundle.putString(str, uri.getQueryParameter(str));
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
private static boolean a(Context context) {
|
|
try {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
packageManager.getPackageInfo("com.android.vending", 1);
|
|
int applicationEnabledSetting = packageManager.getApplicationEnabledSetting("com.android.vending");
|
|
return applicationEnabledSetting == 2 || applicationEnabledSetting == 3;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static void a(Uri uri, com.applovin.impl.adview.a aVar, com.applovin.impl.sdk.j jVar) {
|
|
com.applovin.impl.adview.b g = aVar.g();
|
|
String queryParameter = uri.getQueryParameter(com.ironsource.nb.q);
|
|
if (TextUtils.isEmpty(queryParameter)) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().b("UriUtils", "Could not find url to load from query in original uri");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
String queryParameter2 = uri.getQueryParameter("load_type");
|
|
if (com.ironsource.u3.e.equalsIgnoreCase(queryParameter2)) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Loading new page externally: " + queryParameter);
|
|
}
|
|
a(queryParameter, aVar, jVar);
|
|
return;
|
|
}
|
|
if (TapjoyConstants.LOG_LEVEL_INTERNAL.equalsIgnoreCase(queryParameter2)) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Loading new page in WebView: " + queryParameter);
|
|
}
|
|
g.loadUrl(queryParameter);
|
|
String queryParameter3 = uri.getQueryParameter("bg_color");
|
|
if (StringUtils.isValidString(queryParameter3)) {
|
|
g.setBackgroundColor(Color.parseColor(queryParameter3));
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if ("in_app".equalsIgnoreCase(queryParameter2)) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Loading new page in slide-up webview: " + queryParameter);
|
|
}
|
|
jVar.e().a(new a(queryParameter, aVar, jVar));
|
|
Intent intent = new Intent(com.applovin.impl.sdk.j.l(), (Class<?>) AppLovinWebViewActivity.class);
|
|
intent.putExtra(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, jVar.b0());
|
|
intent.setFlags(DriveFile.MODE_READ_ONLY);
|
|
com.applovin.impl.sdk.j.l().startActivity(intent);
|
|
return;
|
|
}
|
|
if ("in_app_v2".equalsIgnoreCase(queryParameter2)) {
|
|
aVar.a(aVar.i(), aVar.k(), (Uri) null, g.getAndClearLastClickEvent(), (Bundle) null);
|
|
if (aVar.j() != null) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Loading new page in Custom Tabs: " + queryParameter);
|
|
}
|
|
jVar.x().a(queryParameter, aVar, jVar.n0());
|
|
return;
|
|
}
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Custom Tabs not supported, loading new page externally: " + queryParameter);
|
|
}
|
|
a(queryParameter, aVar, jVar);
|
|
return;
|
|
}
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().b("UriUtils", "Could not find load type in original uri");
|
|
}
|
|
}
|
|
|
|
public static boolean a(Uri uri, Context context, com.applovin.impl.sdk.j jVar) {
|
|
boolean z = false;
|
|
if (uri == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().d("UriUtils", "Opening URI: " + uri);
|
|
}
|
|
Intent intent = new Intent("android.intent.action.VIEW", uri);
|
|
if (!(context instanceof Activity)) {
|
|
intent.setFlags(DriveFile.MODE_READ_ONLY);
|
|
}
|
|
if ("market".equals(intent.getScheme()) || "play.google.com".equals(uri.getHost())) {
|
|
if (((Boolean) jVar.a(sj.w6)).booleanValue() && a(context)) {
|
|
intent.setPackage(null);
|
|
} else {
|
|
intent.setPackage("com.android.vending");
|
|
}
|
|
}
|
|
jVar.f0().pauseForClick();
|
|
context.startActivity(intent);
|
|
z = true;
|
|
} catch (Throwable th) {
|
|
jVar.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
jVar.J().a("UriUtils", "Unable to open \"" + uri + "\".", th);
|
|
}
|
|
HashMap<String, String> hashMap = CollectionUtils.hashMap("url", uri.toString());
|
|
if ("play.google.com".equals(uri.getHost())) {
|
|
CollectionUtils.putStringIfValid("details", (String) jVar.y().G().get("ps_version"), hashMap);
|
|
}
|
|
jVar.E().a("UriUtils", "openUri", th, hashMap);
|
|
}
|
|
if (!z) {
|
|
jVar.f0().resumeForClick();
|
|
}
|
|
return z;
|
|
}
|
|
|
|
private static void a(String str, com.applovin.impl.adview.a aVar, com.applovin.impl.sdk.j jVar) {
|
|
a(Uri.parse(str), aVar.g().getContext(), jVar);
|
|
gc.b(aVar.e(), aVar.i(), aVar.k());
|
|
}
|
|
}
|