package com.ss.android.ugc.aweme.crossplatform.business; import X.AbstractC23460wR; import X.AnonymousClass0E3; import X.AnonymousClass0ED; import X.AnonymousClass0WE; import X.AnonymousClass1IL; import X.AnonymousClass1PN; import X.AnonymousClass1ZS; import X.C14300hf; import X.C21090sc; import X.C48119Iuy; import X.C48376Iz7; import X.C48378Iz9; import X.C48380IzB; import X.C48382IzD; import X.C48389IzK; import X.C81623Jf; import X.C82193Lk; import X.CallableC48371Iz2; import X.ECW; import X.EnumC11380cx; import X.RunnableC48386IzH; import X.RunnableC48387IzI; import android.os.Build; import android.os.Handler; import android.text.TextUtils; import android.webkit.WebView; import com.bytedance.android.livesdk.livesetting.pullstream.LiveNetAdaptiveHurryTimeSetting; import com.bytedance.covode.number.Covode; import com.ss.android.common.util.NetworkUtils; import com.ss.android.ugc.aweme.crossplatform.business.BusinessService; import com.ss.android.ugc.aweme.global.config.settings.pojo.AdLandingPageConfig; import java.lang.ref.WeakReference; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.Map; import kotlin.g.b.m; public final class PassBackWebInfoBusiness extends BusinessService.Business { public AdLandingPageConfig LIZ; public boolean LIZIZ = true; public int LIZJ; public int LIZLLL; public int LJ = LiveNetAdaptiveHurryTimeSetting.DEFAULT; public String LJFF = "https://ads.tiktok.com/inspect/aegis/client/page/"; public String LJI; public final AbstractC23460wR LJII = AnonymousClass1PN.LIZ((AnonymousClass1IL) C48378Iz9.LIZ); public C48119Iuy LJIIL; public final AbstractC23460wR LJIILIIL = AnonymousClass1PN.LIZ((AnonymousClass1IL) C48389IzK.LIZ); public final AbstractC23460wR LJIILJJIL = AnonymousClass1PN.LIZ((AnonymousClass1IL) C48376Iz7.LIZ); public final AbstractC23460wR LJIILL = AnonymousClass1PN.LIZ((AnonymousClass1IL) C48380IzB.LIZ); static { Covode.recordClassIndex(55521); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public PassBackWebInfoBusiness(C81623Jf r2) { super(r2); C21090sc.LIZ(r2); } public static void LIZ(WebView webView, String str) { String LIZ2 = C82193Lk.LIZ.LIZ(webView, str); if (!TextUtils.isEmpty(LIZ2)) { str = LIZ2; } webView.loadUrl(str); } private final String LIZJ(String str) { return "javascript:window.location.href='bytedance://adPageHtmlContent?html=' + encodeURIComponent(document.documentElement.outerHTML) + '&url=" + LIZ(str) + "'"; } private final void LJ() { AnonymousClass0ED.LIZ(new CallableC48371Iz2(this), C14300hf.LIZ(), (AnonymousClass0E3) null); } public final Handler LIZ() { return (Handler) this.LJIILIIL.getValue(); } public final String LIZ(String str) { String encode = URLEncoder.encode(str, "UTF-8"); m.LIZIZ(encode, ""); return encode; } public final void LIZ(WebView webView, boolean z) { String url; if (LIZLLL() && LIZIZ().size() < this.LIZJ && webView != null && (url = webView.getUrl()) != null && !AnonymousClass1ZS.LIZ((CharSequence) url) && !m.LIZ((Object) "about:blank", (Object) webView.getUrl())) { WeakReference<WebView> weakReference = new WeakReference<>(webView); if (z) { LIZ().postDelayed(new RunnableC48386IzH(this, weakReference), (long) this.LJ); LIZ().postDelayed(new RunnableC48387IzI(this, weakReference), 200); return; } LIZ(weakReference); } } public final void LIZ(String str, String str2) { if (str2 != null) { LIZIZ().put(str, AnonymousClass1ZS.LIZJ(str2, (CharSequence) "\"")); } } public final void LIZ(WeakReference<WebView> weakReference) { WebView webView = weakReference.get(); if (webView != null) { m.LIZIZ(webView, ""); String url = webView.getUrl(); if (TextUtils.isEmpty(url)) { LJ(); return; } int i2 = Build.VERSION.SDK_INT; webView.evaluateJavascript("encodeURIComponent(document.documentElement.outerHTML)", new C48382IzD(this, url)); } } public final String LIZIZ(String str) { String decode = URLDecoder.decode(str, "UTF-8"); m.LIZIZ(decode, ""); return decode; } public final Map<String, String> LIZIZ() { return (Map) this.LJIILJJIL.getValue(); } public final Map<String, Map<String, String>> LIZJ() { return (Map) this.LJIILL.getValue(); } public final boolean LIZLLL() { C48119Iuy iuy; String str; if (this.LIZ == null || (iuy = this.LJIIL) == null) { return false; } if (iuy == null) { m.LIZIZ(); } if (!iuy.LJJIJ) { return false; } if (!this.LIZIZ || NetworkUtils.getNetworkType(AnonymousClass0WE.LJJI.LIZ()) == EnumC11380cx.WIFI) { return ((this.LIZLLL > 0 && ECW.LIZ.get() >= this.LIZLLL) || (str = this.LJI) == null || str.length() == 0) ? false : true; } return false; } }