package com.scb.phone.view.fragment.common; import android.app.Dialog; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.util.MalformedJsonException; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.fragment.app.FragmentActivity; import butterknife.BindView; import butterknife.ButterKnife; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.activity.HomeActivity; import com.scb.phone.view.activity.common.ThirdPartySlipActivity; import com.scb.phone.view.fragment.BaseFragment; import o.AbstractC14961gcz; import o.C12953fMa; import o.C14866gag; import o.C14957gcv; import o.C15715hv; import o.C3527azI; import o.InterfaceC13391fZD; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC14894gbR; import o.InterfaceC9087ddB; import o.QJy; import o.RunnableC3526azH; import o.ZI; import o.cXJ; import o.eXH; import o.fLU; import o.fLW; import o.fZZ; import org.json.JSONException; /* loaded from: classes5.dex */ public final class PrintSlipWebFragment extends Hilt_PrintSlipWebFragment implements InterfaceC9087ddB { private final InterfaceC13393fZL d; @InterfaceC13391fZD public C3527azI mPresenter; @BindView public WebView mWebView; private final String h = "WebviewJS"; private final String c = "WebJS"; private final String f = "onRecieved"; public PrintSlipWebFragment() { HBt hBt = new HBt(this); C14957gcv.e(hBt, ""); this.d = new fZZ(hBt); } /* loaded from: classes5.dex */ static final class HBt extends AbstractC14961gcz implements InterfaceC14890gbN { private PrintSlipWebFragment e; /* renamed from: com.scb.phone.view.fragment.common.PrintSlipWebFragment$HBt$2, reason: invalid class name */ /* loaded from: classes5.dex */ static final class AnonymousClass2 extends AbstractC14961gcz implements InterfaceC14894gbR { private PrintSlipWebFragment d; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Object obj) { C3527azI c3527azI = this.d.mPresenter; if (c3527azI == null) { C14957gcv.a(""); c3527azI = null; } c3527azI.a(obj); return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ AnonymousClass2(PrintSlipWebFragment printSlipWebFragment) { super(1); this.d = printSlipWebFragment; } } /* renamed from: com.scb.phone.view.fragment.common.PrintSlipWebFragment$HBt$1, reason: invalid class name */ /* loaded from: classes5.dex */ static final class AnonymousClass1 extends AbstractC14961gcz implements InterfaceC14894gbR { private PrintSlipWebFragment a; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Object obj) { C3527azI c3527azI = this.a.mPresenter; if (c3527azI == null) { C14957gcv.a(""); c3527azI = null; } if (obj != null && (obj instanceof String)) { try { final JsonObject jsonObject = (JsonObject) new Gson().fromJson(((String) obj).toString(), JsonObject.class); if (jsonObject.has("rquid")) { ZI.IeS ieS = new ZI.IeS(jsonObject) { // from class: o.azN private JsonObject b; @Override // o.ZI.IeS public final void e(Object obj2) { C3527azI.b(this.b, (InterfaceC9087ddB) obj2); } { this.b = jsonObject; } }; if (c3527azI.f != 0) { ieS.e(c3527azI.f); } } else { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } } catch (MalformedJsonException unused) { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } catch (JsonParseException unused2) { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } catch (NullPointerException unused3) { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } catch (JSONException unused4) { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } } else { c3527azI.d.e.d.d(); c3527azI.d(c3527azI.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC3526azH(c3527azI))); } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ AnonymousClass1(PrintSlipWebFragment printSlipWebFragment) { super(1); this.a = printSlipWebFragment; } } @Override // o.InterfaceC14890gbN public final /* synthetic */ C12953fMa invoke() { return new C12953fMa(new fLW(new AnonymousClass2(this.e)), new fLW(new AnonymousClass1(this.e))); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ HBt(PrintSlipWebFragment printSlipWebFragment) { super(0); this.e = printSlipWebFragment; } } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); View inflate = layoutInflater.inflate(R.layout.2131559977, viewGroup, false); ((BaseFragment) this).a = ButterKnife.c(this, inflate); C3527azI c3527azI = this.mPresenter; if (c3527azI == null) { C14957gcv.a(""); c3527azI = null; } c3527azI.e((C3527azI) this); return inflate; } @Override // com.scb.phone.view.fragment.webview.BaseWebViewFragment, androidx.fragment.app.Fragment public final void onViewCreated(View view, Bundle bundle) { Intent intent; C14957gcv.e(view, ""); super.onViewCreated(view, bundle); FragmentActivity activity = getActivity(); C3527azI c3527azI = null; String stringExtra = (activity == null || (intent = activity.getIntent()) == null) ? null : intent.getStringExtra("THIRD_PARTY_URL"); if (stringExtra != null) { WebView webView = this.mWebView; if (webView == null) { C14957gcv.a(""); webView = null; } webView.setWebChromeClient(new WebChromeClient()); WebView webView2 = this.mWebView; if (webView2 == null) { C14957gcv.a(""); webView2 = null; } webView2.setWebViewClient(new LWm(this)); C3527azI c3527azI2 = this.mPresenter; if (c3527azI2 != null) { c3527azI = c3527azI2; } else { C14957gcv.a(""); } C14957gcv.e(stringExtra, ""); cXJ cxj = new cXJ(stringExtra); if (c3527azI.f != 0) { cxj.e(c3527azI.f); } } } @Override // o.InterfaceC9087ddB public final void j_(String str) { C14957gcv.e(str, ""); FragmentActivity activity = getActivity(); if (activity != null) { ThirdPartySlipActivity.LWm lWm = ThirdPartySlipActivity.b; startActivity(ThirdPartySlipActivity.LWm.aaD_(activity, str, QJy.DISPLAY)); } } @Override // o.InterfaceC9087ddB public final void Q_() { FragmentActivity activity = getActivity(); if (activity != null) { Intent intent = new Intent(activity, (Class) HomeActivity.class); intent.addFlags(603979776); intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_LAYOUT", R.id.landing_page_tab); startActivity(intent); activity.finish(); } } @Override // o.InterfaceC9087ddB public final void b(String str) { C14957gcv.e(str, ""); eXH exh = new eXH(); exh.d("product", "debenture"); exh.d("ref_id", str); eXH exh2 = exh; if (getActivity() != null) { exh2.c(((BaseActivity) getActivity()).scbAnalytics, "receive_metadata"); } } @Override // com.scb.phone.view.fragment.webview.BaseWebViewFragment public final WebView ayA_() { WebView webView = this.mWebView; if (webView != null) { return webView; } C14957gcv.a(""); return null; } /* loaded from: classes5.dex */ public static final class LWm extends WebViewClient { private PrintSlipWebFragment c; LWm(PrintSlipWebFragment printSlipWebFragment) { this.c = printSlipWebFragment; } @Override // android.webkit.WebViewClient public final void onPageStarted(WebView webView, String str, Bitmap bitmap) { super.onPageStarted(webView, str, bitmap); this.c.y(); } @Override // android.webkit.WebViewClient public final void onPageFinished(WebView webView, String str) { super.onPageFinished(webView, str); PrintSlipWebFragment printSlipWebFragment = this.c; Dialog dialog = ((BaseFragment) printSlipWebFragment).e; if (dialog == null || !dialog.isShowing()) { return; } ((BaseFragment) printSlipWebFragment).e.dismiss(); ((BaseFragment) printSlipWebFragment).e = null; } } @Override // com.scb.phone.view.fragment.webview.BaseWebViewFragment public final /* synthetic */ fLU bb_() { return (C12953fMa) this.d.e(); } @Override // o.InterfaceC9087ddB public final void i_(String str) { C14957gcv.e(str, ""); } @Override // com.scb.phone.view.fragment.webview.BaseWebViewFragment public final String g() { return this.h; } }