导航菜单

页面标题

页面副标题

Credmex v3.12.2 - AuthorizeCreditReportActivity.java 源代码

正在查看: Credmex v3.12.2 应用的 AuthorizeCreditReportActivity.java JAVA 源代码文件

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


package com.credmex.authentication.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.credmex.AuthUtils;
import com.credmex.VerificationMethodConfig;
import com.credmex.authentication.helper.QuitAuthHelper;
import com.credmex.models.CashBooleanResponse;
import com.credmex.models.ProtocolInfo;
import com.credmex.models.SendVerificationTypeBean;
import com.credmex.models.VerificationSupportType;
import com.credmex.models.YqdMobileVerificationPurpose;
import com.credmex.models.repository.OtpRepository;
import com.credmex.models.response.AuthConfigResponse;
import com.credmex.net.CredMexObserver;
import com.credmex.net.IApiRoutes;
import com.credmex.utils.AppUtil;
import com.credmex.utils.ProtocolInfoUtil;
import com.credmex.widght.dialog.CaptchaDialog;
import com.credmex.widght.dialog.WhatsappErrorDialog;
import com.credmex.widght.dialog.bottomDialog.InputOtpDialog;
import com.open.mx.ui.event.ComponentEvent;
import com.open.mx.ui.event.ComponentEventCenter;
import com.open.mx.ui.views.button.PrimaryButton;
import com.open.mx.ui.weights.dialog.FullScreenDialog;
import com.open.mxbaselib.sentrybusiness.ISentryBusinessEventAutoFinish;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.veda.supertoolkit.utils.ViewUtil;
import com.veda.supertoolkit.widgets.BaseUtils;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.sentry.SpanStatus;

public class AuthorizeCreditReportActivity extends AuthHandleAutoJumpActivity implements ISentryBusinessEventAutoFinish {
    private CaptchaDialog H;
    private OtpRepository I;
    private InputOtpDialog J;
    private final SendVerificationTypeBean K = new SendVerificationTypeBean();
    private WhatsappErrorDialog R;

    @BindView(2131361937)
    PrimaryButton btnConfirm;

    @BindView(2131361998)
    CheckBox cbCheckAgreement;

    @BindView(2131362445)
    LinearLayout llAuthTip;

    @BindView(2131362447)
    LinearLayout llContent;

    @BindView(2131362983)
    TextView tvAuthTip;

    @BindView(2131363023)
    TextView tvContent;

    @BindView(2131363165)
    TextView tvProtocol;

    @BindView(2131363231)
    TextView tvTitle;

    public void D0() {
        FullScreenDialog fullScreenDialog = this.H;
        if (fullScreenDialog == null || !fullScreenDialog.isShowing()) {
            return;
        }
        this.H.dismiss();
    }

    public void E0() {
        FullScreenDialog fullScreenDialog = this.R;
        if (fullScreenDialog == null || !fullScreenDialog.isShowing()) {
            return;
        }
        this.R.dismiss();
    }

    public void F0() {
        this.authUtil.t(this, new AuthUtils.DefaultAuthCallBack(this));
    }

    private void G0() {
        CaptchaDialog captchaDialog = new CaptchaDialog(this);
        this.H = captchaDialog;
        captchaDialog.r(new CaptchaDialog.CaptchaInputListener() {
            @Override
            public void a(String str, String str2, String str3) {
                if (AuthorizeCreditReportActivity.this.I != null) {
                    AuthorizeCreditReportActivity.this.I.sendVerification(str2, str, str3, VerificationSupportType.IVR_AFTER_RETRY_SMS);
                }
            }
        });
        this.H.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                AuthorizeCreditReportActivity.this.Q0();
            }
        });
        runOnDestroy(new Runnable() {
            @Override
            public final void run() {
                AuthorizeCreditReportActivity.this.D0();
            }
        });
    }

    private void H0() {
        ViewUtil.b(this.cbCheckAgreement, 30);
        this.cbCheckAgreement.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            @SensorsDataInstrumented
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                AuthorizeCreditReportActivity.this.configureBtnConfirmEnable();
                SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
                AutoTrackHelper.b(compoundButton, z);
            }
        });
        this.cbCheckAgreement.setChecked(true);
        configureBtnConfirmEnable();
    }

    private void I0() {
        InputOtpDialog inputOtpDialog = new InputOtpDialog(this);
        this.J = inputOtpDialog;
        inputOtpDialog.m(this.userSession.d().getMobileNumber(), this.K.getTypeList());
        this.J.v(new InputOtpDialog.InputOtpDialogDelegate() {
            @Override
            public void a(String str) {
                AuthorizeCreditReportActivity.this.T0(str);
            }

            @Override
            public void b(String str) {
                AuthorizeCreditReportActivity.this.I.sendVerification(str);
            }
        });
        runOnDestroy(new Runnable() {
            @Override
            public final void run() {
                AuthorizeCreditReportActivity.this.N0();
            }
        });
    }

    private void J0() {
        OtpRepository otpRepository = new OtpRepository(this);
        this.I = otpRepository;
        otpRepository.bind(YqdMobileVerificationPurpose.AUTHORIZE_CREDIT_REPORT, new OtpRepository.Provider() {
            @Override
            public final String phoneNum() {
                String O0;
                O0 = AuthorizeCreditReportActivity.this.O0();
                return O0;
            }
        }, new OtpRepository.Callback() {
            @Override
            public void onCaptchaInputError(String str) {
                AuthorizeCreditReportActivity.this.U0(str);
            }

            @Override
            public void onGetOtpFailed(String str) {
                AuthorizeCreditReportActivity.this.D0();
                AuthorizeCreditReportActivity.this.Q0();
            }

            @Override
            public void onGetOtpSuccess(String str) {
                AuthorizeCreditReportActivity.this.D0();
                AuthorizeCreditReportActivity.this.K.setCountDown(str);
                AuthorizeCreditReportActivity.this.V0(str);
            }

            @Override
            public void onNeedCheckCaptcha(String str) {
                AuthorizeCreditReportActivity.this.U0(str);
            }

            @Override
            public void onWhatsappAccountError(String str) {
                AuthorizeCreditReportActivity.this.D0();
                AuthorizeCreditReportActivity.this.W0();
            }

            @Override
            public void showErrorToast(String str) {
                AuthorizeCreditReportActivity.this.showErrorToast(str);
            }

            @Override
            public void showNormalToast(String str) {
                AuthorizeCreditReportActivity.this.showNormalToast(str);
            }
        });
    }

    private void K0() {
        H0();
        ProtocolInfo d = ProtocolInfoUtil.d(this.userSession);
        if (d == null) {
            this.tvProtocol.setText(2131820603);
        } else {
            ProtocolInfoUtil.r(this, this.tvProtocol, d);
        }
    }

    private void L0() {
        ?? g = new WhatsappErrorDialog(this).h(this.K.getTypeList().size() > 1).j(false).i(this.userSession.d().getMobileNumber()).g(new WhatsappErrorDialog.WhatsappErrorDialogCallback() {
            @Override
            public void b() {
                AuthorizeCreditReportActivity.this.J.p();
            }

            @Override
            public void a() {
            }
        });
        this.R = g;
        g.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                AuthorizeCreditReportActivity.this.Q0();
            }
        });
        runOnDestroy(new Runnable() {
            @Override
            public final void run() {
                AuthorizeCreditReportActivity.this.E0();
            }
        });
    }

    public void N0() {
        InputOtpDialog inputOtpDialog = this.J;
        if (inputOtpDialog != null) {
            inputOtpDialog.t();
        }
    }

    public String O0() {
        return this.userSession.d().getMobileNumber();
    }

    public void P0(ComponentEvent componentEvent) throws Exception {
        configureBtnConfirmEnable();
    }

    public void Q0() {
        InputOtpDialog inputOtpDialog = this.J;
        if (inputOtpDialog != null) {
            inputOtpDialog.w();
        }
    }

    public void M0() {
        this.K.initData();
        I0();
        sendGetAuthCreditReportRequest();
    }

    public void S0(AuthConfigResponse.AuthStepAttribute authStepAttribute) {
        if (authStepAttribute == null) {
            return;
        }
        if (!TextUtils.isEmpty(authStepAttribute.agreementTitle)) {
            this.tvTitle.setText(authStepAttribute.agreementTitle);
        }
        if (TextUtils.isEmpty(authStepAttribute.agreementText)) {
            return;
        }
        this.tvContent.setText(authStepAttribute.agreementText);
    }

    public void T0(String str) {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).T(str).a(new CredMexObserver<CashBooleanResponse>(this) {
            public void onSuccess(CashBooleanResponse cashBooleanResponse) {
                AuthorizeCreditReportActivity.this.dismissLoadingDialog();
                AuthorizeCreditReportActivity.this.businessTransaction("UserAuthOrder").n(SpanStatus.OK);
                AuthorizeCreditReportActivity.this.F0();
            }

            @Override
            public void onError(Throwable th, CashBooleanResponse cashBooleanResponse) {
                super.onError(th, (Throwable) cashBooleanResponse);
                AuthorizeCreditReportActivity.this.businessTransaction("UserAuthOrder").b(SpanStatus.INTERNAL_ERROR);
                AuthorizeCreditReportActivity.this.Q0();
            }
        });
    }

    public void U0(String str) {
        if (AppUtil.c(this)) {
            this.H.s(str);
            if (this.H.isShowing()) {
                this.H.o();
            } else {
                this.H.show();
            }
        }
    }

    public void V0(String str) {
        InputOtpDialog inputOtpDialog = this.J;
        if (inputOtpDialog == null) {
            return;
        }
        inputOtpDialog.show();
        this.J.u(this.K.getBeanByType(str));
    }

    public void W0() {
        if (AppUtil.c(this)) {
            if (this.R == null) {
                L0();
            }
            this.R.show();
        }
    }

    public static void startAuthorizeCreditReportActivity(Activity activity) {
        activity.startActivity(new Intent(activity, (Class<?>) AuthorizeCreditReportActivity.class));
    }

    @Override
    protected void D() {
        if (VerificationMethodConfig.b().e()) {
            M0();
        } else {
            showLoadingDialog();
            this.I.getVerificationMethodList(new OtpRepository.FetchVerificationCallBack() {
                @Override
                public final void onComplete() {
                    AuthorizeCreditReportActivity.this.M0();
                }
            });
        }
    }

    @Override
    @SuppressLint({"CheckResult"})
    protected void J() {
        super.J();
        duringActive(ComponentEventCenter.d().c(this)).W(new Consumer() {
            public final void accept(Object obj) {
                AuthorizeCreditReportActivity.this.P0((ComponentEvent) obj);
            }
        }, new com.credmex.activity.x2());
    }

    @Override
    protected void K() {
        super.K();
        this.llAuthTip.setVisibility(TextUtils.isEmpty(this.authUtil.y()) ? 8 : 0);
        this.tvAuthTip.setText(this.authUtil.y());
        G0();
        K0();
    }

    public void configureBtnConfirmEnable() {
        this.btnConfirm.setEnabled(this.cbCheckAgreement.isChecked());
    }

    @Override
    public View getContentView() {
        return this.llContent;
    }

    @Override
    public int getLayoutID() {
        return 2131558602;
    }

    @Override
    protected boolean i0() {
        return true;
    }

    @Override
    protected void init() {
        super.init();
        J0();
    }

    @Override
    protected void l0() {
        this.D.f();
    }

    @Override
    public void onBackPressed() {
        this.G = true;
        QuitAuthHelper.n(this.authUtil, this.userSession.f().quitAuthDialogInfo, this);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        businessTransaction("UserAuthOrder");
        super.onCreate(bundle);
    }

    @OnClick({2131361937})
    public void onViewClicked(View view) {
        if (BaseUtils.b()) {
            return;
        }
        if (this.K.getCountingDownSize() == 0) {
            this.I.sendDefaultVerification();
            return;
        }
        InputOtpDialog inputOtpDialog = this.J;
        if (inputOtpDialog != null) {
            inputOtpDialog.show();
        }
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.c(this, lifecycleEvent, runnable);
    }

    public void sendGetAuthCreditReportRequest() {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).M(128L).a(new CredMexObserver<AuthConfigResponse>(this) {
            @Override
            public void onError(Throwable th, AuthConfigResponse authConfigResponse) {
                super.onError(th, (Throwable) authConfigResponse);
                AuthorizeCreditReportActivity.this.reportFullyDisplayed();
            }

            public void onSuccess(AuthConfigResponse authConfigResponse) {
                AuthorizeCreditReportActivity.this.dismissLoadingDialog();
                AuthorizeCreditReportActivity.this.S0(authConfigResponse.body.authStepAttribute);
                AuthorizeCreditReportActivity.this.reportFullyDisplayed();
            }
        });
    }

    @Override
    protected void e0() {
    }

    @Override
    protected void j0() {
    }
}