导航菜单

页面标题

页面副标题

CreditNow v1.0.2 - FaceAuthenticationActivity.java 源代码

正在查看: CreditNow v1.0.2 应用的 FaceAuthenticationActivity.java JAVA 源代码文件

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


package com.cat.facelibrary.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.hardware.Camera;
import android.os.Bundle;
import android.widget.Toast;
import androidx.activity.result.ActivityResult;
import com.aa.commonuilibrary.base.activity.BaseActivity;
import com.cat.facelibrary.R$string;
import com.cat.facelibrary.databinding.ActivityFaceAuthenticationBinding;
import com.cat.facelibrary.view.FaceAuthenticationActivity;
import com.cat.facelibrary.viewmodel.FaceAuthenticationViewModel;
import com.orhanobut.logger.Logger;
import com.regula.facesdk.configuration.LivenessConfiguration;
import com.regula.facesdk.exception.InitException;
import com.regula.facesdk.exception.LivenessErrorException;
import defpackage.a71;
import defpackage.b20;
import defpackage.f4;
import defpackage.g10;
import defpackage.h10;
import defpackage.h40;
import defpackage.i4;
import defpackage.j4;
import defpackage.j40;
import defpackage.jp;
import defpackage.k4;
import defpackage.k71;
import defpackage.l71;
import defpackage.ph0;
import defpackage.pm3;
import defpackage.px1;
import defpackage.qp1;
import defpackage.tp;
import defpackage.x3;
import defpackage.x30;
import defpackage.z10;
import java.io.File;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;

@Metadata
public final class FaceAuthenticationActivity extends BaseActivity<FaceAuthenticationViewModel, ActivityFaceAuthenticationBinding> {
    public k4<Intent> D1;

    @NotNull
    public String E1 = "";

    @NotNull
    public a71 F1 = a71.a.a;
    public k4<String> G1 = W(new i4(), new f());

    @Metadata
    public final class a {
        public a() {
        }

        public final void a() {
            FaceAuthenticationActivity.this.u1();
        }
    }

    @Metadata
    public class b {
        public static final int[] a;

        static {
            int[] iArr = new int[b72.values().length];
            try {
                iArr[b72.a.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[b72.b.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            a = iArr;
        }
    }

    @Metadata
    public static final class d implements f4<ActivityResult> {
        public d() {
        }

        @Override
        public void a(@NotNull ActivityResult activityResult) {
            Intrinsics.checkNotNullParameter(activityResult, "result");
            if (activityResult.b() == -1) {
                FaceAuthenticationActivity faceAuthenticationActivity = FaceAuthenticationActivity.this;
                faceAuthenticationActivity.L1(faceAuthenticationActivity.E1);
            } else if (activityResult.b() == 0) {
                FaceAuthenticationActivity.this.J1("");
            }
        }
    }

    @Metadata
    public static final class e implements qp1 {
        public e() {
        }

        @Override
        public void a() {
            x30.a().d(FaceAuthenticationActivity.this.Q0(), pm3.a(FaceAuthenticationActivity.this.Q0(), "customerService"));
        }

        @Override
        public void b() {
            FaceAuthenticationActivity.this.w1();
        }
    }

    @Metadata
    public static final class f implements f4<Boolean> {
        public f() {
        }

        @Override
        public void a(Boolean bool) {
            b(bool.booleanValue());
        }

        public void b(boolean z) {
            if (z) {
                FaceAuthenticationActivity.this.F1();
            } else {
                x3.u(FaceAuthenticationActivity.this, "android.permission.CAMERA");
            }
        }
    }

    public static final void C1(FaceAuthenticationActivity faceAuthenticationActivity, boolean z, InitException initException) {
        String str;
        Intrinsics.checkNotNullParameter(faceAuthenticationActivity, "this$0");
        if (z) {
            Logger.d("FaceAuthenticationActivity", new Object[]{"FaceSDK init completed successfully"});
            return;
        }
        if (initException == null || (str = initException.getMessage()) == null) {
            str = "";
        }
        faceAuthenticationActivity.z1("liveness_sdk_fail", px1.c(new l71("init status :" + z, "", str)));
        Toast.makeText(faceAuthenticationActivity.Q0(), "Error en la verificación de identidad. Inténtalo de nuevo.", 1).show();
    }

    public static final void H1(FaceAuthenticationActivity faceAuthenticationActivity, z62 z62Var) {
        Intrinsics.checkNotNullParameter(faceAuthenticationActivity, "this$0");
        Intrinsics.checkNotNullParameter(z62Var, "response");
        Logger.i("FaceAuthenticationActivity-->", new Object[]{"tag:" + z62Var.j()});
        Logger.i("FaceAuthenticationActivity-->", new Object[]{"transactionId:" + z62Var.k()});
        Object[] objArr = new Object[1];
        StringBuilder sb = new StringBuilder();
        sb.append("message: ");
        LivenessErrorException h = z62Var.h();
        sb.append(h != null ? h.getMessage() : null);
        objArr[0] = sb.toString();
        Logger.i("FaceAuthenticationActivity-->", objArr);
        Object[] objArr2 = new Object[1];
        StringBuilder sb2 = new StringBuilder();
        sb2.append("exception:");
        LivenessErrorException h2 = z62Var.h();
        sb2.append(h2 != null ? h2.toString() : null);
        objArr2[0] = sb2.toString();
        Logger.i("FaceAuthenticationActivity-->", objArr2);
        Object[] objArr3 = new Object[1];
        StringBuilder sb3 = new StringBuilder();
        sb3.append("errorCode:");
        LivenessErrorException h3 = z62Var.h();
        sb3.append(h3 != null ? h3.a() : null);
        objArr3[0] = sb3.toString();
        Logger.i("FaceAuthenticationActivity-->", objArr3);
        Logger.i("FaceAuthenticationActivity-->", new Object[]{"status : " + z62Var.i()});
        Logger.i("FaceAuthenticationActivity-->", new Object[]{"status : " + z62Var.i()});
        Logger.i("FaceAuthenticationActivity-->", new Object[]{"estimatedAge:" + z62Var.g()});
        faceAuthenticationActivity.x1(z62Var.k(), z62Var);
    }

    private final void z1(String str, String str2) {
        ((FaceAuthenticationViewModel) O0()).dealWithUploadFaceResultResp(str, str2, new c());
    }

    public final a71 A1() {
        String str = (String) h10.a.b("face_recognition", "CAMERA");
        switch (str.hashCode()) {
            case -585224600:
                if (str.equals("FACE_REGULA_DE")) {
                    return a71.b.a;
                }
                break;
            case -343290264:
                if (str.equals("FACE_REGULA_DONT_DE")) {
                    return a71.b.a;
                }
                break;
            case 346292:
                if (str.equals("FACE_REGULA_CALLBACK_DE")) {
                    return a71.b.a;
                }
                break;
            case 1882843524:
                if (str.equals("FACE_REGULA_DELAY_DE")) {
                    return a71.b.a;
                }
                break;
            case 1940980087:
                if (str.equals("FACE_REGULA_DONT_REFACE")) {
                    return a71.b.a;
                }
                break;
            case 1980544805:
                if (str.equals("CAMERA")) {
                    return a71.a.a;
                }
                break;
        }
        return a71.a.a;
    }

    public final void B1() {
        m71.o().u("https://regula.creditnow.mx/");
        m71.o().s(Q0(), new j71() {
            public final void a(boolean z, InitException initException) {
                FaceAuthenticationActivity.C1(FaceAuthenticationActivity.this, z, initException);
            }
        });
        v1();
    }

    public final boolean D1() {
        int numberOfCameras = Camera.getNumberOfCameras();
        Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
        for (int i = 0; i < numberOfCameras; i++) {
            Camera.getCameraInfo(i, cameraInfo);
            if (cameraInfo.facing == 1) {
                return true;
            }
        }
        return false;
    }

    public final void E1() {
        File a2;
        if (this.D1 == null) {
            return;
        }
        if (!D1()) {
            j40.a.b(j40.a, Q0(), getResources().getString(R$string.cat_face_str_camera_not_available), 0, 4, null);
            z1("liveness_camera_fail", px1.c(new l71("", "", "The front camera is not available")));
            return;
        }
        Intent intent = new Intent();
        intent.setAction("android.media.action.IMAGE_CAPTURE");
        Context Q0 = Q0();
        if (Q0 == null || intent.resolveActivity(Q0.getPackageManager()) == null || (a2 = b20.a.a(Q0)) == null) {
            return;
        }
        String absolutePath = a2.getAbsolutePath();
        Intrinsics.checkNotNullExpressionValue(absolutePath, "getAbsolutePath(...)");
        this.E1 = absolutePath;
        intent.putExtra("output", z10.a.a(Q0, a2, Q0.getPackageName() + ".provider"));
        intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
        k4<Intent> k4Var = this.D1;
        if (k4Var != null) {
            k4Var.a(intent);
        }
    }

    public final void F1() {
        a71 a71Var = this.F1;
        if (Intrinsics.a(a71Var, a71.a.a)) {
            E1();
        } else if (Intrinsics.a(a71Var, a71.b.a)) {
            G1();
        }
    }

    public final void G1() {
        g10.a.i();
        m71.o().v(Q0(), new LivenessConfiguration.a().D(UUID.randomUUID().toString()).e(), new e62() {
            public final void a(z62 z62Var) {
                FaceAuthenticationActivity.H1(FaceAuthenticationActivity.this, z62Var);
            }
        });
    }

    public final void I1() {
        if (g10.a.a()) {
            m71.o().p();
        }
    }

    public final void J1(String str) {
        z1("liveness_cancel", "");
        Intent intent = new Intent();
        k71 k71Var = new k71(8003, "", "", this.F1, "");
        Bundle bundle = new Bundle();
        bundle.putSerializable("FACE_RESULT", k71Var);
        intent.putExtras(bundle);
        setResult(-1, intent);
        finish();
    }

    public final void K1(String str, String str2, String str3) {
        Intent intent = new Intent();
        if (str3 == null) {
            str3 = "";
        }
        z1("liveness_sdk_fail", px1.c(new l71("", str, str3)));
        k71 k71Var = new k71(8002, str, str2, a71.b.a, "");
        Bundle bundle = new Bundle();
        bundle.putSerializable("FACE_RESULT", k71Var);
        intent.putExtras(bundle);
        setResult(-1, intent);
        finish();
    }

    public final void L1(String str) {
        z1("liveness_camera_success", "");
        Intent intent = new Intent();
        k71 k71Var = new k71(8001, "", "", a71.a.a, str);
        Bundle bundle = new Bundle();
        bundle.putSerializable("FACE_RESULT", k71Var);
        intent.putExtras(bundle);
        setResult(-1, intent);
        finish();
    }

    public final void M1(String str) {
        z1("liveness_sdk_success", "");
        Intent intent = new Intent();
        k71 k71Var = new k71(8001, str, "", a71.b.a, "");
        Bundle bundle = new Bundle();
        bundle.putSerializable("FACE_RESULT", k71Var);
        intent.putExtras(bundle);
        setResult(-1, intent);
        finish();
    }

    @Override
    public void V0(Bundle bundle) {
        h40.a.d(this);
        ((ActivityFaceAuthenticationBinding) n1()).setClick(new a());
        this.F1 = A1();
        z1("liveness_access", "");
        if (Intrinsics.a(this.F1, a71.b.a)) {
            B1();
        }
        this.D1 = W(new j4(), new d());
        ((ActivityFaceAuthenticationBinding) n1()).titleAcFaceAuthentication.setCallback(new e());
    }

    @Override
    @SuppressLint({"MissingSuperCall"})
    public void onBackPressed() {
        w1();
    }

    @Override
    public void onDestroy() {
        if (g10.a.b()) {
            m71.o().p();
        }
        super.onDestroy();
    }

    public final void u1() {
        Context Q0 = Q0();
        if (Q0 == null) {
            return;
        }
        if (ph0.a(Q0, "android.permission.CAMERA") == 0) {
            F1();
            return;
        }
        k4<String> k4Var = this.G1;
        if (k4Var != null) {
            k4Var.a("android.permission.CAMERA");
        }
    }

    public final void w1() {
        z1("liveness_cancel", "");
        Intent intent = new Intent();
        k71 k71Var = new k71(8003, "", "", this.F1, "");
        Bundle bundle = new Bundle();
        bundle.putSerializable("FACE_RESULT", k71Var);
        intent.putExtras(bundle);
        setResult(-1, intent);
        finish();
    }

    public final void x1(String str, z62 z62Var) {
        if (z62Var == null) {
            String string = getResources().getString(R$string.cat_face_str_face_fail_common);
            Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
            K1(str, string, "response is null");
            I1();
            return;
        }
        b72 i = z62Var.i();
        int i2 = i == null ? -1 : b.a[i.ordinal()];
        if (i2 == 1) {
            M1(str);
        } else if (i2 != 2) {
            String string2 = getResources().getString(R$string.cat_face_str_face_fail_common);
            Intrinsics.checkNotNullExpressionValue(string2, "getString(...)");
            StringBuilder sb = new StringBuilder();
            LivenessErrorException h = z62Var.h();
            sb.append(h != null ? h.a() : null);
            sb.append(' ');
            LivenessErrorException h2 = z62Var.h();
            sb.append(h2 != null ? h2.getMessage() : null);
            K1(str, string2, sb.toString());
        } else {
            y1(str, z62Var);
        }
        I1();
    }

    public final void y1(String str, z62 z62Var) {
        LivenessErrorException h;
        LivenessErrorException h2;
        LivenessErrorException h3;
        String str2 = null;
        v62 a2 = (z62Var == null || (h3 = z62Var.h()) == null) ? null : h3.a();
        if (a2 == null) {
            a2 = "";
        }
        if (a2 == v62.e) {
            J1(str);
            return;
        }
        String string = getResources().getString(R$string.cat_face_str_face_fail_common);
        Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
        StringBuilder sb = new StringBuilder();
        sb.append((z62Var == null || (h2 = z62Var.h()) == null) ? null : h2.a());
        sb.append(' ');
        if (z62Var != null && (h = z62Var.h()) != null) {
            str2 = h.getMessage();
        }
        sb.append(str2);
        K1(str, string, sb.toString());
    }

    public final void v1() {
    }

    @Metadata
    public static final class c extends jp<tp<Void>> {
        @Override
        public void b(Throwable th) {
        }

        @Override
        public void a(tp<Void> tpVar) {
        }

        @Override
        public void c(tp<Void> tpVar) {
        }
    }
}