what-the-bank/sources/com/scb/phone/view/fragment/ndid/DopaConsentFragment.java

427 lines
14 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.ndid;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.google.common.net.HttpHeaders;
import com.scb.phone.R;
import com.scb.phone.view.activity.PreLoadCheckActivity;
import com.scb.phone.view.activity.csent.PrivacyCSentWebViewActivity;
import com.scb.phone.view.activity.ndid.DopaConsentActivity;
import com.scb.phone.view.custom.common.CustomDialog;
import com.scb.phone.view.custom.webview.SCBWebView;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.ndid.DopaConsentFragment;
import o.C10965eUa;
import o.C14957gcv;
import o.C15715hv;
import o.C4348bXg;
import o.C4350bXi;
import o.C4352bXk;
import o.C9413djK;
import o.InterfaceC13391fZD;
import o.InterfaceC9422djT;
import o.RunnableC4365bXx;
import o.ZI;
import o.gHK;
import o.gdZ;
import o.guQ;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
/* loaded from: classes5.dex */
public final class DopaConsentFragment extends Hilt_DopaConsentFragment implements InterfaceC9422djT.IeS {
public static final Sts c = new Sts(0);
private Response d;
@BindView
public AppCompatButton nextButton;
@InterfaceC13391fZD
public C4350bXi presenter;
@BindView
public TextView tvPrivacyNotice;
@BindView
public SCBWebView wvConsent;
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
View inflate = layoutInflater.inflate(R.layout.2131559578, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
return inflate;
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
C4350bXi c4350bXi = this.presenter;
TextView textView = null;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
c4350bXi.e((C4350bXi) this);
final C4350bXi c4350bXi2 = this.presenter;
if (c4350bXi2 == null) {
C14957gcv.a("");
c4350bXi2 = null;
}
ZI.IeS ieS = new ZI.IeS(c4350bXi2) { // from class: o.bXo
private C4350bXi a;
@Override // o.ZI.IeS
public final void e(Object obj) {
C4350bXi.b(this.a);
}
{
this.a = c4350bXi2;
}
};
if (c4350bXi2.f != 0) {
ieS.e(c4350bXi2.f);
}
C10965eUa c10965eUa = new C10965eUa(new HBt(this));
TextView textView2 = this.tvPrivacyNotice;
if (textView2 != null) {
textView = textView2;
} else {
C14957gcv.a("");
}
textView.setMovementMethod(c10965eUa);
}
/* loaded from: classes5.dex */
public static final class HBt implements C10965eUa.RVV {
private DopaConsentFragment d;
HBt(DopaConsentFragment dopaConsentFragment) {
this.d = dopaConsentFragment;
}
@Override // o.C10965eUa.RVV
public final boolean b(String str) {
C14957gcv.e(str, "");
Context context = this.d.getContext();
if (context == null) {
return true;
}
PrivacyCSentWebViewActivity.IeS ieS = PrivacyCSentWebViewActivity.b;
context.startActivity(PrivacyCSentWebViewActivity.IeS.aaM_(context, str));
return true;
}
}
@OnClick
public final void onClickRadioButtonAccept() {
C4350bXi c4350bXi = this.presenter;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
c4350bXi.d = true;
C4348bXg c4348bXg = new C4348bXg();
if (c4350bXi.f != 0) {
c4348bXg.e(c4350bXi.f);
}
}
@OnClick
public final void onClickRadioButtonDecline() {
C4350bXi c4350bXi = this.presenter;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
c4350bXi.d = false;
C4348bXg c4348bXg = new C4348bXg();
if (c4350bXi.f != 0) {
c4348bXg.e(c4350bXi.f);
}
}
@Override // o.InterfaceC9422djT.IeS
public final void b() {
AppCompatButton appCompatButton = this.nextButton;
if (appCompatButton == null) {
C14957gcv.a("");
appCompatButton = null;
}
appCompatButton.setEnabled(true);
}
@OnClick
public final void onNext() {
C4350bXi c4350bXi = this.presenter;
C4350bXi c4350bXi2 = null;
String str = "";
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
if (c4350bXi.d) {
c4350bXi.a();
} else {
ZI.IeS ieS = new ZI.IeS() { // from class: o.bXw
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9422djT.IeS) obj).a();
}
};
if (c4350bXi.f != 0) {
ieS.e(c4350bXi.f);
}
}
C4350bXi c4350bXi3 = this.presenter;
if (c4350bXi3 != null) {
c4350bXi2 = c4350bXi3;
} else {
C14957gcv.a("");
}
String d = c4350bXi2.g.f.c.d();
C14957gcv.c((Object) d, "");
switch (d.hashCode()) {
case -1096412751:
if (d.equals("TOUCHPOINT")) {
str = "TOUCHPOINT_DOPA_consent_screen";
break;
}
break;
case 2391377:
if (d.equals("NDID")) {
str = "NDID_DOPA_consent_screen";
break;
}
break;
case 101616853:
if (d.equals("ETB_OPEN_DEPOSIT")) {
str = "OpenAccount_DOPA_consent_screen";
break;
}
break;
case 219661499:
if (d.equals("IDP_AGENT")) {
str = "AIS_DOPA_consent_screen";
break;
}
break;
case 450376283:
if (d.equals("SINGLE_FORM")) {
str = "Investment_onboard_dopa_consent";
break;
}
break;
}
v(str);
}
@Override // o.InterfaceC9422djT.IeS
public final void d(String str) {
C14957gcv.e(str, "");
SCBWebView sCBWebView = this.wvConsent;
if (sCBWebView == null) {
C14957gcv.a("");
sCBWebView = null;
}
sCBWebView.setScrollContainer(false);
sCBWebView.setWebViewClient(new RVV(this));
if (str != null) {
sCBWebView.loadUrl(str);
}
}
@Override // o.InterfaceC9422djT.IeS
public final void a() {
((CustomDialog) CustomDialog.e(new Object[]{CustomDialog.b(getContext()).c(R.string.common_ndid_consent_decline_title).d(R.string.common_ndid_consent_decline_description), Integer.valueOf(R.string.cancel), new DialogInterface.OnClickListener() { // from class: o.fox
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}})).aoT_(R.string.confirm, new DialogInterface.OnClickListener(this) { // from class: o.fou
private DopaConsentFragment c;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
DopaConsentFragment.avN_(this.c, dialogInterface);
}
{
this.c = this;
}
}).show();
}
/* loaded from: classes5.dex */
final class RVV extends WebViewClient {
private DopaConsentFragment a;
public RVV(DopaConsentFragment dopaConsentFragment) {
this.a = dopaConsentFragment;
}
@Override // android.webkit.WebViewClient
public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
Uri url;
if (webResourceRequest == null || (url = webResourceRequest.getUrl()) == null) {
return null;
}
DopaConsentFragment dopaConsentFragment = this.a;
String obj = url.toString();
C14957gcv.c((Object) obj, "");
return dopaConsentFragment.avP_(obj);
}
@Override // android.webkit.WebViewClient
public final WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
if (str != null) {
return this.a.avP_(str);
}
return null;
}
@Override // android.webkit.WebViewClient
public final void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
C4350bXi c4350bXi = this.a.presenter;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
String valueOf = String.valueOf(webResourceRequest != null ? webResourceRequest.getUrl() : null);
C14957gcv.e(valueOf, "");
if (C14957gcv.b((Object) c4350bXi.e, (Object) valueOf)) {
c4350bXi.d(c4350bXi.j.c(C15715hv.tOB.custom_error_title, C15715hv.tOB.custom_error_description, new RunnableC4365bXx(c4350bXi)));
}
}
@Override // android.webkit.WebViewClient
public final void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
DopaConsentFragment dopaConsentFragment = this.a;
Dialog dialog = ((BaseFragment) dopaConsentFragment).e;
if (dialog == null || !dialog.isShowing()) {
return;
}
((BaseFragment) dopaConsentFragment).e.dismiss();
((BaseFragment) dopaConsentFragment).e = null;
}
}
/* loaded from: classes5.dex */
public static final class Sts {
private Sts() {
}
public /* synthetic */ Sts(byte b) {
this();
}
}
public static /* synthetic */ void avN_(DopaConsentFragment dopaConsentFragment, DialogInterface dialogInterface) {
C14957gcv.e(dopaConsentFragment, "");
dialogInterface.dismiss();
C4350bXi c4350bXi = dopaConsentFragment.presenter;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
c4350bXi.a();
}
/* JADX INFO: Access modifiers changed from: private */
public final WebResourceResponse avP_(String str) {
String str2;
ResponseBody body;
C4350bXi c4350bXi = this.presenter;
if (c4350bXi == null) {
C14957gcv.a("");
c4350bXi = null;
}
if (!gdZ.e(str, c4350bXi.e, false)) {
return null;
}
try {
OkHttpClient okHttpClient = new OkHttpClient();
Request.Builder url = new Request.Builder().url(gdZ.b((CharSequence) str).toString());
gHK al = getActivity() instanceof PreLoadCheckActivity ? ((PreLoadCheckActivity) getActivity()).al() : null;
if (al == null || (str2 = al.mode) == null) {
str2 = gHK.INDIVIDUAL.mode;
}
Request.Builder addHeader = url.addHeader("userMode", str2);
C4350bXi c4350bXi2 = this.presenter;
if (c4350bXi2 == null) {
C14957gcv.a("");
c4350bXi2 = null;
}
Response execute = okHttpClient.newCall(addHeader.addHeader(HttpHeaders.ACCEPT_LANGUAGE, c4350bXi2.a).build()).execute();
this.d = execute;
return new WebResourceResponse("text/html", "utf-8", (execute == null || (body = execute.body()) == null) ? null : body.byteStream());
} catch (Exception e) {
guQ.e(e);
return null;
}
}
@Override // o.InterfaceC9422djT.IeS
public final void d(final boolean z) {
FragmentActivity activity = getActivity();
final C4352bXk c4352bXk = null;
DopaConsentActivity dopaConsentActivity = activity instanceof DopaConsentActivity ? (DopaConsentActivity) activity : null;
if (dopaConsentActivity != null) {
C4352bXk c4352bXk2 = dopaConsentActivity.presenter;
if (c4352bXk2 != null) {
c4352bXk = c4352bXk2;
} else {
C14957gcv.a("");
}
ZI.IeS ieS = new ZI.IeS(z, c4352bXk) { // from class: o.bXj
private boolean a;
private C4352bXk b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C4352bXk.c(this.a, this.b, (C9413djK.HBt) obj);
}
{
this.a = z;
this.b = c4352bXk;
}
};
if (c4352bXk.f != 0) {
ieS.e(c4352bXk.f);
}
}
}
@Override // o.InterfaceC9422djT.IeS
public final void c() {
FragmentActivity activity = getActivity();
DopaConsentActivity dopaConsentActivity = activity instanceof DopaConsentActivity ? (DopaConsentActivity) activity : null;
if (dopaConsentActivity != null) {
dopaConsentActivity.onBackPressed();
}
}
}