导航菜单

页面标题

页面副标题

Mabilis Cash v1.19.4 - PHVerifyLivingV5ResultActivity.java 源代码

正在查看: Mabilis Cash v1.19.4 应用的 PHVerifyLivingV5ResultActivity.java JAVA 源代码文件

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


package com.loans.mabiliscash.auth.living;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.fintopia.face.common.FaceStatisticsEvents;
import com.fintopia.face.models.FaceIdCard;
import com.fintopia.face.models.event.LiveDetectionEvent;
import com.fintopia.libCommon.common.CommonResult;
import com.lingyue.supertoolkit.statistics.TrackingUtil;
import com.lingyue.supertoolkit.tools.customtools.JsonParamsBuilder;
import com.lingyue.supertoolkit.widgets.ToastCompat;
import com.loans.mabiliscash.R;
import com.loans.mabiliscash.auth.living.upload.UploadLiveRecognitionInfoV5Helper;
import com.loans.mabiliscash.auth.living.upload.UploadLiveRecognitionV5ImageHelper;
import com.loans.mabiliscash.common.PHViewBindingActivity;
import com.loans.mabiliscash.databinding.ActivityVerifyLivenessResultBinding;
import com.loans.mabiliscash.models.LiveRecognitionResult;
import com.loans.mabiliscash.models.LivingInfo;
import com.loans.mabiliscash.models.OnLineServicePageName;
import com.loans.mabiliscash.models.response.VerifyLivingInfoResponse;
import java.io.Serializable;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.greenrobot.eventbus.EventBus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata
public final class PHVerifyLivingV5ResultActivity extends PHViewBindingActivity<ActivityVerifyLivenessResultBinding> {

    @NotNull
    public static final Companion Companion = new Companion(null);

    @Nullable
    private FaceIdCard p;

    @Nullable
    private String q;

    @Nullable
    private LivingInfo r;

    @Nullable
    private UploadLiveRecognitionV5ImageHelper s;

    @Nullable
    private UploadLiveRecognitionInfoV5Helper f131t;

    private boolean f132u;

    @Nullable
    private LiveRecognitionResult f133v;

    @NotNull
    private final Handler f134w = new Handler(Looper.getMainLooper());

    @Metadata
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        @JvmStatic
        public final void a(@NotNull Activity activity, @NotNull FaceIdCard faceIdCard, @NotNull String str) {
            Intrinsics.checkNotNullParameter(activity, "activity");
            Intrinsics.checkNotNullParameter(faceIdCard, "faceIdCard");
            Intrinsics.checkNotNullParameter(str, "purpose");
            Intent intent = new Intent(activity, (Class<?>) PHVerifyLivingV5ResultActivity.class);
            intent.putExtra("face_id_card", (Serializable) faceIdCard);
            intent.putExtra("live_detection_args", str);
            activity.startActivity(intent);
        }

        private Companion() {
        }
    }

    private final void Y() {
        this.s = new UploadLiveRecognitionV5ImageHelper(this, this.p, new UploadLiveRecognitionV5ImageHelper.Callback() {
            @Override
            public void a(LivingInfo livingInfo) {
                String str;
                Intrinsics.checkNotNullParameter(livingInfo, "livingInfo");
                PHVerifyLivingV5ResultActivity.this.r = livingInfo;
                PHVerifyLivingV5ResultActivity.this.g0();
                PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity = PHVerifyLivingV5ResultActivity.this;
                String str2 = FaceStatisticsEvents.f;
                Intrinsics.checkNotNullExpressionValue(str2, "FACEPP_V5_UPLOAD_IMAGE_SUCCEED");
                JsonParamsBuilder.SemiData c = new JsonParamsBuilder().c("purpose");
                str = PHVerifyLivingV5ResultActivity.this.q;
                String b = c.a(str).b();
                Intrinsics.checkNotNullExpressionValue(b, "build(...)");
                pHVerifyLivingV5ResultActivity.d0(str2, b);
            }

            @Override
            public void b(String str) {
                LiveRecognitionResult liveRecognitionResult;
                String str2;
                Intrinsics.checkNotNullParameter(str, "detail");
                PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity = PHVerifyLivingV5ResultActivity.this;
                liveRecognitionResult = pHVerifyLivingV5ResultActivity.f133v;
                pHVerifyLivingV5ResultActivity.a0(liveRecognitionResult);
                PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity2 = PHVerifyLivingV5ResultActivity.this;
                String str3 = FaceStatisticsEvents.g;
                Intrinsics.checkNotNullExpressionValue(str3, "FACEPP_V5_UPLOAD_IMAGE_FAILED");
                JsonParamsBuilder.SemiData c = new JsonParamsBuilder().c("purpose");
                str2 = PHVerifyLivingV5ResultActivity.this.q;
                String b = c.a(str2).b();
                Intrinsics.checkNotNullExpressionValue(b, "build(...)");
                pHVerifyLivingV5ResultActivity2.d0(str3, b);
            }
        });
    }

    private final void Z() {
        this.f131t = new UploadLiveRecognitionInfoV5Helper(this, new UploadLiveRecognitionInfoV5Helper.Callback() {
            @Override
            public void a() {
                LiveRecognitionResult liveRecognitionResult;
                PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity = PHVerifyLivingV5ResultActivity.this;
                liveRecognitionResult = pHVerifyLivingV5ResultActivity.f133v;
                pHVerifyLivingV5ResultActivity.a0(liveRecognitionResult);
            }

            @Override
            public void b(VerifyLivingInfoResponse verifyLivingInfoResponse) {
                LiveRecognitionResult liveRecognitionResult;
                Intrinsics.checkNotNullParameter(verifyLivingInfoResponse, "result");
                PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity = PHVerifyLivingV5ResultActivity.this;
                liveRecognitionResult = pHVerifyLivingV5ResultActivity.f133v;
                pHVerifyLivingV5ResultActivity.a0(liveRecognitionResult);
            }
        });
    }

    public final void a0(LiveRecognitionResult liveRecognitionResult) {
        dismissLoadingDialog();
        if (liveRecognitionResult == null || !liveRecognitionResult.success) {
            ToastCompat.e(this, getString(R.string.live_detection_failed));
            finish();
        } else {
            ((ActivityVerifyLivenessResultBinding) this.o).f.setVisibility(0);
            EventBus.c().k(new LiveDetectionEvent(liveRecognitionResult.applyCredentialId));
            finish();
        }
    }

    public final void b0(VerifyLivingInfoResponse verifyLivingInfoResponse) {
        LiveRecognitionResult liveRecognitionResult = verifyLivingInfoResponse.body;
        if (liveRecognitionResult == null) {
            ToastCompat.e(this, ((CommonResult) verifyLivingInfoResponse).status.detail);
            finish();
            return;
        }
        if (liveRecognitionResult.success) {
            String str = FaceStatisticsEvents.c;
            Intrinsics.checkNotNullExpressionValue(str, "FACEPP_V5_SDK_VERIFY_SUCCESS");
            String b = new JsonParamsBuilder().c("purpose").a(this.q).b();
            Intrinsics.checkNotNullExpressionValue(b, "build(...)");
            d0(str, b);
        }
        String str2 = FaceStatisticsEvents.d;
        Intrinsics.checkNotNullExpressionValue(str2, "FACEPP_V5_FETCH_VIDEO_KEY_RESULT");
        String b2 = new JsonParamsBuilder().c("purpose").a(this.q).c("videoKey").a(verifyLivingInfoResponse.body.videoKey).b();
        Intrinsics.checkNotNullExpressionValue(b2, "build(...)");
        d0(str2, b2);
        LiveRecognitionResult liveRecognitionResult2 = verifyLivingInfoResponse.body;
        this.f133v = liveRecognitionResult2;
        if (TextUtils.isEmpty(liveRecognitionResult2.videoKey)) {
            a0(verifyLivingInfoResponse.body);
            return;
        }
        FaceIdCard faceIdCard = this.p;
        if (faceIdCard != null) {
            faceIdCard.videoKey = verifyLivingInfoResponse.body.videoKey;
        }
        e0();
    }

    private final void c0(FaceIdCard faceIdCard, String str) {
        if (faceIdCard != null) {
            String str2 = faceIdCard.bizToken;
            Intrinsics.checkNotNullExpressionValue(str2, "bizToken");
            if (str2.length() == 0) {
                return;
            }
            showLoadingDialog();
            this.apiHelper.a().v0(faceIdCard.bizToken, str).a(new PHVerifyLivingV5ResultActivity$sendVerifyLivingInfoV5Request$1(this));
        }
    }

    public final void d0(String str, String str2) {
        TrackingUtil.j(this, str, str2);
    }

    private final void e0() {
        Y();
        showLoadingDialog();
        String str = FaceStatisticsEvents.e;
        Intrinsics.checkNotNullExpressionValue(str, "FACEPP_V5_START_UPLOAD_IMAGE");
        String b = new JsonParamsBuilder().c("purpose").a(this.q).b();
        Intrinsics.checkNotNullExpressionValue(b, "build(...)");
        d0(str, b);
        UploadLiveRecognitionV5ImageHelper uploadLiveRecognitionV5ImageHelper = this.s;
        if (uploadLiveRecognitionV5ImageHelper != null) {
            uploadLiveRecognitionV5ImageHelper.l();
        }
        if (this.f132u) {
            return;
        }
        this.f132u = true;
        this.f134w.postDelayed(new Runnable() {
            @Override
            public final void run() {
                PHVerifyLivingV5ResultActivity.f0(PHVerifyLivingV5ResultActivity.this);
            }
        }, 120000L);
    }

    public static final void f0(PHVerifyLivingV5ResultActivity pHVerifyLivingV5ResultActivity) {
        pHVerifyLivingV5ResultActivity.a0(pHVerifyLivingV5ResultActivity.f133v);
        String str = FaceStatisticsEvents.h;
        Intrinsics.checkNotNullExpressionValue(str, "FACEPP_V5_UPLOAD_IMAGE_TIMEOUT");
        String b = new JsonParamsBuilder().c("purpose").a(pHVerifyLivingV5ResultActivity.q).b();
        Intrinsics.checkNotNullExpressionValue(b, "build(...)");
        pHVerifyLivingV5ResultActivity.d0(str, b);
    }

    public final void g0() {
        if (this.r == null) {
            showLoadingDialog();
            e0();
            return;
        }
        if (this.f131t == null) {
            Z();
        }
        showLoadingDialog();
        UploadLiveRecognitionInfoV5Helper uploadLiveRecognitionInfoV5Helper = this.f131t;
        if (uploadLiveRecognitionInfoV5Helper != null) {
            uploadLiveRecognitionInfoV5Helper.b(this.r, this.q);
        }
    }

    @JvmStatic
    public static final void start(@NotNull Activity activity, @NotNull FaceIdCard faceIdCard, @NotNull String str) {
        Companion.a(activity, faceIdCard, str);
    }

    @Override
    @NotNull
    public ActivityVerifyLivenessResultBinding bindingInflater() {
        ActivityVerifyLivenessResultBinding c = ActivityVerifyLivenessResultBinding.c(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(c, "inflate(...)");
        return c;
    }

    protected void j() {
        super.j();
        FaceIdCard faceIdCard = this.p;
        if (faceIdCard == null) {
            finish();
            return;
        }
        c0(faceIdCard, this.q);
        if ("MODIFY_MOBILE".equals(this.q)) {
            sendFetchOnLineServiceRequest(OnLineServicePageName.MODIFY_MOBILE_PAGE);
        }
    }

    @Override
    protected void k(@NotNull Bundle bundle) {
        Intrinsics.checkNotNullParameter(bundle, "inState");
        super.k(bundle);
        FaceIdCard serializable = bundle.getSerializable("face_id_card");
        this.p = serializable instanceof FaceIdCard ? serializable : null;
        this.q = bundle.getString("live_detection_args");
        Serializable serializable2 = bundle.getSerializable("extra_live_verify_result");
        this.f133v = serializable2 instanceof LiveRecognitionResult ? (LiveRecognitionResult) serializable2 : null;
        if (this.p == null) {
            finish();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.f134w.removeCallbacksAndMessages(null);
    }

    protected void s(@NotNull Bundle bundle) {
        Intrinsics.checkNotNullParameter(bundle, "outState");
        super.s(bundle);
        bundle.putSerializable("face_id_card", this.p);
        bundle.putString("live_detection_args", this.q);
        bundle.putSerializable("extra_live_verify_result", this.f133v);
    }
}