package com.scb.phone.view.fragment.landingpage; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.ConsoleMessage; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.fragment.app.FragmentActivity; import butterknife.BindView; import butterknife.ButterKnife; import com.akexorcist.localizationactivity.LocalizationActivity; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.huawei.hms.support.api.entity.common.CommonConstant; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.activity.transferandpay.FavouriteSelectedActivity; import com.scb.phone.view.fragment.BaseFragment; import com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment; import com.squareup.picasso.Picasso; import java.lang.ref.WeakReference; import java.net.URISyntaxException; import java.util.concurrent.TimeUnit; import o.AbstractC13163fSk; import o.C0690Mh; import o.C0693Mj; import o.C0907Rf; import o.C0915Rl; import o.C12374ewx; import o.C12912fKx; import o.C13417fZt; import o.C4063bOs; import o.C4065bOu; import o.C6583cXR; import o.C8064dAG; import o.EnumC8951daY; import o.IVj; import o.InterfaceC13391fZD; import o.InterfaceC8950daX; import o.MBB; import o.Pzh; import o.QJg; import o.ZI; import o.fRR; import o.fSQ; import o.gjJ; import o.guQ; import o.nMh; /* loaded from: classes5.dex */ public class PartnerWebViewFragment extends Hilt_PartnerWebViewFragment implements InterfaceC8950daX { private static final String[] c = {"android.permission.CAMERA", "android.permission.WRITE_EXTERNAL_STORAGE"}; private static final String[] d = {"android.permission.CAMERA"}; @BindView FloatingActionButton eKycFab; private String f; private ValueCallback g; private int h = 0; private String i; private String j; private boolean m; @BindView WebView mBaseWebView; private String n; @InterfaceC13391fZD public C4063bOs staticTilePresenter; public PartnerWebViewFragment() { setHasOptionsMenu(true); } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559804, viewGroup, false); ButterKnife.c(this, inflate); super.aa(); u(""); this.mBaseWebView.setWebChromeClient(new Sts(this, (byte) 0)); this.mBaseWebView.setWebViewClient(new AnonymousClass5(this)); this.mBaseWebView.getSettings().setJavaScriptEnabled(true); this.mBaseWebView.getSettings().setDomStorageEnabled(true); this.mBaseWebView.addJavascriptInterface(new IVj(new IVj.Sts(this) { // from class: o.fmf private PartnerWebViewFragment c; @Override // o.IVj.Sts public final void a(String str) { PartnerWebViewFragment.e(this.c, str); } { this.c = this; } }), "androidbridge"); this.staticTilePresenter.e((C4063bOs) this); final C4063bOs c4063bOs = this.staticTilePresenter; final C0915Rl c0915Rl = (getActivity() == null || getActivity().getIntent() == null || getActivity().getIntent().getExtras() == null) ? null : (C0915Rl) getActivity().getIntent().getParcelableExtra("com.scb.phone.EXTRA_DISPLAY"); long j = -1; if (getActivity() != null && getActivity().getIntent() != null && getActivity().getIntent().getExtras() != null) { j = getActivity().getIntent().getLongExtra("com.scb.phone.EXTRA_PARTNER_ID", -1L); } final C0907Rf.Sts sts = (C0907Rf.Sts) getActivity().getIntent().getParcelableExtra("com.scb.phone.EXTRA_NTB_WEB_DATA"); final String B_ = ((LocalizationActivity) getActivity()).B_(); if (sts != null && c4063bOs.f != 0) { ZI.IeS ieS = new ZI.IeS(c4063bOs, sts, B_) { // from class: o.bOy private C0907Rf.Sts a; private String d; private C4063bOs e; @Override // o.ZI.IeS public final void e(Object obj) { C4063bOs.d(this.e, this.a, this.d, (InterfaceC8950daX) obj); } { this.e = c4063bOs; this.a = sts; this.d = B_; } }; if (c4063bOs.f != 0) { ieS.e(c4063bOs.f); } C8064dAG a = c4063bOs.e.d.a(); if (a != null && a.s != null && a.s.d != null && a.s.d.length() != 0) { final String str = a.s.d; ZI.IeS ieS2 = new ZI.IeS(c4063bOs, str) { // from class: o.bOr private String a; private C4063bOs c; @Override // o.ZI.IeS public final void e(Object obj) { InterfaceC8950daX interfaceC8950daX = (InterfaceC8950daX) obj; interfaceC8950daX.b(this.c.a.b_(this.a)); } { this.c = c4063bOs; this.a = str; } }; if (c4063bOs.f != 0) { ieS2.e(c4063bOs.f); } } } else if (c0915Rl != null) { ZI.IeS ieS3 = new ZI.IeS(c0915Rl) { // from class: o.bOz private C0915Rl a; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8950daX) obj).e(this.a); } { this.a = c0915Rl; } }; if (c4063bOs.f != 0) { ieS3.e(c4063bOs.f); } } else { final QJg d2 = c4063bOs.c.d(j, false); if (d2 != null) { ZI.IeS ieS4 = new ZI.IeS(c4063bOs, d2) { // from class: o.bOt private QJg a; private C4063bOs e; @Override // o.ZI.IeS public final void e(Object obj) { InterfaceC8950daX interfaceC8950daX = (InterfaceC8950daX) obj; interfaceC8950daX.e(this.e.b.d(this.a)); } { this.e = c4063bOs; this.a = d2; } }; if (c4063bOs.f != 0) { ieS4.e(c4063bOs.f); } } else { C4065bOu c4065bOu = new C4065bOu(); if (c4063bOs.f != 0) { c4065bOu.e(c4063bOs.f); } } } return inflate; } @Override // com.scb.phone.view.fragment.BaseFragment public final String W() { return ((LocalizationActivity) getActivity()).B_(); } @Override // com.scb.phone.view.fragment.BaseFragment public final void aa() { super.aa(); u(""); } @Override // androidx.fragment.app.Fragment public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { menuInflater.inflate(R.menu.2131689474, menu); super.onCreateOptionsMenu(menu, menuInflater); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public boolean onOptionsItemSelected(MenuItem menuItem) { if (menuItem.getItemId() == R.id.menu_close) { if (getActivity() == null) { return true; } getActivity().finish(); return true; } return super.onOptionsItemSelected(menuItem); } @Override // androidx.fragment.app.Fragment public void onResume() { super.onResume(); this.m = false; this.j = null; } /* renamed from: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment$5, reason: invalid class name */ /* loaded from: classes5.dex */ public class AnonymousClass5 extends WebViewClient { public final PartnerWebViewFragment a; AnonymousClass5(PartnerWebViewFragment partnerWebViewFragment) { this.a = partnerWebViewFragment; } @Override // android.webkit.WebViewClient public final boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) { String obj = webResourceRequest.getUrl().toString(); if (C6583cXR.r(obj)) { if (obj.startsWith("intent:")) { try { Intent parseUri = Intent.parseUri(obj, 1); if (this.a.getContext().getPackageManager().resolveActivity(parseUri, 65536) != null) { this.a.getContext().startActivity(parseUri); } return true; } catch (URISyntaxException e) { guQ.e(e); return false; } } if (!C6583cXR.t(obj)) { this.a.m = true; try { this.a.startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(obj))); } catch (ActivityNotFoundException e2) { guQ.e(e2); return false; } } else if (this.a.j == null || !this.a.m) { try { this.a.startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(obj))); } catch (ActivityNotFoundException e3) { guQ.e(e3); return false; } } else { webView.loadUrl(this.a.j); } } else { this.a.j = webView.getOriginalUrl(); webView.loadUrl(obj); } return true; } @Override // android.webkit.WebViewClient public final void onPageStarted(WebView webView, String str, Bitmap bitmap) { super.onPageStarted(webView, str, bitmap); if (TextUtils.equals(this.a.n, str)) { ((BaseFragment) this.a).b = AbstractC13163fSk.timer(1L, TimeUnit.MINUTES).subscribeOn(C13417fZt.c()).observeOn(fRR.e()).subscribe(new fSQ(this) { // from class: o.fmk private PartnerWebViewFragment.AnonymousClass5 e; @Override // o.fSQ public final void c(Object obj) { PartnerWebViewFragment.j(this.e.a); } { this.e = this; } }, new fSQ() { // from class: o.fmj @Override // o.fSQ public final void c(Object obj) { guQ.a((Throwable) obj); } }); } } @Override // android.webkit.WebViewClient public final void onPageFinished(WebView webView, String str) { if (((BaseFragment) this.a).b != null && !((BaseFragment) this.a).b.isDisposed()) { ((BaseFragment) this.a).b.dispose(); } super.onPageFinished(webView, str); } } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); FragmentActivity activity = getActivity(); if (activity == null || this.h != 1) { return; } String str = this.f; EnumC8951daY enumC8951daY = EnumC8951daY.SUCCESS; if (getActivity() != null) { BaseActivity.a(new Object[]{(BaseActivity) getActivity(), activity, Integer.valueOf(R.id.fragment_easy_bonus), str, enumC8951daY}, 855668825, -855668822, R.id.fragment_easy_bonus); } } @Override // o.InterfaceC8950daX public final void e(C0915Rl c0915Rl) { v(); this.n = c0915Rl.j; if (c0915Rl.e == 1) { this.mBaseWebView.getSettings().setUserAgentString(Pzh.e()); } if (c0915Rl.g == 1) { this.f = c0915Rl.h; this.h = c0915Rl.g; } if (c0915Rl.c) { this.eKycFab.c().e(null, true); } this.mBaseWebView.loadUrl(this.n); u(c0915Rl.i); } @Override // o.InterfaceC8950daX public final void e(String str) { Intent intent = new Intent(getActivity(), (Class) FavouriteSelectedActivity.class); intent.putExtra("com.scb.phone.EXTRA_BILL_PAY_METHOD", MBB.PROFILE); if (!gjJ.b((CharSequence) str)) { intent.putExtra("source", str); } startActivity(intent); if ((getActivity() instanceof BaseActivity) && ((BaseActivity) getActivity()).X()) { if ((getActivity() instanceof BaseActivity) && ((BaseActivity) getActivity()).z_()) { return; } getActivity().finish(); } } @Override // o.InterfaceC8950daX public final void a() { g(); } @Override // o.InterfaceC8950daX public final void b(String str) { if (this.eKycFab != null) { Picasso.d().e(str).aBu_(this.eKycFab, null); this.eKycFab.setBackgroundTintList(ColorStateList.valueOf(nMh.getColor(getContext(), R.color.f14012131100909))); this.eKycFab.c().e(null, true); this.eKycFab.setOnClickListener(new View.OnClickListener(this) { // from class: o.fmc private PartnerWebViewFragment c; @Override // android.view.View.OnClickListener public final void onClick(View view) { PartnerWebViewFragment.b(this.c); } { this.c = this; } }); } } private void g() { C0693Mj c0693Mj = new C0693Mj(); c0693Mj.c = getString(R.string.error_generic_resource); C0690Mh c0690Mh = new C0690Mh(); c0690Mh.e = C0690Mh.IeS.NAVIGATE_BACK; c0690Mh.b = getString(R.string.ok); c0693Mj.e = c0690Mh; e(c0693Mj); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityResult(int i, int i2, Intent intent) { Uri[] uriArr; if (i != 1 || this.g == null) { super.onActivityResult(i, i2, intent); FragmentActivity activity = getActivity(); if (activity != null) { activity.finish(); return; } return; } if (i2 == -1) { if (intent == null || intent.getDataString() == null) { String str = this.i; if (str != null) { uriArr = new Uri[]{Uri.parse(str)}; } } else { uriArr = new Uri[]{Uri.parse(intent.getDataString())}; } this.g.onReceiveValue(uriArr); this.g = null; } uriArr = null; this.g.onReceiveValue(uriArr); this.g = null; } /* loaded from: classes5.dex */ class Sts extends WebChromeClient { private PartnerWebViewFragment a; @Override // android.webkit.WebChromeClient public final boolean onConsoleMessage(ConsoleMessage consoleMessage) { return true; } private Sts(PartnerWebViewFragment partnerWebViewFragment) { this.a = partnerWebViewFragment; } @Override // android.webkit.WebChromeClient public final void onProgressChanged(WebView webView, int i) { if (i >= 20) { this.a.aq_(); } } /* JADX WARN: Removed duplicated region for block: B:10:0x004a */ /* JADX WARN: Removed duplicated region for block: B:13:0x0050 */ @Override // android.webkit.WebChromeClient /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final boolean onShowFileChooser(android.webkit.WebView r1, android.webkit.ValueCallback r2, android.webkit.WebChromeClient.FileChooserParams r3) { /* r0 = this; com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a android.webkit.ValueCallback r1 = com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.avv_(r1) r3 = 0 if (r1 == 0) goto L12 com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a android.webkit.ValueCallback r1 = com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.avv_(r1) r1.onReceiveValue(r3) L12: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.avw_(r1, r2) com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a androidx.fragment.app.FragmentActivity r2 = r1.getActivity() if (r2 == 0) goto L3a androidx.fragment.app.FragmentActivity r1 = r1.getActivity() com.scb.phone.view.activity.BaseActivity r1 = (com.scb.phone.view.activity.BaseActivity) r1 boolean r1 = com.scb.phone.view.activity.BaseActivity.P() if (r1 == 0) goto L3a com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a android.content.Context r1 = r1.getContext() java.lang.String[] r2 = com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.j() boolean r1 = o.C15581guh.b(r1, r2) goto L48 L3a: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a android.content.Context r1 = r1.getContext() java.lang.String[] r2 = com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.d() boolean r1 = o.C15581guh.b(r1, r2) L48: if (r1 == 0) goto L50 com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.i(r1) goto L7d L50: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a androidx.fragment.app.FragmentActivity r2 = r1.getActivity() if (r2 == 0) goto L6a androidx.fragment.app.FragmentActivity r1 = r1.getActivity() com.scb.phone.view.activity.BaseActivity r1 = (com.scb.phone.view.activity.BaseActivity) r1 boolean r1 = com.scb.phone.view.activity.BaseActivity.P() if (r1 == 0) goto L6a com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a o.C14095fmi.c(r1) goto L6f L6a: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a o.C14095fmi.a(r1) L6f: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a android.webkit.ValueCallback r1 = com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.avv_(r1) r1.onReceiveValue(r3) com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment r1 = r0.a com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.avw_(r1, r3) L7d: r1 = 1 return r1 */ throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.Sts.onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback, android.webkit.WebChromeClient$FileChooserParams):boolean"); } /* synthetic */ Sts(PartnerWebViewFragment partnerWebViewFragment, byte b) { this(partnerWebViewFragment); } } /* JADX WARN: Removed duplicated region for block: B:11:0x004a */ /* JADX WARN: Removed duplicated region for block: B:15:0x004f */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void i() { /* r4 = this; android.content.Intent r0 = new android.content.Intent java.lang.String r1 = "android.media.action.IMAGE_CAPTURE" r0.(r1) android.content.Context r1 = r4.getContext() r2 = 0 if (r1 == 0) goto L36 android.content.pm.PackageManager r3 = r1.getPackageManager() android.content.ComponentName r3 = r0.resolveActivity(r3) if (r3 == 0) goto L36 java.io.File r3 = o.C12891fKc.b(r1) // Catch: java.io.IOException -> L1d goto L22 L1d: r3 = move-exception o.guQ.a(r3) r3 = r2 L22: if (r3 == 0) goto L36 java.lang.String r2 = o.cXH.RVV.e android.net.Uri r1 = o.C9257dgM.getUriForFile(r1, r2, r3) java.lang.String r2 = "output" r0.putExtra(r2, r1) java.lang.String r1 = r1.toString() r4.i = r1 goto L37 L36: r0 = r2 L37: android.content.Intent r1 = new android.content.Intent java.lang.String r2 = "android.intent.action.GET_CONTENT" r1.(r2) java.lang.String r2 = "android.intent.category.OPENABLE" r1.addCategory(r2) java.lang.String r2 = "image/*" r1.setType(r2) if (r0 == 0) goto L4f android.content.Intent[] r0 = new android.content.Intent[]{r0} goto L52 L4f: r0 = 0 android.content.Intent[] r0 = new android.content.Intent[r0] L52: android.content.Intent r2 = new android.content.Intent java.lang.String r3 = "android.intent.action.CHOOSER" r2.(r3) java.lang.String r3 = "android.intent.extra.INTENT" r2.putExtra(r3, r1) java.lang.String r1 = "android.intent.extra.TITLE" java.lang.String r3 = "Image Chooser" r2.putExtra(r1, r3) java.lang.String r1 = "android.intent.extra.INITIAL_INTENTS" r2.putExtra(r1, r0) r0 = 1 r4.startActivityForResult(r2, r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.fragment.landingpage.PartnerWebViewFragment.i():void"); } public static /* synthetic */ void b(PartnerWebViewFragment partnerWebViewFragment) { WeakReference weakReference = new WeakReference<>((BaseActivity) partnerWebViewFragment.getActivity()); C0907Rf.Sts sts = (C0907Rf.Sts) partnerWebViewFragment.getActivity().getIntent().getParcelableExtra("com.scb.phone.EXTRA_REGISTRATION_TILE_DATA"); C12912fKx.RVV rvv = new C12912fKx.RVV((byte) 0); rvv.d = weakReference; rvv.e = sts; C12912fKx.d(rvv); } public static /* synthetic */ void e(PartnerWebViewFragment partnerWebViewFragment, String str) { C4063bOs c4063bOs = partnerWebViewFragment.staticTilePresenter; c4063bOs.c.a(str); C12374ewx c12374ewx = c4063bOs.c; c12374ewx.d(c12374ewx.i, new C4063bOs.LWm(c4063bOs, (byte) 0)); } public static /* synthetic */ void j(PartnerWebViewFragment partnerWebViewFragment) { partnerWebViewFragment.mBaseWebView.stopLoading(); partnerWebViewFragment.g(); } }