导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - KYCVerifyActivity.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 KYCVerifyActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bm.sc.bebasbayar.ui.activity.account;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.SearchView;
import androidx.core.app.ActivityCompat;
import com.bm.sc.auth.ui.BottomNavigationActivity;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.handler.MessageComposer;
import com.bm.sc.bebasbayar.handler.MessageSender;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.MessageProcess;
import com.bm.sc.bebasbayar.message.BaseMessage;
import com.bm.sc.bebasbayar.message.mp.DetailMessage;
import com.bm.sc.bebasbayar.message.mp.ReportingMessage;
import com.bm.sc.bebasbayar.setting.ApiConfig;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.ui.BaseActivity;
import com.bm.sc.bebasbayar.ui.activity.account.KYCVerifyActivity;
import com.bm.sc.bebasbayar.ui.activity.ubp.PajakNegaraActivity;
import com.bm.sc.bebasbayar.ui.fragment.kyc.KycCameraCardFragment;
import com.bm.sc.bebasbayar.ui.fragment.kyc.KycCameraFaceFragment;
import com.bm.sc.util.android.Imagery;
import com.bm.sc.util.common.Var;
import com.bm.sc.util.format.DateTime;
import com.google.android.material.textfield.TextInputEditText;
import com.orhanobut.dialogplus.DialogPlus;
import com.orhanobut.dialogplus.ViewHolder;
import defpackage.ii0;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Objects;

public class KYCVerifyActivity extends BaseActivity {
    public static TextInputEditText P = null;
    public static final int PICK_FROM_CAMERA = 11111;
    public static final double SELFIE_PREF_DIM = 850.0d;
    public static final String TAG = "KYCVerifyActivity";
    public boolean A;
    public boolean B;
    public boolean C;
    public boolean D;
    public byte E;
    public byte F;
    public String G;
    public File I;
    public File J;
    public File K;
    public TextInputEditText L;
    public TextInputEditText M;
    public String N;
    public TextView e;
    public TextView f;
    public TextView g;
    public TextView h;
    public TextView i;
    public TextView j;
    public ImageView k;
    public View l;
    public View m;
    public View n;
    public View o;
    public View p;
    public CheckBox q;
    public CheckBox r;
    public ArrayList<HashMap<String, Object>> s;
    public ArrayList<HashMap<String, Object>> t;
    public HashMap<String, Object> u;
    public Uri v;
    public Uri w;
    public Uri x;
    public boolean y;
    public boolean z;
    public InputStream c = null;
    public BufferedInputStream d = null;
    public Bitmap H = null;
    public View.OnClickListener O = new View.OnClickListener() {
        @Override
        public final void onClick(View view) {
            KYCVerifyActivity.this.T(view);
        }
    };

    public class a implements TextWatcher {
        public String a;
        public boolean b;

        public a() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (this.b) {
                return;
            }
            this.b = true;
            editable.clear();
            editable.insert(0, this.a);
            this.b = false;
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (charSequence.toString().equals(this.a) || this.b || charSequence.toString().length() > 10) {
                return;
            }
            String replaceAll = charSequence.toString().replaceAll("\\D", "");
            int length = replaceAll.length();
            if (length < 3 || length > 8) {
                this.a = replaceAll;
                return;
            }
            if (length <= 4) {
                this.a = String.format(Locale.getDefault(), "%s/%s", replaceAll.substring(0, 2), replaceAll.substring(2));
            } else {
                this.a = String.format(Locale.getDefault(), "%s/%s/%s", replaceAll.substring(0, 2), replaceAll.substring(2, 4), replaceAll.substring(4));
            }
        }
    }

    public class b implements TextWatcher {
        public String a;
        public boolean b;

        public b() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (this.b) {
                return;
            }
            this.b = true;
            editable.clear();
            editable.insert(0, this.a);
            this.b = false;
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (charSequence.toString().equals(this.a) || this.b) {
                return;
            }
            this.a = charSequence.toString().toUpperCase();
        }
    }

    public class c implements MessageProcess {
        public c() {
        }

        public void b(int i, Boolean bool) {
            KYCVerifyActivity.this.L();
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            DetailMessage detailMessage = new DetailMessage(baseMessage);
            if (detailMessage.isOK()) {
                ((BaseActivity) KYCVerifyActivity.this).appSession.store(AppSession.PROPERTY_OWNER_NAME, detailMessage.getValueFromAdditional_data(0));
                Affinity.purge(KYCVerifyActivity.this, KYCVerifyDetailActivity.class, KYCVerifyDetailActivity.getBundle(detailMessage.getStruks()));
            } else if (!detailMessage.getResponse_code().equals("23")) {
                Affinity.info(KYCVerifyActivity.this, false, detailMessage.getMessageDescription());
            } else {
                SearchView.OnQueryTextListener onQueryTextListener = KYCVerifyActivity.this;
                Affinity.info(onQueryTextListener, -1, onQueryTextListener.getString(R.string.title_confirm), detailMessage.getMessageDescription(), new BBCallback() {
                    @Override
                    public final void do_callback(int i, Object obj) {
                        KYCVerifyActivity.c.this.b(i, (Boolean) obj);
                    }
                });
            }
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
        }
    }

    public class d implements MessageProcess {
        public final HashMap a;

        public d(HashMap hashMap) {
            this.a = hashMap;
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            boolean z;
            if (baseMessage.getMap().get("rc") == null) {
                z = Var.toBoolean(baseMessage.getItem(ReportingMessage.STATUS_TRANSAKSI_SUCCESS), false);
            } else {
                Object obj = baseMessage.getMap().get("rc");
                Objects.requireNonNull(obj);
                z = Var.toBoolean(Boolean.valueOf(obj.equals("00")), false);
            }
            new HashMap();
            if (!z) {
                KYCVerifyActivity.this.N(Var.toString(baseMessage.getMap().get("rd"), "Identifikasi Gagal"));
                return;
            }
            HashMap hashMap = Var.toHashMap(baseMessage.getItem("data"));
            String var = Var.toString(hashMap.get("nik"), "");
            String var2 = Var.toString(hashMap.get("nama"), "");
            String var3 = Var.toString(hashMap.get("tanggal_lahir"), "");
            this.a.put("nik", var);
            this.a.put("nama", var2);
            this.a.put("ttl", var3);
            KYCVerifyActivity.this.n.setVisibility(0);
            KYCVerifyActivity.this.f.setVisibility(0);
            KYCVerifyActivity.this.g.setBackgroundResource(0);
            KYCVerifyActivity.this.g.setText(KYCVerifyActivity.this.getString(R.string.kyc_verify_btn_retry));
            KYCVerifyActivity.this.g.setTextColor(KYCVerifyActivity.this.getResources().getColor(R.color.new_button_text_color));
            KYCVerifyActivity.this.e.setText(KYCVerifyActivity.this.getString(R.string.kyc_verify_idcard_succes_vision));
            KYCVerifyActivity.this.L.setText(var);
            KYCVerifyActivity.this.L.setFocusable(false);
            KYCVerifyActivity.this.L.setClickable(false);
            KYCVerifyActivity.this.L.setFocusableInTouchMode(false);
            KYCVerifyActivity.this.L.setLongClickable(false);
            KYCVerifyActivity.this.L.setInputType(0);
            KYCVerifyActivity.this.M.setText(var2.replaceAll(",", " "));
            KYCVerifyActivity.this.M.setAllCaps(true);
            KYCVerifyActivity.P.setText(var3);
            KYCVerifyActivity.this.N = "KTP";
            KYCVerifyActivity.this.f0();
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
        }
    }

    public void Q(DialogPlus dialogPlus, View view) {
        this.N = PajakNegaraActivity.PASPOR;
        this.n.setVisibility(0);
        this.f.setVisibility(0);
        this.g.setBackgroundResource(0);
        this.g.setText(getString(R.string.kyc_verify_btn_retry));
        this.g.setTextColor(getResources().getColor(R.color.new_button_text_color));
        this.M.setText("");
        this.L.setText("");
        this.L.setEnabled(true);
        this.L.setFocusable(true);
        this.L.setClickable(true);
        this.L.setFocusableInTouchMode(true);
        this.L.setLongClickable(true);
        this.L.setInputType(524288);
        f0();
        this.o.setVisibility(0);
        this.p.setVisibility(0);
        this.o.setOnClickListener(this.O);
        this.p.setOnClickListener(this.O);
        this.e.setText(getString(R.string.kyc_label_other_card));
        dialogPlus.dismiss();
    }

    public void R(DialogPlus dialogPlus, View view) {
        this.N = "KTP";
        this.e.setText(getString(R.string.kyc_verify_idcard_subheading2));
        this.n.setVisibility(8);
        this.f.setVisibility(8);
        this.g.setBackgroundResource(0);
        this.g.setText(getString(R.string.kyc_verify_btn_retry));
        this.g.setTextColor(getResources().getColor(R.color.new_button_text_color));
        dialogPlus.dismiss();
        O();
    }

    public void S(int i, Boolean bool) {
        if (bool.booleanValue()) {
            ActivityCompat.requestPermissions(this, new String[]{"android.permission.CAMERA"}, DetailDocumentActivity.REQUEST_CAMERA_PERMISSIONS);
        } else {
            Affinity.info(this, false, getString(R.string.transaction_camera_permission_denied));
        }
    }

    public void T(View view) {
        if (view.getId() == 2131362751 || view.getId() == 2131362587) {
            this.q.setChecked(true);
            this.r.setChecked(false);
            this.N = "SIM";
        } else if (view.getId() == 2131362746 || view.getId() == 2131362575) {
            this.r.setChecked(true);
            this.q.setChecked(false);
            this.N = PajakNegaraActivity.PASPOR;
        }
    }

    public void U() {
        this.t = new ArrayList<>();
        this.t = P(this.s);
        i0();
    }

    public void V(View view) {
        onBackPressed();
    }

    public void W(Uri uri) {
        this.v = uri;
        String path = this.v.getPath();
        Objects.requireNonNull(path);
        this.I = new File(path);
        this.J = new File(this.v.getPath());
        StringBuilder sb = new StringBuilder();
        sb.append("mImageCaptureUri ");
        sb.append(this.v.toString());
        StringBuilder sb2 = new StringBuilder();
        sb2.append("filePhoto ");
        sb2.append(this.I.toString());
        double length = (new File(this.I.toString()).length() / 1024) / 1024.0d;
        if (length > 20.0d) {
            N("Ukuran File foto " + length + "Mb elebihi batas yang diizinkan 20 Mb");
        } else {
            StringBuilder sb3 = new StringBuilder();
            sb3.append("ukuran file foto Mb ");
            sb3.append(length);
        }
        try {
            this.c = getContentResolver().openInputStream(this.v);
        } catch (FileNotFoundException e) {
            StringBuilder sb4 = new StringBuilder();
            sb4.append("error inputStream");
            sb4.append(e);
            e.printStackTrace();
        }
        if (this.c != null) {
            try {
                this.d = new BufferedInputStream(this.c);
            } catch (Exception e2) {
                StringBuilder sb5 = new StringBuilder();
                sb5.append("error bufferedInputStream");
                sb5.append(e2);
                e2.printStackTrace();
            }
        }
        this.H = null;
        try {
            this.H = BitmapFactory.decodeStream(this.d);
        } catch (Exception e3) {
            StringBuilder sb6 = new StringBuilder();
            sb6.append("error bitmap");
            sb6.append(e3);
            e3.printStackTrace();
        }
        try {
            Bitmap bitmap = this.H;
            if (bitmap != null) {
                Bitmap rotatedBitmapFromBitmap = Imagery.getRotatedBitmapFromBitmap(this, bitmap, this.I);
                this.H = rotatedBitmapFromBitmap;
                if (rotatedBitmapFromBitmap != null) {
                    this.H = Imagery.getCropBitmapFromBitmap(rotatedBitmapFromBitmap);
                }
            }
            if (length > 1.0d) {
                this.J = compressImage(this.H, Double.valueOf(length));
            }
            if (length > 7.0d) {
                this.I = compressImage(this.H, Double.valueOf(length));
            }
        } catch (Exception e4) {
            StringBuilder sb7 = new StringBuilder();
            sb7.append("error bitmap");
            sb7.append(e4);
            e4.printStackTrace();
        }
        Bitmap bitmap2 = this.H;
        if (bitmap2 != null) {
            this.k.setImageBitmap(bitmap2);
            byte b2 = this.E;
            if (b2 == 0) {
                this.C = this.v != null;
            } else if (b2 == 1) {
                this.D = this.v != null;
            }
            this.l.setVisibility(8);
            this.m.setVisibility(0);
            if (this.N.equals("KTP")) {
                this.G = bitmapToString(this.H);
                e0();
            } else {
                this.n.setVisibility(0);
                this.f.setVisibility(0);
                this.g.setBackgroundResource(0);
                this.g.setText(getString(R.string.kyc_verify_btn_retry));
                this.g.setTextColor(getResources().getColor(R.color.new_button_text_color));
                this.o.setVisibility(0);
                this.p.setVisibility(0);
                this.o.setOnClickListener(this.O);
                this.p.setOnClickListener(this.O);
                this.e.setText(getString(R.string.kyc_label_other_card));
            }
            Uri imageUri = Imagery.getImageUri(this, this.H);
            Objects.requireNonNull(imageUri);
            String path2 = imageUri.getPath();
            Objects.requireNonNull(path2);
            this.I = new File(path2);
        }
    }

    public void X(final Uri uri) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                KYCVerifyActivity.this.W(uri);
            }
        });
    }

    public void Y(Uri uri) {
        this.v = uri;
        String path = this.v.getPath();
        Objects.requireNonNull(path);
        this.I = new File(path);
        this.K = new File(this.v.getPath());
        StringBuilder sb = new StringBuilder();
        sb.append("mImageCaptureUri ");
        sb.append(this.v.toString());
        StringBuilder sb2 = new StringBuilder();
        sb2.append("filePhoto ");
        sb2.append(this.I.toString());
        double length = (new File(this.I.toString()).length() / 1024) / 1024.0d;
        if (length > 20.0d) {
            N("Ukuran File selfie " + length + "Mb elebihi batas yang diizinkan 20 Mb");
        } else {
            StringBuilder sb3 = new StringBuilder();
            sb3.append("ukuran file selfie Mb ");
            sb3.append(length);
        }
        try {
            this.c = getContentResolver().openInputStream(this.v);
        } catch (FileNotFoundException e) {
            StringBuilder sb4 = new StringBuilder();
            sb4.append("error inputStream");
            sb4.append(e);
            e.printStackTrace();
        }
        if (this.c != null) {
            try {
                this.d = new BufferedInputStream(this.c);
            } catch (Exception e2) {
                StringBuilder sb5 = new StringBuilder();
                sb5.append("error bufferedInputStream");
                sb5.append(e2);
                e2.printStackTrace();
            }
        }
        this.H = null;
        try {
            this.H = BitmapFactory.decodeStream(this.d);
        } catch (Exception e3) {
            StringBuilder sb6 = new StringBuilder();
            sb6.append("error bitmap");
            sb6.append(e3);
            e3.printStackTrace();
        }
        try {
            Bitmap bitmap = this.H;
            if (bitmap != null) {
                this.H = Imagery.getRotatedBitmapFromBitmap(this, bitmap, this.I);
            }
            if (length > 1.0d) {
                this.K = compressImage(this.H, Double.valueOf(length));
            }
        } catch (Exception e4) {
            StringBuilder sb7 = new StringBuilder();
            sb7.append("error bitmap");
            sb7.append(e4);
            e4.printStackTrace();
        }
        Bitmap bitmap2 = this.H;
        if (bitmap2 != null) {
            this.k.setImageBitmap(bitmap2);
            this.f.setVisibility(0);
            this.g.setBackgroundResource(0);
            this.g.setText(getString(R.string.kyc_verify_btn_retry));
            this.g.setTextColor(getResources().getColor(R.color.new_button_text_color));
            byte b2 = this.E;
            if (b2 == 0) {
                this.C = this.v != null;
            } else if (b2 == 1) {
                this.D = this.v != null;
            }
            this.l.setVisibility(8);
            this.m.setVisibility(0);
        }
    }

    public void Z(final Uri uri) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                KYCVerifyActivity.this.Y(uri);
            }
        });
    }

    public final void L() {
        Bundle bundle = new Bundle();
        bundle.putString("FromReservation", "0");
        Affinity.purge(this, BottomNavigationActivity.class, bundle);
    }

    public final String M(Bitmap bitmap, boolean z) {
        double width = bitmap.getWidth();
        double height = bitmap.getHeight();
        double d2 = width > height ? z ? 600.0d / width : 850.0d / width : z ? 600.0d / height : 850.0d / height;
        return Imagery.createBase64FromBitmap(Bitmap.createScaledBitmap(bitmap, (int) (width * d2), (int) (height * d2), false));
    }

    public final void N(String str) {
        final DialogPlus create = DialogPlus.newDialog(this).setContentHolder(new ViewHolder(LayoutInflater.from(this).inflate(R.layout.dialog_confirm_switch_card_kyc, (ViewGroup) null, false))).setContentWidth(-1).setContentHeight(-2).setCancelable(false).setOnCancelListener(new ii0()).setContentBackgroundResource(R.color.colorTransparent).setGravity(17).create();
        create.show();
        View holderView = create.getHolderView();
        ((TextView) holderView.findViewById(R.id.tv_error)).setText(str);
        View findViewById = holderView.findViewById(R.id.btn_other);
        View findViewById2 = holderView.findViewById(R.id.btn_nik);
        findViewById.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KYCVerifyActivity.this.Q(create, view);
            }
        });
        findViewById2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KYCVerifyActivity.this.R(create, view);
            }
        });
    }

    public final void O() {
        if (Affinity.isPermissionGranted(this, "android.permission.CAMERA")) {
            a0();
        } else {
            Affinity.confirm(this, getString(R.string.title_confirm), getString(R.string.transaction_camera_permission), new BBCallback() {
                @Override
                public final void do_callback(int i, Object obj) {
                    KYCVerifyActivity.this.S(i, (Boolean) obj);
                }
            });
        }
    }

    public final ArrayList<HashMap<String, Object>> P(ArrayList<HashMap<String, Object>> arrayList) {
        ArrayList<HashMap<String, Object>> arrayList2 = new ArrayList<>();
        if (!arrayList.isEmpty()) {
            Iterator<HashMap<String, Object>> it = arrayList.iterator();
            while (it.hasNext()) {
                HashMap<String, Object> next = it.next();
                String var = Var.toString(next.get("id"), "");
                if (var.equals("1")) {
                    M(Imagery.getBitmapReduceFromUri(this, this.w), true);
                    next.put("file_raw", "");
                } else if (var.equals("6")) {
                    M(Imagery.getBitmapReduceFromUri(this, this.x), false);
                    next.put("file_raw", "");
                }
                arrayList2.add(next);
            }
        }
        return arrayList2;
    }

    public final void a0() {
        if (!this.A && !this.B && !this.C) {
            b0();
        } else if (this.C && this.E == 0) {
            b0();
        } else {
            c0();
        }
    }

    public final void b0() {
        ?? newInstance = KycCameraCardFragment.newInstance();
        newInstance.setOnCaptureListener(new KycCameraCardFragment.OnCaptureListener() {
            @Override
            public final void onSaveUri(Uri uri) {
                KYCVerifyActivity.this.X(uri);
            }
        });
        newInstance.show(getSupportFragmentManager(), "card-camera");
    }

    public final String bitmapToString(Bitmap bitmap) {
        double width = bitmap.getWidth();
        double height = bitmap.getHeight();
        double d2 = width > height ? 600.0d / width : 600.0d / height;
        Bitmap.createScaledBitmap(bitmap, (int) (width * d2), (int) (height * d2), false);
        return Imagery.createBase64FromBitmap(bitmap);
    }

    public final void c0() {
        ?? newInstance = KycCameraFaceFragment.newInstance();
        newInstance.setOnCaptureListener(new KycCameraFaceFragment.OnCaptureListener() {
            @Override
            public final void onSaveUri(Uri uri) {
                KYCVerifyActivity.this.Z(uri);
            }
        });
        newInstance.show(getSupportFragmentManager(), "face-camera");
    }

    public java.io.File compressImage(android.graphics.Bitmap r8, java.lang.Double r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.bm.sc.bebasbayar.ui.activity.account.KYCVerifyActivity.compressImage(android.graphics.Bitmap, java.lang.Double):java.io.File");
    }

    public final void d0() {
        this.f.setVisibility(8);
        this.g.setBackgroundResource(R.drawable.bb_background_gradient_round);
        this.g.setText(getString(R.string.kyc_verify_btn));
        this.g.setTextColor(getResources().getColor(R.color.White));
    }

    public final void e0() {
        HashMap hashMap = new HashMap();
        MessageComposer messageComposer = new MessageComposer(99, ApiConfig.getBaseUrl()[0] + "vision_v2/ktp");
        messageComposer.setRequest_method(MessageComposer.POST);
        messageComposer.setData_type(4);
        messageComposer.setKeyFile_1("idCard");
        messageComposer.setFile_1(this.I);
        messageComposer.setShowProgressRegular(true);
        messageComposer.setIs_encrypted(false);
        messageComposer.setRead_timeout(90);
        messageComposer.setMessageProcess(new d(hashMap));
        new MessageSender(this, messageComposer).execute();
    }

    public final void f0() {
        this.M.addTextChangedListener(new b());
    }

    public final void g0(byte b2) {
        this.F = b2;
        this.m.setVisibility(8);
        this.l.setVisibility(0);
        d0();
        byte b3 = this.F;
        if (b3 == 2) {
            this.h.setText(getString(R.string.kyc_verify_idcard_title));
            this.i.setText(getString(R.string.kyc_verify_idcard_subheading));
            this.j.setText(getString(R.string.kyc_verify_idcard_subheading1));
            setTitle("Verifikasi e-KTP");
            return;
        }
        if (b3 == 3) {
            this.h.setText(getString(R.string.kyc_verify_selfie_title));
            this.i.setText(getString(R.string.kyc_verify_selfie_subheading));
            this.j.setText(getString(R.string.kyc_verify_selfie_subheading1));
            setTitle("Verifikasi Wajah");
        }
    }

    @Override
    public int getLayoutResource() {
        return R.layout.activity_kyc_verify;
    }

    @Override
    public String getWikiNameSpace() {
        return null;
    }

    public final void h0(byte b2) {
        this.E = b2;
        this.l.setVisibility(8);
        this.m.setVisibility(0);
        if (b2 == 0) {
            setTitle("Verifikasi Identitas");
            this.e.setText(getString(R.string.kyc_verify_idcard_subheading2));
            this.k.setImageResource(R.drawable.ic_idcard_example);
            this.n.setVisibility(8);
            return;
        }
        if (b2 == 1) {
            setTitle("Verifikasi Wajah");
            this.e.setText(getString(R.string.kyc_verify_selfie_subheading2));
            this.k.setImageResource(R.drawable.ic_selfie_example);
            this.n.setVisibility(8);
        }
    }

    public final void i0() {
        Editable text = P.getText();
        Objects.requireNonNull(text);
        String obj = text.toString();
        Editable text2 = this.M.getText();
        Objects.requireNonNull(text2);
        String obj2 = text2.toString();
        Editable text3 = this.L.getText();
        Objects.requireNonNull(text3);
        String obj3 = text3.toString();
        if (!obj.isEmpty()) {
            obj = Var.toString(DateTime.convert(obj, "dd/MM/yyyy", "yyyy-MM-dd"), "");
        }
        if (obj.isEmpty() || obj2.isEmpty() || obj3.isEmpty()) {
            Affinity.info(this, false, "Mohon Lengkapi Data Anda");
            return;
        }
        DetailMessage detailMessage = new DetailMessage(this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID), this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_PIN), this.appSession.retrieve(AppSession.PROPERTY_AUTH_TOKEN));
        detailMessage.setProductCode(DetailMessage.INC_PRODUCT_CODE_UPLOAD);
        detailMessage.setUploads_detail(this.t);
        detailMessage.setAdditional_dataValue(0, obj2);
        detailMessage.setAdditional_dataValue(14, Var.toString(this.u.get("ibu_kandung"), ""));
        detailMessage.setAdditional_dataValue(1, this.appSession.retrieve(AppSession.PROPERTY_ADDRESS));
        detailMessage.setAdditional_dataValue(2, this.appSession.retrieve(AppSession.PROPERTY_POSTCODE));
        detailMessage.setAdditional_dataValue(4, this.appSession.retrieve(AppSession.PROPERTY_PROVINCE));
        detailMessage.setAdditional_dataValue(3, this.appSession.retrieve(AppSession.PROPERTY_CITY));
        detailMessage.setAdditional_dataValue(13, obj3);
        detailMessage.setAdditional_dataValue(39, Var.toString(this.u.get("pekerjaan"), ""));
        detailMessage.setAdditional_dataValue(38, Var.toString(this.u.get("jenis_usaha"), ""));
        detailMessage.setAdditional_dataValue(12, obj);
        detailMessage.setAdditional_dataValue(5, this.appSession.retrieve(AppSession.PROPERTY_HANDPHONE));
        detailMessage.setAdditional_dataValue(11, this.appSession.retrieve(AppSession.PROPERTY_EMAIL));
        detailMessage.setAdditional_dataValue(18, Var.toString(this.u.get("ym"), ""));
        detailMessage.setAdditional_dataValue(19, Var.toString(this.u.get("gtalk"), ""));
        detailMessage.setAdditional_dataValue(22, Var.toString(this.u.get("whatsapp"), ""));
        detailMessage.setAdditional_dataValue(37, Var.toString(this.u.get("telegram"), ""));
        detailMessage.setAdditional_dataValue(34, Var.toString(this.u.get("bbm"), ""));
        detailMessage.setAdditional_dataValue(35, this.appSession.retrieve(AppSession.PROPERTY_GENDER));
        MessageComposer messageComposer = new MessageComposer(99, ApiConfig.getBaseUrl()[0] + "vision_v2/upload-kyc");
        messageComposer.setRequest_method(MessageComposer.POST);
        messageComposer.setData_type(4);
        messageComposer.setIs_credential(true);
        messageComposer.setShowProgressRegular(true);
        messageComposer.setIs_encrypted(true);
        messageComposer.setRead_timeout(90);
        messageComposer.setKeyFile_1("docIdCard");
        messageComposer.setFile_1(this.J);
        messageComposer.setKeyFile_2("docSelfie");
        messageComposer.setFile_2(this.K);
        messageComposer.setMultipart_data_type(1);
        messageComposer.setKeyMessageMultipart("rawBody");
        messageComposer.setMessageProcess(new c());
        MessageSender messageSender = new MessageSender(this, messageComposer);
        messageSender.setRequestMessage(detailMessage);
        messageSender.execute();
    }

    @Override
    public boolean isEligibleForFavorit() {
        return false;
    }

    @Override
    public void onBackPressed() {
        if (this.E == 0 && this.l.getVisibility() == 8) {
            this.C = false;
            this.N = "KTP";
            this.o.setVisibility(8);
            this.p.setVisibility(8);
            g0((byte) 2);
            return;
        }
        if (this.E == 1 && this.l.getVisibility() == 8 && (this.A || this.B || this.C)) {
            this.D = false;
            g0((byte) 3);
        } else {
            if (this.F != 3 || !this.C) {
                super.onBackPressed();
                return;
            }
            this.s = new ArrayList<>();
            this.C = false;
            this.B = false;
            this.A = false;
            h0((byte) 0);
        }
    }

    @Override
    public void onClick(View view) {
        Object obj;
        if (view.getId() == 2131362425) {
            if (this.A || this.B || this.C) {
                h0((byte) 1);
                return;
            } else {
                h0((byte) 0);
                return;
            }
        }
        if (view.getId() == 2131362375) {
            O();
            return;
        }
        if (view.getId() != 2131362370) {
            super.onClick(view);
            return;
        }
        boolean z = this.A;
        if (z && this.B && !this.y && !this.z) {
            if (this.D) {
                Affinity.toast(this, "Mohon menunggu data anda sedang kami proses");
                HashMap<String, Object> hashMap = new HashMap<>();
                if (this.H == null) {
                    Affinity.info(this, false, "Silakan ambil gambar terlebih dahulu!");
                    return;
                }
                this.x = Uri.fromFile(this.I);
                hashMap.put("id", "6");
                hashMap.put("kode_dokumen", "SELFIEID");
                hashMap.put("nama_dokumen", "Selfie Wajah dan KTP");
                hashMap.put("time_upload", DateTime.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
                hashMap.put("time_verifikasi", 0);
                hashMap.put("ket_verifikasi", "");
                hashMap.put("status", "");
                hashMap.put("no_file", "");
                if (this.s.size() < 2) {
                    this.s.add(hashMap);
                }
                if (this.v != null) {
                    this.v = null;
                }
                runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        KYCVerifyActivity.this.U();
                    }
                });
                return;
            }
            return;
        }
        if (z) {
            obj = "6";
        } else {
            obj = "6";
            if (!this.B && this.y && this.z) {
                if (this.C) {
                    HashMap<String, Object> hashMap2 = new HashMap<>();
                    if (this.H == null) {
                        Affinity.info(this, false, "Silakan ambil gambar terlebih dahulu!");
                        return;
                    }
                    this.w = Uri.fromFile(this.I);
                    hashMap2.put("id", "1");
                    hashMap2.put("kode_dokumen", "IDCARD");
                    hashMap2.put("nama_dokumen", this.N);
                    hashMap2.put("time_upload", DateTime.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
                    hashMap2.put("time_verifikasi", 0);
                    hashMap2.put("ket_verifikasi", "");
                    hashMap2.put("status", "");
                    hashMap2.put("no_file", "");
                    if (this.s.size() < 2) {
                        this.s.add(hashMap2);
                    }
                    if (this.v != null) {
                        this.v = null;
                        return;
                    }
                    return;
                }
                return;
            }
        }
        Editable text = P.getText();
        Objects.requireNonNull(text);
        String obj2 = text.toString();
        Editable text2 = this.M.getText();
        Objects.requireNonNull(text2);
        String obj3 = text2.toString();
        Editable text3 = this.L.getText();
        Objects.requireNonNull(text3);
        String obj4 = text3.toString();
        if ((this.N.equals("SIM") || this.N.equals(PajakNegaraActivity.PASPOR)) && !this.r.isChecked() && !this.q.isChecked()) {
            Affinity.info(this, false, "Mohon memilih type Kartu Identitas Anda");
            return;
        }
        if (obj4.isEmpty()) {
            Affinity.info(this, false, "Kolom Nomor Identitas tidak boleh kosong!");
            return;
        }
        if (obj3.isEmpty()) {
            Affinity.info(this, false, "Kolom Nama Lengkap tidak boleh kosong!");
            return;
        }
        if (obj2.isEmpty()) {
            Affinity.info(this, false, "Kolom Tanggal Lahir tidak boleh kosong!");
            return;
        }
        Date checkFormat = DateTime.checkFormat(obj2, "dd/MM/yyyy");
        if (checkFormat == null) {
            Affinity.info(this, false, "Pastikan format tanggal lahir sesuai");
            return;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(checkFormat);
        if (calendar.get(1) < 1000) {
            Affinity.info(this, false, "Tahun lahir harus 4 digit");
            return;
        }
        if (calendar.get(1) > 1000 && calendar.get(1) <= 1900) {
            Affinity.info(this, false, "Tahun Lahir harus lebih dari 1900");
            return;
        }
        HashMap<String, Object> hashMap3 = new HashMap<>();
        Bitmap bitmap = this.H;
        if (bitmap == null) {
            Affinity.info(this, false, "Silakan ambil gambar terlebih dahulu!");
            return;
        }
        byte b2 = this.E;
        if (b2 == 0 && this.C) {
            this.G = bitmapToString(bitmap);
            this.w = Uri.fromFile(this.I);
            hashMap3.put("id", "1");
            hashMap3.put("kode_dokumen", "IDCARD");
            hashMap3.put("nama_dokumen", "KTP / SIM / PASPOR");
            hashMap3.put("time_upload", DateTime.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
            hashMap3.put("time_verifikasi", 0);
            hashMap3.put("ket_verifikasi", "");
            hashMap3.put("status", "");
            hashMap3.put("no_file", "");
            if (this.s.size() < 2) {
                this.s.add(hashMap3);
            }
            if (this.v != null) {
                this.v = null;
            }
            this.A = true;
            this.B = true;
            g0((byte) 3);
            return;
        }
        if (b2 == 1 && this.D) {
            this.x = Uri.fromFile(this.I);
            hashMap3.put("id", obj);
            hashMap3.put("kode_dokumen", "SELFIEID");
            hashMap3.put("nama_dokumen", "Selfie Wajah dan KTP");
            hashMap3.put("time_upload", DateTime.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
            hashMap3.put("time_verifikasi", 0);
            hashMap3.put("ket_verifikasi", "");
            hashMap3.put("status", "");
            hashMap3.put("no_file", "");
            if (this.s.size() < 2) {
                this.s.add(hashMap3);
            }
            if (this.v != null) {
                this.v = null;
            }
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.s = new ArrayList<>();
        this.l = findViewById(R.id.kyc_detail_container);
        this.m = findViewById(R.id.kyc_photo_container);
        this.n = findViewById(R.id.result_vision_container);
        this.L = findViewById(R.id.input_idcard);
        findViewById(R.id.input_name_head);
        this.M = findViewById(R.id.input_name);
        TextInputEditText findViewById = findViewById(R.id.input_birthdate);
        P = findViewById;
        findViewById.setInputType(2);
        P.setKeyListener(DigitsKeyListener.getInstance("0123456789/"));
        P.addTextChangedListener(new a());
        this.e = (TextView) findViewById(R.id.kyc_photo_tv);
        this.k = (ImageView) findViewById(R.id.iv_example_img);
        this.f = (TextView) findViewById(R.id.btn_next);
        this.g = (TextView) findViewById(R.id.btn_open_camera);
        this.h = (TextView) findViewById(R.id.kyc_detail_title);
        this.i = (TextView) findViewById(R.id.kyc_detail_idcard_subtitle);
        this.j = (TextView) findViewById(R.id.kyc_detail_desc);
        findViewById(R.id.btn_start).setOnClickListener(this);
        findViewById(R.id.btn_open_camera).setOnClickListener(this);
        findViewById(R.id.btn_next).setOnClickListener(this);
        this.N = "KTP";
        this.o = findViewById(R.id.cl_sim);
        this.p = findViewById(R.id.cl_passport);
        this.q = (CheckBox) findViewById(R.id.cb_sim);
        this.r = (CheckBox) findViewById(R.id.cb_passport);
        this.q.setOnClickListener(this.O);
        this.r.setOnClickListener(this.O);
        if (getIntent().getExtras() != null) {
            Bundle extras = getIntent().getExtras();
            this.u = Var.toHashMap(extras.getSerializable(DetailAccountActivity.POPULATED_ADD_DATA_ACCOUNT));
            this.A = extras.getBoolean(DetailAccountActivity.IS_IDCARD_VALID_KEY, false);
            this.B = extras.getBoolean(DetailAccountActivity.IS_IDCARD_WAIT_KEY, false);
            this.y = extras.getBoolean(DetailAccountActivity.IS_SELFIE_VALID_KEY, false);
            this.z = extras.getBoolean(DetailAccountActivity.IS_SELFIE_WAIT_KEY, false);
            if (this.A && this.B) {
                g0((byte) 3);
            } else {
                g0((byte) 2);
            }
        } else {
            this.u = new HashMap<>();
            this.A = false;
            this.B = false;
            this.y = false;
            this.z = false;
        }
        if (getToolbar() != null) {
            getToolbar().setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    KYCVerifyActivity.this.V(view);
                }
            });
        }
    }

    @Override
    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        if (i != 555) {
            super.onRequestPermissionsResult(i, strArr, iArr);
        } else if (iArr[0] == 0) {
            a0();
        } else {
            Affinity.info(this, false, getString(R.string.transaction_camera_permission_denied));
        }
    }

    public void onRestoreInstanceState(@NonNull Bundle bundle) {
        super/*android.app.Activity*/.onRestoreInstanceState(bundle);
        if (bundle != null) {
            try {
                String string = bundle.getString("filePhoto");
                Objects.requireNonNull(string);
                this.I = new File(string);
                StringBuilder sb = new StringBuilder();
                sb.append("onRestoreInstanceState filePhoto ");
                sb.append(this.I);
                this.v = (Uri) bundle.getParcelable("mImageCaptureUri");
                StringBuilder sb2 = new StringBuilder();
                sb2.append("onRestoreInstanceState mImageCaptureUri ");
                sb2.append(this.v);
                this.E = bundle.getByte("current_view_state");
                this.C = bundle.getBoolean("isUploadIDCard");
                this.D = bundle.getBoolean("isUploadSelfie");
            } catch (Exception e) {
                StringBuilder sb3 = new StringBuilder();
                sb3.append("error onRestoreInstanceState ");
                sb3.append(e);
            }
        }
    }

    public void onSaveInstanceState(@NonNull Bundle bundle) {
        try {
            File file = this.I;
            if (file != null) {
                bundle.putString("filePhoto", file.toString());
            }
            Uri uri = this.v;
            if (uri != null) {
                bundle.putParcelable("mImageCaptureUri", uri);
            }
            if (this.C && this.E == 0) {
                bundle.putByte("current_view_state", (byte) 0);
            } else {
                byte b2 = this.E;
                if (b2 == 0) {
                    bundle.putByte("current_view_state", (byte) 0);
                } else if (b2 == 1) {
                    bundle.putByte("current_view_state", (byte) 1);
                }
            }
            bundle.putBoolean("isUploadIDCard", this.C);
            bundle.putBoolean("isUploadSelfie", this.D);
        } catch (Exception e) {
            StringBuilder sb = new StringBuilder();
            sb.append("error onSaveInstanceState ");
            sb.append(e);
        }
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
    }

    public void saveImageToLocal(String str, String str2) {
        StringBuilder sb = new StringBuilder();
        sb.append("lebar bitmap ");
        sb.append(this.H.getWidth());
        StringBuilder sb2 = new StringBuilder();
        sb2.append("Tinggi bitmap ");
        sb2.append(this.H.getHeight());
        try {
            File file = new File(getCacheDir().toString());
            if (!file.exists() && file.isDirectory()) {
                file.mkdirs();
            }
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(new File(getCacheDir().toString(), str2 + "-" + System.currentTimeMillis() + ".txt")));
            try {
                outputStreamWriter.write(str);
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                outputStreamWriter.close();
            } catch (IOException e2) {
                e2.printStackTrace();
            }
        } catch (FileNotFoundException unused) {
        }
    }
}