- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
332 lines
12 KiB
Java
332 lines
12 KiB
Java
package com.mbridge.msdk.foundation.webview;
|
||
|
||
import android.content.Context;
|
||
import android.content.Intent;
|
||
import android.graphics.Bitmap;
|
||
import android.net.Uri;
|
||
import android.os.Handler;
|
||
import android.os.Looper;
|
||
import android.text.TextUtils;
|
||
import android.webkit.WebView;
|
||
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
|
||
import com.google.android.gms.drive.DriveFile;
|
||
import com.mbridge.msdk.activity.MBCommonActivity;
|
||
import com.mbridge.msdk.c.g;
|
||
import com.mbridge.msdk.c.h;
|
||
import com.mbridge.msdk.c.i;
|
||
import com.mbridge.msdk.click.entity.JumpLoaderResult;
|
||
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
||
import com.mbridge.msdk.foundation.tools.af;
|
||
import com.mbridge.msdk.foundation.tools.aj;
|
||
import com.mbridge.msdk.foundation.webview.BrowserView;
|
||
import com.mbridge.msdk.out.BaseTrackingListener;
|
||
import java.util.ArrayList;
|
||
|
||
/* loaded from: classes4.dex */
|
||
public class a implements BrowserView.a {
|
||
private static String a = "a";
|
||
private int b;
|
||
private String d;
|
||
private boolean e;
|
||
private BaseTrackingListener f;
|
||
private BrowserView g;
|
||
private CampaignEx h;
|
||
private com.mbridge.msdk.click.a i;
|
||
private Context j;
|
||
private JumpLoaderResult l;
|
||
private long o;
|
||
private boolean c = true;
|
||
private boolean m = false;
|
||
private final Runnable n = new Runnable() { // from class: com.mbridge.msdk.foundation.webview.a.1
|
||
@Override // java.lang.Runnable
|
||
public final void run() {
|
||
af.b(a.a, "webview js!超时上限:" + a.this.b + "ms");
|
||
if (a.this.i != null && a.this.l != null) {
|
||
a.this.l.setSuccess(false);
|
||
a.this.l.setUrl(a.this.d);
|
||
a.this.l.setType(2);
|
||
a.this.l.setExceptionMsg("linktype 8 time out");
|
||
a.this.i.a(a.this.l, a.this.h, 1, false);
|
||
}
|
||
a aVar = a.this;
|
||
if (aVar.d(null, aVar.d) && !a.this.m) {
|
||
a.this.m = true;
|
||
a aVar2 = a.this;
|
||
aVar2.a(aVar2.j, a.this.d, a.this.h);
|
||
}
|
||
if (a.this.f != null) {
|
||
a.this.f.onFinishRedirection(a.this.h, a.this.d);
|
||
}
|
||
}
|
||
};
|
||
private Handler k = new Handler(Looper.getMainLooper());
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final void a() {
|
||
}
|
||
|
||
public a(Context context, CampaignEx campaignEx, com.mbridge.msdk.click.a aVar, BrowserView browserView, BaseTrackingListener baseTrackingListener) {
|
||
this.b = 10000;
|
||
this.l = null;
|
||
this.j = context;
|
||
this.h = campaignEx;
|
||
this.g = browserView;
|
||
this.f = baseTrackingListener;
|
||
g b = h.a().b(com.mbridge.msdk.foundation.controller.c.m().k());
|
||
if (b == null) {
|
||
h.a();
|
||
b = i.a();
|
||
}
|
||
this.i = aVar;
|
||
this.l = new JumpLoaderResult();
|
||
this.b = (int) b.ar();
|
||
}
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final void a(WebView webView, String str) {
|
||
if (this.o == 0) {
|
||
this.o = System.currentTimeMillis();
|
||
if (!this.e) {
|
||
this.e = true;
|
||
d();
|
||
}
|
||
}
|
||
this.d = str;
|
||
this.c = true;
|
||
}
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final void a(WebView webView, String str, Bitmap bitmap) {
|
||
if (this.o == 0) {
|
||
this.o = System.currentTimeMillis();
|
||
if (!this.e) {
|
||
this.e = true;
|
||
d();
|
||
}
|
||
this.m = false;
|
||
}
|
||
this.d = str;
|
||
this.c = true;
|
||
}
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final boolean b(WebView webView, final String str) {
|
||
af.b(a, "shouldOverrideUrlLoading1 " + str);
|
||
this.c = false;
|
||
if (aj.a.b(str) && aj.a.a(this.j, str, null)) {
|
||
this.m = true;
|
||
}
|
||
boolean e = e(webView, str);
|
||
if (e) {
|
||
this.o = 0L;
|
||
this.c = false;
|
||
c();
|
||
com.mbridge.msdk.foundation.same.f.a.e().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.webview.a.2
|
||
@Override // java.lang.Runnable
|
||
public final void run() {
|
||
if (a.this.i != null && a.this.l != null) {
|
||
a.this.l.setSuccess(true);
|
||
a.this.l.setUrl(str);
|
||
a.this.l.setType(2);
|
||
a.this.i.a(a.this.l, a.this.h, 1, true);
|
||
}
|
||
if (a.this.f != null) {
|
||
a.this.f.onFinishRedirection(a.this.h, str);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
return e;
|
||
}
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final void c(WebView webView, final String str) {
|
||
af.b(a, "onPageFinished1 " + str);
|
||
if (this.c) {
|
||
this.o = 0L;
|
||
this.c = false;
|
||
com.mbridge.msdk.foundation.same.f.a.e().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.webview.a.3
|
||
@Override // java.lang.Runnable
|
||
public final void run() {
|
||
if (a.this.f != null) {
|
||
a.this.f.onFinishRedirection(a.this.h, str);
|
||
}
|
||
if (a.this.i == null || a.this.l == null) {
|
||
return;
|
||
}
|
||
a.this.l.setSuccess(true);
|
||
a.this.l.setUrl(str);
|
||
a.this.l.setType(2);
|
||
a.this.i.a(a.this.l, a.this.h, 1, true);
|
||
}
|
||
});
|
||
if (TextUtils.isEmpty(str)) {
|
||
return;
|
||
}
|
||
c();
|
||
Uri parse = Uri.parse(str);
|
||
if ((parse.getScheme().equals("http") || parse.getScheme().equals("https")) && !this.m) {
|
||
this.m = true;
|
||
a(this.j, str, this.h);
|
||
}
|
||
}
|
||
}
|
||
|
||
@Override // com.mbridge.msdk.foundation.webview.BrowserView.a
|
||
public final void a(WebView webView, int i, final String str, final String str2) {
|
||
af.d(a, str);
|
||
c();
|
||
com.mbridge.msdk.foundation.same.f.a.e().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.webview.a.4
|
||
@Override // java.lang.Runnable
|
||
public final void run() {
|
||
if (a.this.f != null) {
|
||
a.this.f.onFinishRedirection(a.this.h, str2);
|
||
}
|
||
if (a.this.i == null || a.this.l == null) {
|
||
return;
|
||
}
|
||
a.this.l.setSuccess(false);
|
||
a.this.l.setUrl(str2);
|
||
a.this.l.setType(2);
|
||
a.this.l.setExceptionMsg(str);
|
||
a.this.i.a(a.this.l, a.this.h, 1, true);
|
||
}
|
||
});
|
||
if (!d(webView, str2) || this.m) {
|
||
return;
|
||
}
|
||
this.m = true;
|
||
a(this.j, str2, this.h);
|
||
}
|
||
|
||
/* JADX INFO: Access modifiers changed from: private */
|
||
public boolean d(WebView webView, String str) {
|
||
try {
|
||
if (TextUtils.isEmpty(str)) {
|
||
return true;
|
||
}
|
||
Uri parse = Uri.parse(str);
|
||
if (!parse.getScheme().equals("http") && !parse.getScheme().equals("https")) {
|
||
if (parse.getScheme().equals(SDKConstants.PARAM_INTENT)) {
|
||
Intent parseUri = Intent.parseUri(str, 1);
|
||
try {
|
||
String str2 = parseUri.getPackage();
|
||
if (!TextUtils.isEmpty(str2)) {
|
||
if (this.j.getPackageManager().getLaunchIntentForPackage(str2) != null) {
|
||
return false;
|
||
}
|
||
}
|
||
} catch (Throwable th) {
|
||
af.b(a, th.getMessage());
|
||
}
|
||
try {
|
||
String stringExtra = parseUri.getStringExtra("browser_fallback_url");
|
||
if (!TextUtils.isEmpty(stringExtra)) {
|
||
Uri parse2 = Uri.parse(str);
|
||
if (!parse2.getScheme().equals("http")) {
|
||
if (!parse2.getScheme().equals("https")) {
|
||
str = stringExtra;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
} catch (Throwable th2) {
|
||
af.b(a, th2.getMessage());
|
||
}
|
||
}
|
||
if (com.mbridge.msdk.click.c.e(this.j, str)) {
|
||
af.b(a, "openDeepLink");
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
} catch (Throwable th3) {
|
||
af.b(a, th3.getMessage());
|
||
return true;
|
||
}
|
||
}
|
||
|
||
/* JADX INFO: Access modifiers changed from: private */
|
||
public void a(Context context, String str, CampaignEx campaignEx) {
|
||
if (context == null) {
|
||
return;
|
||
}
|
||
if (campaignEx != null) {
|
||
campaignEx.getCurrentLocalRid();
|
||
}
|
||
try {
|
||
int i = MBCommonActivity.$r8$clinit;
|
||
Intent intent = new Intent(context, (Class<?>) MBCommonActivity.class);
|
||
if (TextUtils.isEmpty(str)) {
|
||
return;
|
||
}
|
||
b.a.put(str, this.g);
|
||
if (aj.a.a(str)) {
|
||
str = "https://play.google.com/store/apps/details?id=" + str.replace("market://details?id=", "");
|
||
}
|
||
intent.putExtra("url", str);
|
||
af.c("url", "webview url = " + str);
|
||
intent.setFlags(DriveFile.MODE_READ_WRITE);
|
||
intent.putExtra("mvcommon", campaignEx);
|
||
context.startActivity(intent);
|
||
} catch (Exception unused) {
|
||
aj.a(context, str, this.f, campaignEx, new ArrayList());
|
||
}
|
||
}
|
||
|
||
private boolean e(WebView webView, String str) {
|
||
try {
|
||
if (TextUtils.isEmpty(str)) {
|
||
return false;
|
||
}
|
||
Uri parse = Uri.parse(str);
|
||
if (!parse.getScheme().equals("http") && !parse.getScheme().equals("https")) {
|
||
if (parse.getScheme().equals(SDKConstants.PARAM_INTENT)) {
|
||
Intent parseUri = Intent.parseUri(str, 1);
|
||
try {
|
||
String str2 = parseUri.getPackage();
|
||
if (!TextUtils.isEmpty(str2) && this.j.getPackageManager().getLaunchIntentForPackage(str2) != null) {
|
||
parseUri.setFlags(DriveFile.MODE_READ_ONLY);
|
||
this.j.startActivity(parseUri);
|
||
this.m = true;
|
||
return true;
|
||
}
|
||
} catch (Throwable th) {
|
||
af.b(a, th.getMessage());
|
||
}
|
||
try {
|
||
String stringExtra = parseUri.getStringExtra("browser_fallback_url");
|
||
if (!TextUtils.isEmpty(stringExtra)) {
|
||
Uri parse2 = Uri.parse(str);
|
||
if (!parse2.getScheme().equals("http") && !parse2.getScheme().equals("https")) {
|
||
str = stringExtra;
|
||
}
|
||
webView.loadUrl(stringExtra);
|
||
return false;
|
||
}
|
||
} catch (Throwable th2) {
|
||
af.b(a, th2.getMessage());
|
||
}
|
||
}
|
||
if (com.mbridge.msdk.click.c.e(this.j, str)) {
|
||
af.b(a, "openDeepLink");
|
||
this.m = true;
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
} catch (Throwable th3) {
|
||
af.b(a, th3.getMessage());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
private void c() {
|
||
this.k.removeCallbacks(this.n);
|
||
}
|
||
|
||
private void d() {
|
||
this.k.postDelayed(this.n, this.b);
|
||
}
|
||
}
|