导航菜单

页面标题

页面副标题

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

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

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


package com.loans.mabiliscash.auth.idcard;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.fintopia.libCommon.generalconfig.GeneralConfigManager;
import com.lingyue.supertoolkit.statistics.EventParamsConfigurator;
import com.lingyue.supertoolkit.statistics.TrackingUtil;
import com.lingyue.supertoolkit.tools.customtools.CollectionUtils;
import com.lingyue.supertoolkit.widgets.ToastCompat;
import com.lingyue.tracklib.ThirdPartTrackLib;
import com.lingyue.tracklib.TrackEventParamsConfigurator;
import com.loans.mabiliscash.R;
import com.loans.mabiliscash.appconfig.AppSwitchConfigKey;
import com.loans.mabiliscash.auth.idcard.adapters.UploadImageTipsAdapter;
import com.loans.mabiliscash.auth.idcard.scanv2.PHIdCardScanOCRV2Activity;
import com.loans.mabiliscash.auth.idcard.widgets.IdImagePreviewCard;
import com.loans.mabiliscash.common.BindClickCall;
import com.loans.mabiliscash.databinding.ActivityIdInformationSupplementBinding;
import com.loans.mabiliscash.models.DocumentsType;
import com.loans.mabiliscash.models.OrderApplyInfo;
import com.loans.mabiliscash.models.response.DocumentsInfoResponse;
import com.loans.mabiliscash.models.response.OCRResponse;
import com.loans.mabiliscash.net.ECObserver;
import com.sensorsdata.analytics.android.sdk.data.adapter.DbParams;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;

@Metadata
public class PHIDInformationSupplementActivity extends PHIDInformationBaseActivity<ActivityIdInformationSupplementBinding> {

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

    @Nullable
    private DocumentsInfoResponse.DocumentsInfo f105u;

    @Nullable
    private UploadImageTipsAdapter f106v;

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

        @JvmOverloads
        public final void a(@NotNull Context context) {
            Intrinsics.checkNotNullParameter(context, "context");
            context.startActivity(new Intent(context, (Class<?>) PHIDInformationSupplementActivity.class));
        }

        @JvmOverloads
        public final void b(@NotNull Context context, @Nullable OrderApplyInfo orderApplyInfo) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intent intent = new Intent(context, (Class<?>) PHIDInformationSupplementActivity.class);
            if (orderApplyInfo != null) {
                intent.putExtra("order_apply_info", orderApplyInfo);
            }
            context.startActivity(intent);
        }

        private Companion() {
        }
    }

    private final boolean E0() {
        DocumentsType documentsType;
        return (this.f95t == null || TextUtils.isEmpty(this.p) || (((documentsType = this.f95t) == null || documentsType.needBackCardPhoto) && TextUtils.isEmpty(this.q))) ? false : true;
    }

    private final boolean F0() {
        if (TextUtils.isEmpty(this.p)) {
            ToastCompat.d(this, R.string.please_upload_front_id_card);
            return false;
        }
        DocumentsType documentsType = this.f95t;
        if (documentsType == null || !documentsType.needBackCardPhoto || !TextUtils.isEmpty(this.s)) {
            return true;
        }
        ToastCompat.d(this, R.string.please_upload_back_id_card);
        return false;
    }

    private final void G0(boolean z2, String str, OCRResponse.Body body) {
        if (z2) {
            this.r = str;
            this.p = body.imageKey;
            List<String> list = body.prompts;
            Intrinsics.checkNotNullExpressionValue(list, "prompts");
            d1(list);
        } else {
            this.s = str;
            this.q = body.imageKey;
        }
        j0(z2, str);
    }

    public static final void H0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d340_click", new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                PHIDInformationSupplementActivity.I0(map);
            }
        });
    }

    public static final void I0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d340.click.loan_b182_d340_click");
    }

    public static final void J0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        Serializable serializableExtra = pHIDInformationSupplementActivity.getIntent().getSerializableExtra("order_apply_info");
        if ((serializableExtra instanceof OrderApplyInfo ? (OrderApplyInfo) serializableExtra : null) != null) {
            ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d341_click", new TrackEventParamsConfigurator() {
                @Override
                public final void a(Map map) {
                    PHIDInformationSupplementActivity.K0(map);
                }
            });
        }
    }

    public static final void K0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d341.click.loan_b182_d341_click");
    }

    public static final void L0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        Serializable serializableExtra = pHIDInformationSupplementActivity.getIntent().getSerializableExtra("order_apply_info");
        if ((serializableExtra instanceof OrderApplyInfo ? (OrderApplyInfo) serializableExtra : null) != null) {
            ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d340_click", new TrackEventParamsConfigurator() {
                @Override
                public final void a(Map map) {
                    PHIDInformationSupplementActivity.M0(map);
                }
            });
        }
    }

    public static final void M0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d340.click.loan_b182_d340_click");
    }

    public static final void N0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d341_click", new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                PHIDInformationSupplementActivity.O0(map);
            }
        });
    }

    public static final void O0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d341.click.loan_b182_d341_click");
    }

    public static final void P0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d183_click", new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                PHIDInformationSupplementActivity.Q0(map);
            }
        });
        pHIDInformationSupplementActivity.k0(true);
    }

    public static final void Q0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d183.click.loan_b182_d183_click");
        map.put("type", PHIDInformationBaseActivity.TYPE_FRONT);
        map.put("number", DbParams.GZIP_DATA_EVENT);
    }

    public static final void R0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        ThirdPartTrackLib.d(pHIDInformationSupplementActivity, "loan_b182_d183_click", new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                PHIDInformationSupplementActivity.S0(map);
            }
        });
        pHIDInformationSupplementActivity.k0(false);
    }

    public static final void S0(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d183.click.loan_b182_d183_click");
        map.put("type", PHIDInformationBaseActivity.TYPE_BACK);
        map.put("number", "2");
    }

    public static final void T0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity, View view) {
        pHIDInformationSupplementActivity.U0();
    }

    private final void U0() {
        if (F0()) {
            Y0();
        }
    }

    public final void V0(DocumentsInfoResponse documentsInfoResponse) {
        DocumentsInfoResponse.DocumentsInfo documentsInfo = documentsInfoResponse.body;
        if (documentsInfo == null || TextUtils.isEmpty(documentsInfo.identityNumber)) {
            finish();
            return;
        }
        DocumentsInfoResponse.DocumentsInfo documentsInfo2 = documentsInfoResponse.body;
        this.f105u = documentsInfo2;
        a1(documentsInfo2);
    }

    private final void W0() {
        this.apiHelper.a().Q().w(AndroidSchedulers.a()).K(Schedulers.b()).j(new Action() {
            public final void run() {
                PHIDInformationSupplementActivity.X0(PHIDInformationSupplementActivity.this);
            }
        }).a(new ECObserver<DocumentsInfoResponse>() {
            {
                super(PHIDInformationSupplementActivity.this);
            }

            @Override
            public void e(Throwable th, DocumentsInfoResponse documentsInfoResponse) {
                Intrinsics.checkNotNullParameter(documentsInfoResponse, "result");
                super.e(th, documentsInfoResponse);
                PHIDInformationSupplementActivity.this.Q();
                PHIDInformationSupplementActivity.this.finish();
            }

            @Override
            public void c(DocumentsInfoResponse documentsInfoResponse) {
                Intrinsics.checkNotNullParameter(documentsInfoResponse, "result");
                PHIDInformationSupplementActivity.this.V0(documentsInfoResponse);
                PHIDInformationSupplementActivity.this.Q();
            }

            @Override
            public void onSubscribe(Disposable disposable) {
                Intrinsics.checkNotNullParameter(disposable, "d");
                super.onSubscribe(disposable);
                PHIDInformationSupplementActivity.this.showLoadingDialog();
            }
        });
    }

    public static final void X0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity) {
        pHIDInformationSupplementActivity.dismissLoadingDialog();
    }

    private final void Y0() {
        this.apiHelper.a().W(this.p, this.q).w(AndroidSchedulers.a()).K(Schedulers.b()).j(new Action() {
            public final void run() {
                PHIDInformationSupplementActivity.Z0(PHIDInformationSupplementActivity.this);
            }
        }).a(new PHIDInformationSupplementActivity$sendUploadIDCardImageRequest$2(this));
    }

    public static final void Z0(PHIDInformationSupplementActivity pHIDInformationSupplementActivity) {
        pHIDInformationSupplementActivity.dismissLoadingDialog();
    }

    private final void a1(DocumentsInfoResponse.DocumentsInfo documentsInfo) {
        DocumentsType documentsType;
        if (documentsInfo == null || (documentsType = documentsInfo.documentType) == null) {
            return;
        }
        this.f95t = documentsType;
        IDCardTypeHelper.a(documentsType, ((ActivityIdInformationSupplementBinding) this.o).f);
        ThirdPartTrackLib.d(this, "loan_b182_d183_exposure", new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                PHIDInformationSupplementActivity.b1(map);
            }
        });
        if (documentsType.needBackCardPhoto) {
            ((ActivityIdInformationSupplementBinding) this.o).c.setVisibility(0);
            ThirdPartTrackLib.d(this, "loan_b182_d183_exposure", new TrackEventParamsConfigurator() {
                @Override
                public final void a(Map map) {
                    PHIDInformationSupplementActivity.c1(map);
                }
            });
        } else {
            ((ActivityIdInformationSupplementBinding) this.o).c.setVisibility(4);
        }
        ((ActivityIdInformationSupplementBinding) this.o).h.setContentText(documentsInfo.documentType.label);
        ((ActivityIdInformationSupplementBinding) this.o).h.setRightIconAndUI((Drawable) null);
        ((ActivityIdInformationSupplementBinding) this.o).f.setContentText(documentsInfo.identityNumber);
        ((ActivityIdInformationSupplementBinding) this.o).d.a(documentsType.frontUrl);
        ((ActivityIdInformationSupplementBinding) this.o).c.a(documentsType.backUrl);
    }

    public static final void b1(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d183.exposure.loan_b182_d183_exposure");
        map.put("number", 1);
    }

    public static final void c1(Map map) {
        Intrinsics.checkNotNullParameter(map, "params");
        map.put("requirement_id", 18);
        map.put("track_sign", "aloan.b182.d183.exposure.loan_b182_d183_exposure");
        map.put("number", 2);
    }

    private final void d1(final List<String> list) {
        if (CollectionUtils.a(list)) {
            ((ActivityIdInformationSupplementBinding) this.o).e.getRoot().setVisibility(8);
            return;
        }
        ((ActivityIdInformationSupplementBinding) this.o).e.getRoot().setVisibility(0);
        TrackingUtil.r(this, null, "loan_b182_d193_exposure", new EventParamsConfigurator() {
            @Override
            public final void a(JSONObject jSONObject) {
                PHIDInformationSupplementActivity.e1(list, jSONObject);
            }
        });
        UploadImageTipsAdapter uploadImageTipsAdapter = this.f106v;
        if (uploadImageTipsAdapter == null) {
            this.f106v = new UploadImageTipsAdapter(this, list);
        } else if (uploadImageTipsAdapter != null) {
            uploadImageTipsAdapter.g(list);
        }
        ((ActivityIdInformationSupplementBinding) this.o).e.c.setAdapter(this.f106v);
        ((ActivityIdInformationSupplementBinding) this.o).e.c.setLayoutManager(new LinearLayoutManager(this));
    }

    public static final void e1(List list, JSONObject jSONObject) {
        Intrinsics.checkNotNullParameter(jSONObject, "jsonObject");
        jSONObject.put("requirement_id", 8);
        jSONObject.put("track_sign", "aloan.b182.d193.exposure.loan_b182_d193_exposure");
        jSONObject.put("tips_content", CollectionsKt.d0(list, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null));
    }

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

    @Override
    protected void h0(final boolean z2) {
        new GeneralConfigManager().c(this, new GeneralConfigManager.FetchGeneralConfigCallback() {
            public void a(HashMap<String, String> hashMap) {
                boolean z3;
                int i;
                int i2;
                String str;
                String str2;
                Intrinsics.checkNotNullParameter(hashMap, "result");
                try {
                    z3 = Boolean.parseBoolean(hashMap.get(AppSwitchConfigKey.PHI_PHOTO_METHOD_AB));
                } catch (Exception unused) {
                    z3 = false;
                }
                String str3 = "";
                if (z3) {
                    ?? r7 = PHIDInformationSupplementActivity.this;
                    boolean z4 = z2;
                    i = z4 ? 10030 : 10031;
                    i2 = z4 ? 1 : 11;
                    DocumentsType documentsType = r7.f95t;
                    if (documentsType != null && (str2 = documentsType.value) != null) {
                        str3 = str2;
                    }
                    PHIdCardScanOCRV2Activity.startForResult(r7, i, i2, str3);
                    return;
                }
                ?? r72 = PHIDInformationSupplementActivity.this;
                boolean z5 = z2;
                i = z5 ? 10030 : 10031;
                i2 = z5 ? 1 : 11;
                DocumentsType documentsType2 = r72.f95t;
                if (documentsType2 != null && (str = documentsType2.value) != null) {
                    str3 = str;
                }
                PHIdCardScanOCRActivity.startForResult(r72, i, i2, str3);
            }

            public void onError(String str) {
                String str2;
                ?? r4 = PHIDInformationSupplementActivity.this;
                boolean z3 = z2;
                int i = z3 ? 10030 : 10031;
                int i2 = z3 ? 1 : 11;
                DocumentsType documentsType = r4.f95t;
                if (documentsType == null || (str2 = documentsType.value) == null) {
                    str2 = "";
                }
                PHIdCardScanOCRActivity.startForResult(r4, i, i2, str2);
            }

            public void onFinish() {
            }
        }, new String[]{AppSwitchConfigKey.PHI_PHOTO_METHOD_AB});
    }

    protected void j() {
        super.j();
        W0();
    }

    @Override
    protected void j0(boolean z2, @Nullable String str) {
        IdImagePreviewCard idImagePreviewCard = z2 ? ((ActivityIdInformationSupplementBinding) this.o).d : ((ActivityIdInformationSupplementBinding) this.o).c;
        Intrinsics.b(idImagePreviewCard);
        idImagePreviewCard.b(str);
        ((ActivityIdInformationSupplementBinding) this.o).b.setEnabled(E0());
    }

    @Override
    protected void k(@NotNull Bundle bundle) {
        Intrinsics.checkNotNullParameter(bundle, "inState");
        super.k(bundle);
        a1((DocumentsInfoResponse.DocumentsInfo) bundle.getSerializable("documents_info"));
    }

    @Override
    protected void o() {
        super.o();
        V(((ActivityIdInformationSupplementBinding) this.o).h, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.H0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).f, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.N0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).d, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.P0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).c, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.R0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).b, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.T0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).f, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.J0(PHIDInformationSupplementActivity.this, view);
            }
        });
        V(((ActivityIdInformationSupplementBinding) this.o).h, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHIDInformationSupplementActivity.L0(PHIDInformationSupplementActivity.this, view);
            }
        });
    }

    protected void onActivityResult(int i, int i2, @Nullable Intent intent) {
        OCRResponse.Body body;
        super.onActivityResult(i, i2, intent);
        if (i2 != -1 || intent == null) {
            return;
        }
        if (i == 10030) {
            Serializable serializableExtra = intent.getSerializableExtra(PHIdCardScanOCRActivity.OCR_RESULT);
            body = serializableExtra instanceof OCRResponse.Body ? (OCRResponse.Body) serializableExtra : null;
            if (body == null) {
                return;
            }
            G0(true, intent.getStringExtra(PHBaseIdCardScanActivity.FILE_PATH), body);
            return;
        }
        if (i != 10031) {
            return;
        }
        Serializable serializableExtra2 = intent.getSerializableExtra(PHIdCardScanOCRActivity.OCR_RESULT);
        body = serializableExtra2 instanceof OCRResponse.Body ? (OCRResponse.Body) serializableExtra2 : null;
        if (body == null) {
            return;
        }
        G0(false, intent.getStringExtra(PHBaseIdCardScanActivity.FILE_PATH), body);
    }
}