package com.scb.phone.view.fragment.remittance; import android.app.Dialog; import android.graphics.Bitmap; import android.net.Uri; import android.net.http.SslError; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.SslErrorHandler; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.FragmentActivity; import com.google.common.net.HttpHeaders; import com.scb.phone.R; import com.scb.phone.view.activity.remittance.RemittanceFaqActivity; import com.scb.phone.view.custom.webview.SCBWebView; import com.scb.phone.view.fragment.BaseFragment; import java.io.InputStream; import o.AbstractC14961gcz; import o.C14957gcv; import o.C15715hv; import o.CBe; import o.InterfaceC12954fMb; import o.InterfaceC13391fZD; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC9473dkR; import o.OxQ; import o.RunnableC5888cCb; import o.cBV; import o.fSQ; import o.fZZ; import o.gdZ; import o.qeC; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; /* loaded from: classes5.dex */ public final class RemittanceFaqFragment extends Hilt_RemittanceFaqFragment implements InterfaceC9473dkR { public static final RVV c = new RVV(0); private final InterfaceC13393fZL d; private Response j; @InterfaceC13391fZD public cBV presenter; public RemittanceFaqFragment() { IeS ieS = new IeS(this); C14957gcv.e(ieS, ""); this.d = new fZZ(ieS); } /* loaded from: classes5.dex */ public static final class RVV { private RVV() { } public /* synthetic */ RVV(byte b) { this(); } } /* loaded from: classes5.dex */ static final class IeS extends AbstractC14961gcz implements InterfaceC14890gbN { private RemittanceFaqFragment c; @Override // o.InterfaceC14890gbN public final /* synthetic */ OxQ invoke() { View inflate = this.c.getLayoutInflater().inflate(R.layout.2131559868, (ViewGroup) null, false); SCBWebView sCBWebView = (SCBWebView) qeC.e(inflate, R.id.wv_faq); if (sCBWebView != null) { return new OxQ((ConstraintLayout) inflate, sCBWebView); } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(R.id.wv_faq))); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ IeS(RemittanceFaqFragment remittanceFaqFragment) { super(0); this.c = remittanceFaqFragment; } } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); ConstraintLayout constraintLayout = ((OxQ) this.d.e()).c; C14957gcv.c(constraintLayout, ""); return constraintLayout; } @Override // androidx.fragment.app.Fragment public final void onViewCreated(View view, Bundle bundle) { C14957gcv.e(view, ""); super.onViewCreated(view, bundle); cBV cbv = this.presenter; final cBV cbv2 = null; if (cbv == null) { C14957gcv.a(""); cbv = null; } cbv.e((cBV) this); cBV cbv3 = this.presenter; if (cbv3 != null) { cbv2 = cbv3; } else { C14957gcv.a(""); } if (!cbv2.c.j()) { cbv2.d(); return; } if (cbv2.f != 0) { cbv2.f.y(); } CBe cBe = cbv2.e; cBe.d(cBe.b(), new fSQ(cbv2) { // from class: o.cBX private cBV b; @Override // o.fSQ public final void c(Object obj) { cBV.a(this.b); } { this.b = cbv2; } }, new fSQ(cbv2) { // from class: o.cBS private cBV a; @Override // o.fSQ public final void c(Object obj) { cBV.e(this.a, (Throwable) obj); } { this.a = cbv2; } }); } @Override // o.InterfaceC9473dkR public final void c(String str) { C14957gcv.e(str, ""); SCBWebView sCBWebView = ((OxQ) this.d.e()).b; sCBWebView.setWebViewBackgroundColor(R.color.f14012131100909); C14957gcv.c(sCBWebView, ""); SCBWebView.setAdvanceWebView$default(sCBWebView, new LWm(), null, 2, null); sCBWebView.setWebViewClient(new HBt(this)); sCBWebView.loadUrl(str); } /* loaded from: classes5.dex */ public static final class LWm implements InterfaceC12954fMb { private final boolean d = true; @Override // o.InterfaceC12954fMb public final boolean P_() { return true; } LWm() { } @Override // o.InterfaceC12954fMb public final Boolean K_() { return Boolean.TRUE; } @Override // o.InterfaceC12954fMb public final boolean aA_() { return this.d; } } /* loaded from: classes5.dex */ public static final class HBt extends WebViewClient { private RemittanceFaqFragment a; HBt(RemittanceFaqFragment remittanceFaqFragment) { this.a = remittanceFaqFragment; } @Override // android.webkit.WebViewClient public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) { Uri url; if (webResourceRequest == null || (url = webResourceRequest.getUrl()) == null) { return null; } RemittanceFaqFragment remittanceFaqFragment = this.a; String obj = url.toString(); C14957gcv.c((Object) obj, ""); return RemittanceFaqFragment.axk_(remittanceFaqFragment, obj); } @Override // android.webkit.WebViewClient public final void onPageStarted(WebView webView, String str, Bitmap bitmap) { super.onPageStarted(webView, str, bitmap); this.a.y(); } @Override // android.webkit.WebViewClient public final void onPageFinished(WebView webView, String str) { super.onPageFinished(webView, str); RemittanceFaqFragment remittanceFaqFragment = this.a; Dialog dialog = ((BaseFragment) remittanceFaqFragment).e; cBV cbv = null; if (dialog != null && dialog.isShowing()) { ((BaseFragment) remittanceFaqFragment).e.dismiss(); ((BaseFragment) remittanceFaqFragment).e = null; } Response response = this.a.j; if (response != null) { RemittanceFaqFragment remittanceFaqFragment2 = this.a; if (response.code() >= 400) { cBV cbv2 = remittanceFaqFragment2.presenter; if (cbv2 != null) { cbv = cbv2; } else { C14957gcv.a(""); } cbv.d(cbv.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC5888cCb(cbv))); } } } @Override // android.webkit.WebViewClient public final void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) { super.onReceivedError(webView, webResourceRequest, webResourceError); RemittanceFaqFragment remittanceFaqFragment = this.a; Dialog dialog = ((BaseFragment) remittanceFaqFragment).e; cBV cbv = null; if (dialog != null && dialog.isShowing()) { ((BaseFragment) remittanceFaqFragment).e.dismiss(); ((BaseFragment) remittanceFaqFragment).e = null; } cBV cbv2 = this.a.presenter; if (cbv2 != null) { cbv = cbv2; } else { C14957gcv.a(""); } cbv.d(cbv.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC5888cCb(cbv))); } @Override // android.webkit.WebViewClient public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { super.onReceivedSslError(webView, sslErrorHandler, sslError); RemittanceFaqFragment remittanceFaqFragment = this.a; Dialog dialog = ((BaseFragment) remittanceFaqFragment).e; cBV cbv = null; if (dialog != null && dialog.isShowing()) { ((BaseFragment) remittanceFaqFragment).e.dismiss(); ((BaseFragment) remittanceFaqFragment).e = null; } cBV cbv2 = this.a.presenter; if (cbv2 != null) { cbv = cbv2; } else { C14957gcv.a(""); } cbv.d(cbv.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC5888cCb(cbv))); } @Override // android.webkit.WebViewClient public final void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) { super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse); RemittanceFaqFragment remittanceFaqFragment = this.a; Dialog dialog = ((BaseFragment) remittanceFaqFragment).e; cBV cbv = null; if (dialog != null && dialog.isShowing()) { ((BaseFragment) remittanceFaqFragment).e.dismiss(); ((BaseFragment) remittanceFaqFragment).e = null; } cBV cbv2 = this.a.presenter; if (cbv2 != null) { cbv = cbv2; } else { C14957gcv.a(""); } cbv.d(cbv.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC5888cCb(cbv))); } } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public final void onDestroyView() { cBV cbv = this.presenter; if (cbv == null) { C14957gcv.a(""); cbv = null; } cbv.w_(); super.onDestroyView(); } public static final /* synthetic */ WebResourceResponse axk_(RemittanceFaqFragment remittanceFaqFragment, String str) { ResponseBody body; OkHttpClient okHttpClient = new OkHttpClient(); Request.Builder url = new Request.Builder().url(gdZ.b((CharSequence) str).toString()); cBV cbv = remittanceFaqFragment.presenter; InputStream inputStream = null; if (cbv == null) { C14957gcv.a(""); cbv = null; } Response execute = okHttpClient.newCall(url.addHeader(HttpHeaders.ACCEPT_LANGUAGE, cbv.b).build()).execute(); remittanceFaqFragment.j = execute; if (execute != null && (body = execute.body()) != null) { inputStream = body.byteStream(); } return new WebResourceResponse("text/html", "utf-8", inputStream); } @Override // o.InterfaceC9473dkR public final void b() { FragmentActivity activity = getActivity(); RemittanceFaqActivity remittanceFaqActivity = activity instanceof RemittanceFaqActivity ? (RemittanceFaqActivity) activity : null; if (remittanceFaqActivity != null) { remittanceFaqActivity.finish(); } } }