TikTok.apk(点击下载) / CrossPlatformWebView$initWebView$1.java
package com.ss.android.ugc.aweme.crossplatform.view;
import X.AbstractC47918Irj;
import X.AbstractC48129Iv8;
import X.AbstractC48266IxL;
import X.AnonymousClass1ZS;
import X.C13380gB;
import X.C14300hf;
import X.C21090sc;
import X.C45121qH;
import X.C48121Iv0;
import X.C48131IvA;
import X.C48135IvE;
import X.C82193Lk;
import X.EnumC48264IxJ;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.dmt.ui.widget.DmtStatusView;
import com.ss.android.ugc.aweme.crossplatform.activity.CrossPlatformActivity;
import com.ss.android.ugc.aweme.crossplatform.business.AdWebStatBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.XpathBusiness;
import com.ss.android.ugc.aweme.feed.widget.LineProgressBarView;
import com.zhiliaoapp.musically.R;
import kotlin.g.b.m;
import org.json.JSONException;
import org.json.JSONObject;
public final class CrossPlatformWebView$initWebView$1 implements AbstractC48129Iv8 {
public final /* synthetic */ CrossPlatformWebView LIZ;
public boolean LIZIZ;
static {
Covode.recordClassIndex(55690);
}
/* JADX WARN: Incorrect args count in method signature: ()V */
public CrossPlatformWebView$initWebView$1(CrossPlatformWebView crossPlatformWebView) {
this.LIZ = crossPlatformWebView;
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, int i2, String str, String str2) {
AbstractC48129Iv8 LJ;
if (Build.VERSION.SDK_INT < 23) {
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZ(webView, str2, str);
}
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, i2, str, str2);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, i2, str, str2);
}
this.LIZIZ = true;
this.LIZ.LIZLLL();
this.LIZ.LIZ(Integer.valueOf(i2), str, str2, false);
}
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
AbstractC48129Iv8 LJ;
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, sslErrorHandler, sslError);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, sslErrorHandler, sslError);
}
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
Uri url;
String path;
CharSequence description;
AbstractC48129Iv8 LJ;
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, webResourceRequest, webResourceError);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, webResourceRequest, webResourceError);
}
Integer num = null;
String obj = (webResourceError == null || (description = webResourceError.getDescription()) == null) ? null : description.toString();
String valueOf = String.valueOf(webResourceRequest != null ? webResourceRequest.getUrl() : null);
Boolean valueOf2 = webResourceRequest != null ? Boolean.valueOf(webResourceRequest.isForMainFrame()) : null;
if (m.LIZ((Object) valueOf2, (Object) true)) {
if (webResourceRequest == null || (url = webResourceRequest.getUrl()) == null || (path = url.getPath()) == null || !AnonymousClass1ZS.LIZJ(path, ".apk", false)) {
this.LIZIZ = true;
this.LIZ.LIZLLL();
CrossPlatformWebView crossPlatformWebView = this.LIZ;
if (webResourceError != null) {
num = Integer.valueOf(webResourceError.getErrorCode());
}
crossPlatformWebView.LIZ(num, obj, valueOf, false);
} else {
return;
}
} else if (m.LIZ((Object) valueOf2, (Object) false)) {
Uri url2 = webResourceRequest.getUrl();
if (!(url2 == null || url2.getPath() == null)) {
Uri url3 = webResourceRequest.getUrl();
m.LIZIZ(url3, "");
String path2 = url3.getPath();
if (path2 == null) {
m.LIZIZ();
}
m.LIZIZ(path2, "");
if (AnonymousClass1ZS.LIZJ(path2, "favicon.ico", false)) {
return;
}
}
JSONObject jSONObject = new JSONObject();
C45121qH.LIZ(jSONObject, "host", webResourceRequest.getUrl().getHost());
C45121qH.LIZ(jSONObject, "path", webResourceRequest.getUrl().getPath());
C45121qH.LIZ(jSONObject, "statusCode", null);
C45121qH.LIZ(jSONObject, "errorCode", Integer.valueOf(webResourceError.getErrorCode()));
C13380gB.LIZ("aweme_webview_assets_error", 0, jSONObject);
}
webStatBusinessOnReceivedError(webView, webResourceRequest, obj);
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
AbstractC48129Iv8 LJ;
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, webResourceRequest, webResourceResponse);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, webResourceRequest, webResourceResponse);
}
JSONObject jSONObject = new JSONObject();
C45121qH.LIZ(jSONObject, "host", webResourceRequest.getUrl().getHost());
C45121qH.LIZ(jSONObject, "path", webResourceRequest.getUrl().getPath());
C45121qH.LIZ(jSONObject, "statusCode", Integer.valueOf(webResourceResponse.getStatusCode()));
C45121qH.LIZ(jSONObject, "errorCode", 1001);
C13380gB.LIZ("aweme_webview_assets_error", 0, jSONObject);
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZ(webView, webResourceRequest, webResourceResponse != null ? webResourceResponse.getReasonPhrase() : null);
}
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, String str) {
C48131IvA crossPlatformParams;
C48135IvE ivE;
AbstractC47918Irj crossPlatformBusiness;
XpathBusiness xpathBusiness;
AbstractC48129Iv8 LJ;
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, str);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, str);
}
((DmtStatusView) this.LIZ.LIZ(R.id.d38)).LIZLLL();
if (!this.LIZIZ) {
DmtStatusView dmtStatusView = (DmtStatusView) this.LIZ.LIZ(R.id.b9j);
m.LIZIZ(dmtStatusView, "");
dmtStatusView.setVisibility(8);
this.LIZ.LIZ((Integer) 0, "", str, true);
}
this.LIZ.LIZLLL = true;
this.LIZ.getRegistry().LIZ(EnumC48264IxJ.LOAD_FINISH);
AbstractC48266IxL ixL2 = this.LIZ.LJ;
if (!(ixL2 == null || (crossPlatformBusiness = ixL2.getCrossPlatformBusiness()) == null || (xpathBusiness = (XpathBusiness) crossPlatformBusiness.LIZ(XpathBusiness.class)) == null)) {
xpathBusiness.xpathDirect(this.LIZ.getCrossPlatformParams(), webView);
}
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZIZ(webView, str);
}
if (webView != null) {
String reactId = this.LIZ.getReactId();
C21090sc.LIZ(webView);
if (reactId != null) {
String str2 = "javascript:(function () { window.reactId = '" + reactId + "';})();";
String LIZ2 = C82193Lk.LIZ.LIZ(webView, str2);
if (!TextUtils.isEmpty(LIZ2)) {
str2 = LIZ2;
}
webView.loadUrl(str2);
}
}
CrossPlatformWebView crossPlatformWebView = this.LIZ;
int i2 = !this.LIZIZ ? 1 : 0;
if (!(crossPlatformWebView.LJII || (crossPlatformParams = crossPlatformWebView.getCrossPlatformParams()) == null || (ivE = crossPlatformParams.LIZLLL) == null || ivE.LIZJ == null)) {
C48131IvA crossPlatformParams2 = crossPlatformWebView.getCrossPlatformParams();
if (crossPlatformParams2 == null) {
m.LIZIZ();
}
JSONObject jSONObject = new JSONObject(crossPlatformParams2.LIZLLL.LIZJ);
try {
jSONObject.put("status", String.valueOf(i2)).put("duration", System.currentTimeMillis() - CrossPlatformActivity.LIZJ);
} catch (JSONException e) {
e.printStackTrace();
}
C14300hf.LIZ("request_anchor_detail", jSONObject);
crossPlatformWebView.LJII = true;
}
}
@Override // X.AbstractC48129Iv8
public final void LIZ(WebView webView, String str, Bitmap bitmap) {
C48121Iv0 iv0;
AbstractC48129Iv8 LJ;
AbstractC48266IxL ixL = this.LIZ.LJ;
if (!(ixL == null || (LJ = ixL.LJ()) == null)) {
LJ.LIZ(webView, str, bitmap);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZ(webView, str, bitmap);
}
this.LIZIZ = false;
this.LIZ.LIZLLL = false;
this.LIZ.getRegistry().LIZ(EnumC48264IxJ.LOAD_START);
CrossPlatformWebView crossPlatformWebView = this.LIZ;
C48131IvA crossPlatformParams = crossPlatformWebView.getCrossPlatformParams();
if (!(crossPlatformParams == null || (iv0 = crossPlatformParams.LIZJ) == null || !iv0.LJJIIZ)) {
LineProgressBarView lineProgressBarView = (LineProgressBarView) crossPlatformWebView.LIZ(R.id.dpr);
m.LIZIZ(lineProgressBarView, "");
lineProgressBarView.setVisibility(0);
crossPlatformWebView.LJ();
}
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZ(webView, str);
}
}
@Override // X.AbstractC48129Iv8
public final boolean LIZIZ(WebView webView, String str) {
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZJ(webView, str);
}
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
return customWebViewStatus != null && customWebViewStatus.LIZIZ(webView, str);
}
@Override // X.AbstractC48129Iv8
public final void LIZJ(WebView webView, String str) {
AbstractC48129Iv8 customWebViewStatus = this.LIZ.getCustomWebViewStatus();
if (customWebViewStatus != null) {
customWebViewStatus.LIZJ(webView, str);
}
}
public final void webStatBusinessOnReceivedError(WebView webView, WebResourceRequest webResourceRequest, String str) {
AdWebStatBusiness webStatBusiness = this.LIZ.getWebStatBusiness();
if (webStatBusiness != null) {
webStatBusiness.LIZ(webView, webResourceRequest, str);
}
}
}