- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
309 lines
9.1 KiB
Java
309 lines
9.1 KiB
Java
package com.ironsource;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import android.util.Log;
|
|
import android.view.ViewGroup;
|
|
import android.webkit.JavascriptInterface;
|
|
import android.webkit.RenderProcessGoneDetail;
|
|
import android.webkit.WebChromeClient;
|
|
import android.webkit.WebView;
|
|
import android.webkit.WebViewClient;
|
|
import com.google.android.gms.drive.DriveFile;
|
|
import com.ironsource.hg;
|
|
import com.ironsource.mediationsdk.logger.IronLog;
|
|
import com.ironsource.sdk.controller.OpenUrlActivity;
|
|
import com.ironsource.sdk.controller.k;
|
|
import com.ironsource.sdk.utils.Logger;
|
|
import com.ironsource.v8;
|
|
import csdk.gluads.Consts;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class of implements hg {
|
|
private static final String g = "loadWithUrl | webView is not null";
|
|
private static final String h = "of";
|
|
private static final String i = "file://";
|
|
private final String a;
|
|
private String b;
|
|
private WebView c;
|
|
private mf d;
|
|
private hf e;
|
|
private Context f;
|
|
|
|
public class a implements Runnable {
|
|
final /* synthetic */ String a;
|
|
final /* synthetic */ JSONObject b;
|
|
final /* synthetic */ String c;
|
|
|
|
public a(String str, JSONObject jSONObject, String str2) {
|
|
this.a = str;
|
|
this.b = jSONObject;
|
|
this.c = str2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (of.this.c != null) {
|
|
xf.a(vp.q, new sf().a(nb.A, of.g).a());
|
|
}
|
|
try {
|
|
of.this.b(this.a);
|
|
of.this.c.loadUrl(of.this.a(this.b.getString("urlForWebView")));
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("adViewId", of.this.a);
|
|
of.this.d.a(this.c, jSONObject);
|
|
} catch (Exception e) {
|
|
i9.d().a(e);
|
|
of.this.b(this.a, e.getMessage());
|
|
xf.a(vp.q, new sf().a(nb.A, e.getMessage()).a());
|
|
}
|
|
}
|
|
}
|
|
|
|
public class b implements Runnable {
|
|
final /* synthetic */ String a;
|
|
final /* synthetic */ String b;
|
|
|
|
public b(String str, String str2) {
|
|
this.a = str;
|
|
this.b = str2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
if (of.this.c != null) {
|
|
of.this.c.destroy();
|
|
}
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("adViewId", of.this.a);
|
|
if (of.this.d != null) {
|
|
of.this.d.a(this.a, jSONObject);
|
|
of.this.d.b();
|
|
}
|
|
of.this.d = null;
|
|
of.this.f = null;
|
|
} catch (Exception e) {
|
|
i9.d().a(e);
|
|
Log.e(of.h, "performCleanup | could not destroy ISNAdView webView ID: " + of.this.a);
|
|
xf.a(vp.r, new sf().a(nb.A, e.getMessage()).a());
|
|
of.this.b(this.b, e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
public class c implements hg.a {
|
|
final /* synthetic */ String a;
|
|
|
|
public c(String str) {
|
|
this.a = str;
|
|
}
|
|
|
|
@Override // com.ironsource.hg.a
|
|
public void a(String str) {
|
|
Logger.i(of.h, "ISNAdViewWebPresenter | WebViewClient | reportOnError: " + str);
|
|
of.this.b(this.a, str);
|
|
}
|
|
|
|
@Override // com.ironsource.hg.a
|
|
public void b(String str) {
|
|
Logger.i(of.h, "ISNAdViewWebPresenter | WebViewClient | onRenderProcessGone: " + str);
|
|
try {
|
|
((ViewGroup) of.this.c.getParent()).removeView(of.this.c);
|
|
} catch (Exception e) {
|
|
i9.d().a(e);
|
|
IronLog.INTERNAL.error(e.toString());
|
|
}
|
|
of.this.e();
|
|
}
|
|
}
|
|
|
|
public class d extends WebChromeClient {
|
|
private d() {
|
|
}
|
|
|
|
public /* synthetic */ d(of ofVar, a aVar) {
|
|
this();
|
|
}
|
|
|
|
@Override // android.webkit.WebChromeClient
|
|
public boolean onCreateWindow(WebView webView, boolean z, boolean z2, Message message) {
|
|
WebView webView2 = new WebView(webView.getContext());
|
|
webView2.setWebChromeClient(of.this.new d());
|
|
webView2.setWebViewClient(new e(of.this, null));
|
|
((WebView.WebViewTransport) message.obj).setWebView(webView2);
|
|
message.sendToTarget();
|
|
Logger.i("onCreateWindow", "onCreateWindow");
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public class e extends WebViewClient {
|
|
private e() {
|
|
}
|
|
|
|
public /* synthetic */ e(of ofVar, a aVar) {
|
|
this();
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
@TargetApi(26)
|
|
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
|
|
Logger.e(of.h, "Chromium process crashed - detail.didCrash(): " + renderProcessGoneDetail.didCrash());
|
|
return true;
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
|
|
Context context = webView.getContext();
|
|
Intent a = new OpenUrlActivity.e(new k.b()).a(str).b(false).a(context);
|
|
a.addFlags(DriveFile.MODE_READ_ONLY);
|
|
context.startActivity(a);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public of(kf kfVar, Context context, String str, hf hfVar) {
|
|
this.f = context;
|
|
mf mfVar = new mf();
|
|
this.d = mfVar;
|
|
mfVar.g(str);
|
|
this.a = str;
|
|
this.d.a(kfVar);
|
|
this.e = hfVar;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public String a(String str) {
|
|
if (!c(str)) {
|
|
return str;
|
|
}
|
|
return "file://" + this.b + d(str);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
@SuppressLint({"AddJavascriptInterface"})
|
|
public void b(String str) {
|
|
Logger.i(h, "ISNAdViewWebPresenter | createWebView");
|
|
WebView webView = new WebView(this.f);
|
|
this.c = webView;
|
|
webView.addJavascriptInterface(new lf(this), Cif.e);
|
|
this.c.setWebViewClient(new nf(new c(str)));
|
|
this.c.setWebChromeClient(new d(this, null));
|
|
yu.a(this.c);
|
|
this.d.a(this.c);
|
|
}
|
|
|
|
private boolean c(String str) {
|
|
return str.startsWith(Consts.STRING_PERIOD);
|
|
}
|
|
|
|
private String d(String str) {
|
|
String substring = str.substring(str.indexOf("/") + 1);
|
|
return substring.substring(substring.indexOf("/"));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public synchronized void e() {
|
|
a("", "");
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public synchronized void a(String str, String str2) {
|
|
if (this.f == null) {
|
|
return;
|
|
}
|
|
Logger.i(h, "performCleanup");
|
|
ve.a.d(new b(str, str2));
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public void a(String str, String str2, String str3) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
b(str3, v8.c.D);
|
|
return;
|
|
}
|
|
Logger.i(h, "trying to perform WebView Action: " + str);
|
|
try {
|
|
if (str.equals(v8.h.t0)) {
|
|
this.c.onPause();
|
|
} else {
|
|
if (!str.equals(v8.h.u0)) {
|
|
b(str3, v8.c.C);
|
|
return;
|
|
}
|
|
this.c.onResume();
|
|
}
|
|
this.d.f(str2);
|
|
} catch (Exception e2) {
|
|
i9.d().a(e2);
|
|
b(str3, v8.c.E);
|
|
}
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public void a(JSONObject jSONObject, String str, String str2) {
|
|
try {
|
|
this.d.e(str);
|
|
} catch (Exception e2) {
|
|
i9.d().a(e2);
|
|
Logger.i(h, "sendHandleGetViewVisibility fail with reason: " + e2.getMessage());
|
|
}
|
|
}
|
|
|
|
public String b() {
|
|
return this.a;
|
|
}
|
|
|
|
public void b(String str, String str2) {
|
|
mf mfVar = this.d;
|
|
if (mfVar != null) {
|
|
mfVar.a(str, str2);
|
|
}
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public void b(JSONObject jSONObject, String str, String str2) {
|
|
ve.a.d(new a(str2, jSONObject, str));
|
|
}
|
|
|
|
public mf c() {
|
|
return this.d;
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public void c(JSONObject jSONObject, String str, String str2) throws JSONException {
|
|
try {
|
|
this.d.a(jSONObject.getString("params"), str, str2);
|
|
} catch (Exception e2) {
|
|
i9.d().a(e2);
|
|
Logger.i(h, "sendMessageToAd fail message: " + e2.getMessage());
|
|
throw e2;
|
|
}
|
|
}
|
|
|
|
public hf d() {
|
|
return this.e;
|
|
}
|
|
|
|
public void e(String str) {
|
|
this.b = str;
|
|
}
|
|
|
|
@Override // com.ironsource.hg
|
|
public WebView getPresentingView() {
|
|
return this.c;
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void handleMessageFromAd(String str) {
|
|
this.d.c(str);
|
|
}
|
|
}
|