what-the-bank/sources/com/scb/phone/view/fragment/debitbenefit/DebitCardBenefitDetailFragm...

412 lines
14 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.debitbenefit;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Intent;
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 android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.google.common.net.HttpHeaders;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.scb.phone.R;
import com.scb.phone.view.custom.webview.SCBWebView;
import com.scb.phone.view.fragment.BaseFragment;
import java.io.InputStream;
import o.C0562Jl;
import o.C10456eEq;
import o.C14957gcv;
import o.C1533aGx;
import o.C15715hv;
import o.C2974aoj;
import o.InterfaceC12954fMb;
import o.InterfaceC13391fZD;
import o.InterfaceC9172deh;
import o.OJA;
import o.PNS;
import o.RBw;
import o.RunnableC1535aGz;
import o.ZI;
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 DebitCardBenefitDetailFragment extends Hilt_DebitCardBenefitDetailFragment implements InterfaceC9172deh.RVV {
public static final Sts d = new Sts(0);
private Response c;
@BindView
public ImageView ivDebitBenefitDetail;
@BindView
public LinearLayout llDebitOneButtonContainer;
@BindView
public LinearLayout llDebitTwoButtonContainer;
@InterfaceC13391fZD
public C1533aGx presenter;
@BindView
public SCBWebView wvDebitCardBenefit;
/* loaded from: classes5.dex */
public static final class Sts {
private Sts() {
}
public /* synthetic */ Sts(byte b) {
this();
}
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
return layoutInflater.inflate(R.layout.2131559534, viewGroup, false);
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
final C0562Jl c0562Jl;
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
((BaseFragment) this).a = ButterKnife.c(this, view);
C1533aGx c1533aGx = this.presenter;
final C1533aGx c1533aGx2 = null;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
c1533aGx.e((C1533aGx) this);
Bundle arguments = getArguments();
if (arguments == null || (c0562Jl = (C0562Jl) arguments.getParcelable("DEBIT_CARD_BENEFIT_INFO")) == null) {
return;
}
C1533aGx c1533aGx3 = this.presenter;
if (c1533aGx3 != null) {
c1533aGx2 = c1533aGx3;
} else {
C14957gcv.a("");
}
C14957gcv.e(c0562Jl, "");
c1533aGx2.e = c0562Jl.i;
ZI.IeS ieS = new ZI.IeS(c0562Jl, c1533aGx2) { // from class: o.aGy
private C1533aGx d;
private C0562Jl e;
@Override // o.ZI.IeS
public final void e(Object obj) {
C1533aGx.d(this.e, this.d, (InterfaceC9172deh.RVV) obj);
}
{
this.e = c0562Jl;
this.d = c1533aGx2;
}
};
if (c1533aGx2.f != 0) {
ieS.e(c1533aGx2.f);
}
}
@Override // o.InterfaceC9172deh.RVV
public final void c(String str, String str2) {
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
ImageView imageView = this.ivDebitBenefitDetail;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
C10456eEq.aqe_(imageView, str, new PNS().c(R.color.f3412131099849).a(R.color.f3412131099849).c(RBw.a, new OJA()));
SCBWebView sCBWebView = this.wvDebitCardBenefit;
if (sCBWebView == null) {
C14957gcv.a("");
sCBWebView = null;
}
sCBWebView.setWebViewBackgroundColor(R.color.f14012131100909);
SCBWebView.setAdvanceWebView$default(sCBWebView, new IeS(), null, 2, null);
sCBWebView.setWebViewClient(new LWm(this));
sCBWebView.loadUrl(str2);
}
/* loaded from: classes5.dex */
public static final class IeS implements InterfaceC12954fMb {
private final boolean e = true;
@Override // o.InterfaceC12954fMb
public final boolean P_() {
return true;
}
IeS() {
}
@Override // o.InterfaceC12954fMb
public final Boolean K_() {
return Boolean.TRUE;
}
@Override // o.InterfaceC12954fMb
public final boolean aA_() {
return this.e;
}
}
/* loaded from: classes5.dex */
public static final class LWm extends WebViewClient {
private DebitCardBenefitDetailFragment c;
LWm(DebitCardBenefitDetailFragment debitCardBenefitDetailFragment) {
this.c = debitCardBenefitDetailFragment;
}
@Override // android.webkit.WebViewClient
public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
Uri url;
if (webResourceRequest == null || (url = webResourceRequest.getUrl()) == null) {
return null;
}
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment = this.c;
String obj = url.toString();
C14957gcv.c((Object) obj, "");
return DebitCardBenefitDetailFragment.arJ_(debitCardBenefitDetailFragment, obj);
}
@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);
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment = this.c;
Dialog dialog = ((BaseFragment) debitCardBenefitDetailFragment).e;
C1533aGx c1533aGx = null;
if (dialog != null && dialog.isShowing()) {
((BaseFragment) debitCardBenefitDetailFragment).e.dismiss();
((BaseFragment) debitCardBenefitDetailFragment).e = null;
}
Response response = this.c.c;
if (response != null) {
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment2 = this.c;
if (response.code() >= 400) {
C1533aGx c1533aGx2 = debitCardBenefitDetailFragment2.presenter;
if (c1533aGx2 != null) {
c1533aGx = c1533aGx2;
} else {
C14957gcv.a("");
}
c1533aGx.d(c1533aGx.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC1535aGz(c1533aGx)));
}
}
}
@Override // android.webkit.WebViewClient
public final void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment = this.c;
Dialog dialog = ((BaseFragment) debitCardBenefitDetailFragment).e;
C1533aGx c1533aGx = null;
if (dialog != null && dialog.isShowing()) {
((BaseFragment) debitCardBenefitDetailFragment).e.dismiss();
((BaseFragment) debitCardBenefitDetailFragment).e = null;
}
C1533aGx c1533aGx2 = this.c.presenter;
if (c1533aGx2 != null) {
c1533aGx = c1533aGx2;
} else {
C14957gcv.a("");
}
c1533aGx.d(c1533aGx.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC1535aGz(c1533aGx)));
}
@Override // android.webkit.WebViewClient
public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment = this.c;
Dialog dialog = ((BaseFragment) debitCardBenefitDetailFragment).e;
C1533aGx c1533aGx = null;
if (dialog != null && dialog.isShowing()) {
((BaseFragment) debitCardBenefitDetailFragment).e.dismiss();
((BaseFragment) debitCardBenefitDetailFragment).e = null;
}
C1533aGx c1533aGx2 = this.c.presenter;
if (c1533aGx2 != null) {
c1533aGx = c1533aGx2;
} else {
C14957gcv.a("");
}
c1533aGx.d(c1533aGx.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC1535aGz(c1533aGx)));
}
@Override // android.webkit.WebViewClient
public final void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
DebitCardBenefitDetailFragment debitCardBenefitDetailFragment = this.c;
Dialog dialog = ((BaseFragment) debitCardBenefitDetailFragment).e;
C1533aGx c1533aGx = null;
if (dialog != null && dialog.isShowing()) {
((BaseFragment) debitCardBenefitDetailFragment).e.dismiss();
((BaseFragment) debitCardBenefitDetailFragment).e = null;
}
C1533aGx c1533aGx2 = this.c.presenter;
if (c1533aGx2 != null) {
c1533aGx = c1533aGx2;
} else {
C14957gcv.a("");
}
c1533aGx.d(c1533aGx.j.c(C15715hv.tOB.common_error, C15715hv.tOB.error_generic_resource, new RunnableC1535aGz(c1533aGx)));
}
}
@Override // o.InterfaceC9172deh.RVV
public final void d() {
LinearLayout linearLayout = this.llDebitOneButtonContainer;
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
C14957gcv.a("");
linearLayout = null;
}
linearLayout.setVisibility(0);
LinearLayout linearLayout3 = this.llDebitTwoButtonContainer;
if (linearLayout3 != null) {
linearLayout2 = linearLayout3;
} else {
C14957gcv.a("");
}
linearLayout2.setVisibility(8);
}
@Override // o.InterfaceC9172deh.RVV
public final void e() {
LinearLayout linearLayout = this.llDebitTwoButtonContainer;
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
C14957gcv.a("");
linearLayout = null;
}
linearLayout.setVisibility(0);
LinearLayout linearLayout3 = this.llDebitOneButtonContainer;
if (linearLayout3 != null) {
linearLayout2 = linearLayout3;
} else {
C14957gcv.a("");
}
linearLayout2.setVisibility(8);
}
@Override // o.InterfaceC9172deh.RVV
public final void b(String str) {
C14957gcv.e(str, "");
try {
startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(str)));
} catch (ActivityNotFoundException e) {
guQ.e(e);
}
}
@Override // o.InterfaceC9172deh.RVV
public final void c() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.finish();
}
}
@OnClick
public final void onRegisterClick() {
v("tvi_benefit_register");
C1533aGx c1533aGx = this.presenter;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
c1533aGx.b(C2974aoj.d("REGISTER"));
}
@OnClick
public final void onManageClick() {
v("tvi_benefit_manage");
C1533aGx c1533aGx = this.presenter;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
c1533aGx.b(C2974aoj.d("MANAGE"));
}
@OnClick
public final void onSelectClick() {
v("cvp_benefit_comfirmed");
C1533aGx c1533aGx = this.presenter;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
c1533aGx.b((String) null);
}
@Override // o.InterfaceC9172deh.RVV
public final void b() {
v("cvp_benefit_details");
}
@Override // o.InterfaceC9172deh.RVV
public final void a() {
v("tvi_benefit_details");
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroyView() {
C1533aGx c1533aGx = this.presenter;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
c1533aGx.w_();
super.onDestroyView();
}
public static final /* synthetic */ WebResourceResponse arJ_(DebitCardBenefitDetailFragment debitCardBenefitDetailFragment, String str) {
ResponseBody body;
OkHttpClient okHttpClient = new OkHttpClient();
Request.Builder url = new Request.Builder().url(gdZ.b((CharSequence) str).toString());
C1533aGx c1533aGx = debitCardBenefitDetailFragment.presenter;
InputStream inputStream = null;
if (c1533aGx == null) {
C14957gcv.a("");
c1533aGx = null;
}
String string = c1533aGx.b.getString("com.scb.phone.pref.key.LANGUAGE", "th");
Response execute = okHttpClient.newCall(url.addHeader(HttpHeaders.ACCEPT_LANGUAGE, string != null ? string : "th").build()).execute();
debitCardBenefitDetailFragment.c = execute;
if (execute != null && (body = execute.body()) != null) {
inputStream = body.byteStream();
}
return new WebResourceResponse("text/html", "utf-8", inputStream);
}
}