what-the-bank/sources/com/scb/phone/view/fragment/easycash/EasycashSuccessFragment.java

414 lines
15 KiB
Java

package com.scb.phone.view.fragment.easycash;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.easycash.EasycashLandingActivity;
import com.scb.phone.view.custom.common.CustomDialog;
import com.scb.phone.view.custom.easycash.CustomEasycashCommonSuccessView;
import java.util.ArrayList;
import java.util.List;
import o.C0605Kk;
import o.C0613Kq;
import o.C0616Ks;
import o.C10966eUb;
import o.C12928fLf;
import o.C1928aSd;
import o.EnumC8951daY;
import o.InterfaceC13391fZD;
import o.InterfaceC15577gud;
import o.InterfaceC6621cYR;
import o.ZI;
import o.eTW;
import o.eTX;
import o.fSJ;
import o.guQ;
import o.nMh;
/* loaded from: classes5.dex */
public class EasycashSuccessFragment extends Hilt_EasycashSuccessFragment implements InterfaceC6621cYR.ufv {
@BindView
Button autoSaveOffSaveButton;
@BindView
LinearLayout contentLayout;
private String d;
private String f;
private fSJ g;
private List<C0613Kq> h;
private CustomEasycashCommonSuccessView i;
private String j;
private String k;
private String l;
private C0616Ks n;
/* renamed from: o */
private String f8031o;
private String p;
@InterfaceC13391fZD
public C1928aSd presenter;
@BindView
View printerLineView;
@BindView
TextView returnButton;
private String s;
@BindView
RelativeLayout slipLayout;
@BindView
FrameLayout successCommonView;
@BindView
TextView textViewLoanAppId;
@BindView
TextView textViewPageDescription;
@BindView
TextView textViewPageTitle;
@BindView
TextView textViewRemainingBalance;
@BindView
TextView textViewTransactionId;
@BindView
TextView textViewTransactionTime;
@BindView
ImageView zigzagimage;
private boolean m = false;
private boolean c = false;
public static EasycashSuccessFragment b(List<C0613Kq> list, String str, String str2, String str3, String str4, String str5, String str6, String str7, C0616Ks c0616Ks) {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("com.scb.phone.SUCCESS_EXTRA_DISPLAY", (ArrayList) list);
bundle.putString("com.scb.phone.SUCCESS_PRODUCT_GROUP", str);
bundle.putString("com.scb.phone.SUCCESS_PRODUCT_TYPE", str2);
bundle.putString("com.scb.phone.SUCCESS_TRANSACTION_ID", str3);
bundle.putString("com.scb.phone.SUCCESS_NCB_TRANSACTION_ID", str4);
bundle.putString("com.scb.phone.SUCCESS_TRANSACTION_TIME", str5);
bundle.putString("com.scb.phone.SUCCESS_REMAINING_BALANCE", str6);
bundle.putString("com.scb.phone.SUCCESS_AMOUNT", str7);
bundle.putParcelable("com.scb.phone.SUCCESS_DETAIL_DISPLAY", c0616Ks);
EasycashSuccessFragment easycashSuccessFragment = new EasycashSuccessFragment();
easycashSuccessFragment.setArguments(bundle);
return easycashSuccessFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559616, viewGroup, false);
ButterKnife.c(this, inflate);
this.i = new CustomEasycashCommonSuccessView(getContext());
if (getArguments() != null && getArguments().getParcelableArrayList("com.scb.phone.SUCCESS_EXTRA_DISPLAY") != null) {
this.h = getArguments().getParcelableArrayList("com.scb.phone.SUCCESS_EXTRA_DISPLAY");
this.f = getArguments().getString("com.scb.phone.SUCCESS_PRODUCT_GROUP");
this.f8031o = getArguments().getString("com.scb.phone.SUCCESS_PRODUCT_TYPE");
this.p = getArguments().getString("com.scb.phone.SUCCESS_TRANSACTION_ID");
this.j = getArguments().getString("com.scb.phone.SUCCESS_NCB_TRANSACTION_ID");
this.k = getArguments().getString("com.scb.phone.SUCCESS_REMAINING_BALANCE");
this.n = (C0616Ks) getArguments().getParcelable("com.scb.phone.SUCCESS_DETAIL_DISPLAY");
this.presenter.e((C1928aSd) this);
this.contentLayout.bringToFront();
if ("CARDS".equals(this.f)) {
C0616Ks c0616Ks = this.n;
if (c0616Ks != null) {
this.l = c0616Ks.b;
if ("CREDIT_CARD".equals(this.f8031o)) {
this.d = this.n.a;
}
}
this.textViewRemainingBalance.setVisibility(8);
this.printerLineView.setVisibility(8);
this.slipLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
this.contentLayout.setBackgroundColor(nMh.getColor(getContext(), R.color.f14012131100909));
} else {
this.l = getString(R.string.easycash_loan_success_title);
C0616Ks c0616Ks2 = this.n;
if (c0616Ks2 != null) {
this.d = c0616Ks2.a;
}
this.zigzagimage.setVisibility(0);
this.contentLayout.setBackground(nMh.getDrawable(getContext(), R.drawable.slip_bg));
this.printerLineView.setVisibility(0);
if (this.p != null) {
this.textViewTransactionId.setVisibility(0);
this.textViewTransactionId.setText(getString(R.string.reference_id, this.p));
}
String str = this.k;
if (TextUtils.isEmpty(str)) {
this.textViewRemainingBalance.setVisibility(8);
} else {
this.textViewRemainingBalance.setVisibility(0);
this.textViewRemainingBalance.setText(getString(R.string.easycash_success_available_amount, str));
}
}
if (this.j != null) {
this.textViewLoanAppId.setVisibility(0);
this.textViewLoanAppId.setText(getString(R.string.loan_app_id, this.j));
}
this.textViewPageTitle.setText(this.l);
if (!TextUtils.isEmpty(this.d)) {
this.textViewPageDescription.setText(this.d);
this.textViewPageDescription.setVisibility(0);
}
String string = getArguments().getString("com.scb.phone.SUCCESS_TRANSACTION_TIME");
this.s = string;
if (string != null) {
this.textViewTransactionTime.setText(string);
} else {
this.textViewTransactionTime.setVisibility(8);
}
if ("COMMERCIAL".equals(this.f)) {
this.returnButton.setText(getString(R.string.easycash_commercial_success_return_button));
}
C1928aSd c1928aSd = this.presenter;
List<C0613Kq> list = this.h;
for (int i = 0; i < list.size(); i++) {
ZI.IeS ieS = new ZI.IeS(list, i) { // from class: o.aSc
private int b;
private List e;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6621cYR.ufv) obj).d((C0613Kq) this.e.get(r1), this.b + 1);
}
{
this.e = list;
this.b = i;
}
};
if (c1928aSd.f != 0) {
ieS.e(c1928aSd.f);
}
}
}
C1928aSd c1928aSd2 = this.presenter;
if (c1928aSd2.d.c.V()) {
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.aSa
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6621cYR.ufv) obj).a();
}
};
if (c1928aSd2.f != 0) {
ieS2.e(c1928aSd2.f);
}
} else {
ZI.IeS ieS3 = new ZI.IeS() { // from class: o.aSb
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6621cYR.ufv) obj).e();
}
};
if (c1928aSd2.f != 0) {
ieS3.e(c1928aSd2.f);
}
}
return inflate;
}
public final void e(boolean z) {
Context context = getContext();
if (isDetached() || context == null) {
return;
}
List<C0613Kq> list = this.h;
C0605Kk.HBt hBt = new C0605Kk.HBt((byte) 0);
hBt.i = this.l;
hBt.d = this.d;
hBt.c = this.p;
String str = this.p;
hBt.a = str == null ? null : getString(R.string.reference_id, str);
String str2 = this.j;
hBt.e = str2 != null ? getString(R.string.loan_app_id, str2) : null;
hBt.b = this.s;
this.g = C12928fLf.e(list, new C0605Kk(hBt, (byte) 0), context, true, "LOANS".equals(this.f) || "COMMERCIAL".equals(this.f), !"COMMERCIAL".equals(this.f) ? 1 : 0, z).subscribe(new eTW(this), new eTX(this));
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
C1928aSd c1928aSd = this.presenter;
if (c1928aSd != null) {
c1928aSd.w_();
}
fSJ fsj = this.g;
if (fsj != null) {
fsj.dispose();
}
super.onDestroy();
}
@Override // androidx.fragment.app.Fragment
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
C10966eUb.b(this, i, iArr);
}
public static void d() {
guQ.b("onNeverAskAgain", new Object[0]);
}
public final void c(InterfaceC15577gud interfaceC15577gud) {
guQ.b("onShowRationale", new Object[0]);
((CustomDialog) CustomDialog.e(new Object[]{CustomDialog.b(getContext()).c(R.string.permission_storage_title).d(R.string.permission_storage).aoT_(R.string.permission_allow, new DialogInterface.OnClickListener(interfaceC15577gud) { // from class: o.eTY
private InterfaceC15577gud c;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
this.c.c();
}
{
this.c = interfaceC15577gud;
}
}), Integer.valueOf(R.string.permission_deny), new DialogInterface.OnClickListener(interfaceC15577gud) { // from class: o.eTV
private InterfaceC15577gud c;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
this.c.e();
}
{
this.c = interfaceC15577gud;
}
}})).show();
}
public static void f() {
guQ.b("onPermissionDenied", new Object[0]);
}
public static void h() {
guQ.b("onNeverAskAgainAndroid13", new Object[0]);
}
public static void j() {
guQ.b("onPermissionDeniedAndroid13", new Object[0]);
}
@Override // o.InterfaceC6621cYR.ufv
public final void d(C0613Kq c0613Kq, int i) {
String str = this.f;
str.hashCode();
if (str.equals("LOANS")) {
this.i.a(c0613Kq, i, true, 1);
} else if (str.equals("COMMERCIAL")) {
this.i.a(c0613Kq, i, true, 0);
} else {
this.i.a(c0613Kq, i, false, 1);
}
this.successCommonView.removeAllViews();
this.successCommonView.addView(this.i);
}
@Override // o.InterfaceC6621cYR.ufv
public final void a() {
this.c = true;
this.m = true;
this.autoSaveOffSaveButton.setVisibility(8);
c(false);
}
@OnClick
public void saveSlipButton() {
this.m = true;
c(true);
}
@OnClick
public void onReturnButtonClicked() {
getActivity().finish();
EasycashLandingActivity.c(getContext());
}
public static /* synthetic */ void a(EasycashSuccessFragment easycashSuccessFragment, Throwable th) {
guQ.a(th, "onSaveScreenshotError", new Object[0]);
FragmentActivity activity = easycashSuccessFragment.getActivity();
if (easycashSuccessFragment.isDetached() || activity == null) {
return;
}
EnumC8951daY enumC8951daY = EnumC8951daY.ERROR;
FragmentActivity activity2 = easycashSuccessFragment.getActivity();
if (activity2 != null) {
String string = easycashSuccessFragment.getString(R.string.saved_slip_error);
if (easycashSuccessFragment.getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) easycashSuccessFragment.getActivity(), activity2, Integer.valueOf(R.id.success_view_container), string, enumC8951daY}, 855668825, -855668822, R.id.success_view_container);
}
}
}
public static /* synthetic */ void asg_(EasycashSuccessFragment easycashSuccessFragment, Uri uri) {
FragmentActivity activity = easycashSuccessFragment.getActivity();
if (uri.toString().isEmpty() || !easycashSuccessFragment.getUserVisibleHint() || activity == null || !easycashSuccessFragment.m) {
return;
}
EnumC8951daY enumC8951daY = EnumC8951daY.SUCCESS;
FragmentActivity activity2 = easycashSuccessFragment.getActivity();
if (activity2 != null) {
String string = easycashSuccessFragment.getString(R.string.saved_slip);
if (easycashSuccessFragment.getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) easycashSuccessFragment.getActivity(), activity2, Integer.valueOf(R.id.success_view_container), string, enumC8951daY}, 855668825, -855668822, R.id.success_view_container);
}
}
easycashSuccessFragment.m = false;
}
private void c(boolean z) {
if (getActivity() != null) {
if (BaseActivity.P()) {
C10966eUb.b(this, z);
return;
}
}
C10966eUb.c(this, z);
}
@Override // o.InterfaceC6621cYR.ufv
public final void e() {
Context context = getContext();
if (!isDetached() && context != null) {
List<C0613Kq> list = this.h;
C0605Kk.HBt hBt = new C0605Kk.HBt((byte) 0);
hBt.i = this.l;
hBt.d = this.d;
hBt.c = this.p;
String str = this.p;
hBt.a = str == null ? null : getString(R.string.reference_id, str);
String str2 = this.j;
hBt.e = str2 != null ? getString(R.string.loan_app_id, str2) : null;
hBt.b = this.s;
this.g = C12928fLf.e(list, new C0605Kk(hBt, (byte) 0), context, this.c, "LOANS".equals(this.f), !"COMMERCIAL".equals(this.f) ? 1 : 0, false).subscribe(new eTW(this), new eTX(this));
}
this.c = false;
this.m = false;
this.autoSaveOffSaveButton.setVisibility(0);
}
}