导航菜单

页面标题

页面副标题

Biko v2.0.23 - KycSubmitActivity.java 源代码

正在查看: Biko v2.0.23 应用的 KycSubmitActivity.java JAVA 源代码文件

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


package app.callpe.ui.user;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import app.callpe.App;
import app.callpe.common.utils.ResultState;
import app.callpe.common.utils.custom.PhotoPickerView;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.StringExtKt;
import app.callpe.common.utils.helper_functions.EmojiFilter;
import app.callpe.common.utils.helper_functions.OnlyAlphabetsAndNumbersFilter;
import app.callpe.common.utils.helper_functions.OnlyAlphabetsFilter;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.IfscDataModel;
import app.callpe.data.model.KycData;
import app.callpe.data.repository.upload.UploadProgressHelper;
import app.callpe.databinding.ActivityKycSubmitBinding;
import app.callpe.service.ApiService;
import app.callpe.ui.dialog.InternationalStreamerPayoneerScreenshotUploadDialog;
import app.callpe.ui.home.AgentHomeActivity;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.home.StreamerHomeActivity;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.textfield.TextInputEditText;
import com.techiness.progressdialoglibrary.ProgressDialog;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import javax.inject.Inject;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import pub.devrel.easypermissions.EasyPermissions;
import pub.devrel.easypermissions.PermissionRequest;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;

@Metadata(d1 = {"\u0000\u009c\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010!\n\u0002\b\u0004\n\u0002\u0010\u0015\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0007\u0018\u0000 V2\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003:\u0003VWXB\u0005¢\u0006\u0002\u0010\u0004J\b\u0010%\u001a\u00020&H\u0002J\b\u0010'\u001a\u00020&H\u0002J\b\u0010(\u001a\u00020&H\u0016J\b\u0010)\u001a\u00020&H\u0002J\b\u0010*\u001a\u00020&H\u0002J\u0010\u0010+\u001a\u00020&2\u0006\u0010,\u001a\u00020-H\u0002J\u0010\u0010.\u001a\u00020\u00022\u0006\u0010/\u001a\u000200H\u0016J\b\u00101\u001a\u00020&H\u0002J\b\u00102\u001a\u000203H\u0002J\b\u00104\u001a\u00020&H\u0002J\b\u00105\u001a\u00020&H\u0002J\u0012\u00106\u001a\u00020&2\b\u00107\u001a\u0004\u0018\u000108H\u0014J\u0012\u00109\u001a\u00020&2\b\u0010:\u001a\u0004\u0018\u00010;H\u0014J\u001e\u0010<\u001a\u00020&2\u0006\u0010=\u001a\u00020>2\f\u0010?\u001a\b\u0012\u0004\u0012\u00020\u00070@H\u0016J\u001e\u0010A\u001a\u00020&2\u0006\u0010=\u001a\u00020>2\f\u0010?\u001a\b\u0012\u0004\u0012\u00020\u00070@H\u0016J-\u0010B\u001a\u00020&2\u0006\u0010=\u001a\u00020>2\u000e\u0010C\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u00062\u0006\u0010D\u001a\u00020EH\u0016¢\u0006\u0002\u0010FJ\u0010\u0010G\u001a\u00020&2\u0006\u0010H\u001a\u00020-H\u0002J\b\u0010I\u001a\u00020&H\u0002J\b\u0010J\u001a\u00020&H\u0002J\b\u0010K\u001a\u00020&H\u0002J\u0010\u0010L\u001a\u00020&2\u0006\u0010M\u001a\u00020NH\u0002J\u0010\u0010O\u001a\u00020&2\u0006\u0010P\u001a\u00020\u0007H\u0002J$\u0010Q\u001a\u00020&2\u0006\u0010R\u001a\u00020\u00072\u0012\u0010S\u001a\u000e\u0012\u0004\u0012\u00020\u0011\u0012\u0004\u0012\u00020&0TH\u0002J\u0006\u0010U\u001a\u00020&R\u0016\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\bR\u0016\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\bR\u001e\u0010\n\u001a\u00020\u000b8\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0014\u001a\u0004\u0018\u00010\u0015X\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0016\u001a\u00020\u00178BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001a\u0010\u001b\u001a\u0004\b\u0018\u0010\u0019R\u0017\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00070\u001d¢\u0006\b\n\u0000\u001a\u0004\b\u001e\u0010\u001fR\u001a\u0010 \u001a\u00020\u0007X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\"\"\u0004\b#\u0010$¨\u0006Y"}, d2 = {"Lapp/callpe/ui/user/KycSubmitActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityKycSubmitBinding;", "Lpub/devrel/easypermissions/EasyPermissions$PermissionCallbacks;", "()V", "PERMISSIONS_Q", "", "", "[Ljava/lang/String;", "PERMISSIONS_R", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "enableIfscValidation", "", "isAgent", "isIndianStreamer", "uploadProgressHelper", "Lapp/callpe/data/repository/upload/UploadProgressHelper;", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "walletOptions", "Ljava/util/ArrayList;", "getWalletOptions", "()Ljava/util/ArrayList;", "walletType", "getWalletType", "()Ljava/lang/String;", "setWalletType", "(Ljava/lang/String;)V", "addTextWatchers", "", "disableSpinnerClick", "finish", "getIntentValues", "goToHomeActivity", "handleKyc", "metadata", "Lapp/callpe/data/model/Metadata;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "observeEvent", "Lkotlinx/coroutines/Job;", "observeUploadProgress", "onClick", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onNewIntent", "intent", "Landroid/content/Intent;", "onPermissionsDenied", "requestCode", "", "perms", "", "onPermissionsGranted", "onRequestPermissionsResult", NativeProtocol.RESULT_ARGS_PERMISSIONS, "grantResults", "", "(I[Ljava/lang/String;[I)V", "prefillData", "data", "requestPermissions", "save", "setSpinners", "updateSpinnerSelection", "kycData", "Lapp/callpe/data/model/KycData;", "updateWalletDetails", "selectedWallet", "validateIfsc", "ifscCode", "isValidIfsc", "Lkotlin/Function1;", "validateMatchingFields", "Companion", "StreamerStatus", "WalletType", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class KycSubmitActivity extends BaseActivity<ActivityKycSubmitBinding> implements EasyPermissions.PermissionCallbacks {
    public static final int RC_STORAGE_PERMISSION = 1010;

    @Inject
    public ApiService apiService;
    private boolean isAgent;
    private boolean isIndianStreamer;
    private UploadProgressHelper uploadProgressHelper;

    private final Lazy viewModel;
    private final ArrayList<String> walletOptions;
    private String walletType;
    private boolean enableIfscValidation = true;
    private final String[] PERMISSIONS_R = {"android.permission.CAMERA", "android.permission.READ_EXTERNAL_STORAGE"};
    private final String[] PERMISSIONS_Q = {"android.permission.CAMERA", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"};

    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0005\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005¨\u0006\u0006"}, d2 = {"Lapp/callpe/ui/user/KycSubmitActivity$StreamerStatus;", "", "(Ljava/lang/String;I)V", "CREATED", "APPROVED", "REJECTED", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public enum StreamerStatus {
        CREATED,
        APPROVED,
        REJECTED
    }

    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0005\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005¨\u0006\u0006"}, d2 = {"Lapp/callpe/ui/user/KycSubmitActivity$WalletType;", "", "(Ljava/lang/String;I)V", "WALLET_PAYONEER", "WALLET_EPAY", "INDIAN_BANK_ACCOUNT", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public enum WalletType {
        WALLET_PAYONEER,
        WALLET_EPAY,
        INDIAN_BANK_ACCOUNT
    }

    public void onPermissionsGranted(int requestCode, List<String> perms) {
        Intrinsics.checkNotNullParameter(perms, "perms");
    }

    public KycSubmitActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(UserViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m2206invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m2205invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m2207invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
        ArrayList arrayListOf = CollectionsKt.arrayListOf(new String[]{"Payoneer wallet", "Epay wallet"});
        ArrayList arrayList = new ArrayList();
        for (Object obj : arrayListOf) {
            String str = (String) obj;
            if ((StringsKt.contains(str, "Payoneer", true) && App.Companion.getActivePayouts().contains("WALLET_PAYONEER")) || (StringsKt.contains(str, "Epay", true) && App.Companion.getActivePayouts().contains("WALLET_EPAY"))) {
                arrayList.add(obj);
            }
        }
        this.walletOptions = arrayList;
        this.walletType = "WALLET_PAYONEER";
    }

    @Override
    public ActivityKycSubmitBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityKycSubmitBinding inflate = ActivityKycSubmitBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }

    public final UserViewModel getViewModel() {
        return (UserViewModel) this.viewModel.getValue();
    }

    public final ApiService getApiService() {
        ApiService apiService = this.apiService;
        if (apiService != null) {
            return apiService;
        }
        Intrinsics.throwUninitializedPropertyAccessException("apiService");
        return null;
    }

    public final void setApiService(ApiService apiService) {
        Intrinsics.checkNotNullParameter(apiService, "<set-?>");
        this.apiService = apiService;
    }

    public final ArrayList<String> getWalletOptions() {
        return this.walletOptions;
    }

    public final String getWalletType() {
        return this.walletType;
    }

    public final void setWalletType(String str) {
        Intrinsics.checkNotNullParameter(str, "<set-?>");
        this.walletType = str;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestPermissions();
        Context context = (Context) this;
        getWindow().setStatusBarColor(ContextCompat.getColor(context, 2131099815));
        this.isIndianStreamer = SharedPref.getBoolean(context, PrefKeys.USER_IS_INDIAN, false);
        this.isAgent = Intrinsics.areEqual(SharedPref.getString(context, PrefKeys.USER_ROLE), "AGENT");
        Timber.d("WALLET_OPTIONS: " + this.walletOptions, new Object[0]);
        this.uploadProgressHelper = new UploadProgressHelper(context, (Activity) this);
        initViews();
        if (!this.isIndianStreamer) {
            setSpinners();
        }
        observeEvent();
        observeUploadProgress();
        onClick();
        getIntentValues();
        addTextWatchers();
    }

    private final void setSpinners() {
        if (this.walletOptions.isEmpty()) {
            ActivityExtKt.toast((Activity) this, "No international payout gateway found.Try restarting app or contact customer service");
            finish();
            return;
        }
        ((ActivityKycSubmitBinding) getBinding()).spinnerDropIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KycSubmitActivity.setSpinners$lambda$1(KycSubmitActivity.this, view);
            }
        });
        Spinner spinner = ((ActivityKycSubmitBinding) getBinding()).spinner;
        Intrinsics.checkNotNullExpressionValue(spinner, "binding.spinner");
        ArrayAdapter arrayAdapter = new ArrayAdapter((Context) this, R.layout.simple_spinner_item, this.walletOptions);
        arrayAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter((SpinnerAdapter) arrayAdapter);
        if (this.walletOptions.size() == 1) {
            spinner.setSelection(0);
            updateWalletDetails((String) CollectionsKt.first(this.walletOptions));
        } else {
            spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onNothingSelected(AdapterView<?> parent) {
                }

                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    if (position < KycSubmitActivity.this.getWalletOptions().size()) {
                        KycSubmitActivity kycSubmitActivity = KycSubmitActivity.this;
                        String str = kycSubmitActivity.getWalletOptions().get(position);
                        Intrinsics.checkNotNullExpressionValue(str, "walletOptions[position]");
                        kycSubmitActivity.updateWalletDetails(str);
                    }
                }
            });
        }
    }

    public static final void setSpinners$lambda$1(KycSubmitActivity kycSubmitActivity, View view) {
        Intrinsics.checkNotNullParameter(kycSubmitActivity, "this$0");
        kycSubmitActivity.getBinding().spinner.performClick();
    }

    public final void updateWalletDetails(String selectedWallet) {
        String str = selectedWallet;
        if (StringsKt.contains(str, "Payoneer", true)) {
            this.walletType = "WALLET_PAYONEER";
            getBinding().bankWalletScreenshotTxt.setText("Payoneer Account Screenshot");
            getBinding().bankAccountNoText.setText("Payoneer Account Email");
            getBinding().confirmBankAccountNoText.setText("Confirm Payoneer Account Email");
            getBinding().bankTypeHeading.setText("Enter Payoneer Details");
            return;
        }
        if (StringsKt.contains(str, "Epay", true)) {
            this.walletType = "WALLET_EPAY";
            getBinding().bankWalletScreenshotTxt.setText("Epay Account Screenshot");
            getBinding().bankAccountNoText.setText("Epay Account Email");
            getBinding().confirmBankAccountNoText.setText("Confirm Epay Account Email");
            getBinding().bankTypeHeading.setText("Enter Epay Details");
        }
    }

    private final void addTextWatchers() {
        TextWatcher textWatcher = new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                KycSubmitActivity.this.validateMatchingFields();
            }
        };
        getBinding().bankAccountNo.addTextChangedListener(textWatcher);
        getBinding().confirmBankAccountNo.addTextChangedListener(textWatcher);
    }

    public final void validateMatchingFields() {
        TextView textView = getBinding().mismatchWarning;
        Intrinsics.checkNotNullExpressionValue(textView, "binding.mismatchWarning");
        textView.setVisibility(Intrinsics.areEqual(StringsKt.trim(String.valueOf(getBinding().bankAccountNo.getText())).toString(), StringsKt.trim(String.valueOf(getBinding().confirmBankAccountNo.getText())).toString()) ^ true ? 0 : 8);
    }

    private final void initViews() {
        LinearLayout linearLayout = getBinding().idProofBox;
        Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.idProofBox");
        linearLayout.setVisibility(this.isAgent ? 0 : 8);
        if (!this.isIndianStreamer) {
            LinearLayout linearLayout2 = getBinding().walletTypeChooserParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.walletTypeChooserParent");
            linearLayout2.setVisibility(0);
            getBinding().bankAccountNoText.setText("Payoneer Account Email");
            getBinding().confirmBankAccountNoText.setText("Confirm Payoneer Account Email");
            getBinding().bankTypeHeading.setText("Enter Payoneer Details");
            LinearLayout linearLayout3 = getBinding().gstBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.gstBox");
            linearLayout3.setVisibility(8);
            LinearLayout linearLayout4 = getBinding().panNumberBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.panNumberBox");
            linearLayout4.setVisibility(8);
            getBinding().idProofTitle.setText("ID Proof");
            LinearLayout linearLayout5 = getBinding().bankWalletScreenshotBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout5, "binding.bankWalletScreenshotBox");
            linearLayout5.setVisibility(0);
            LinearLayout linearLayout6 = getBinding().ifscBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout6, "binding.ifscBox");
            linearLayout6.setVisibility(8);
        } else {
            LinearLayout linearLayout7 = getBinding().walletTypeChooserParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout7, "binding.walletTypeChooserParent");
            linearLayout7.setVisibility(8);
            getBinding().bankAccountNoText.setText("Bank Account Number");
            getBinding().confirmBankAccountNoText.setText("Confirm Bank Account Number");
            getBinding().bankTypeHeading.setText("Enter Bank Details");
            LinearLayout linearLayout8 = getBinding().gstBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout8, "binding.gstBox");
            linearLayout8.setVisibility(0);
            LinearLayout linearLayout9 = getBinding().panNumberBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout9, "binding.panNumberBox");
            linearLayout9.setVisibility(0);
            getBinding().idProofTitle.setText("Aadhaar Photo");
            LinearLayout linearLayout10 = getBinding().bankWalletScreenshotBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout10, "binding.bankWalletScreenshotBox");
            linearLayout10.setVisibility(8);
            LinearLayout linearLayout11 = getBinding().ifscBox;
            Intrinsics.checkNotNullExpressionValue(linearLayout11, "binding.ifscBox");
            linearLayout11.setVisibility(0);
        }
        getBinding().bankWalletScreenshotPicker.setImageDeleteCallback(new Function1<String, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((String) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(String str) {
                boolean z;
                ActivityKycSubmitBinding binding;
                ActivityKycSubmitBinding binding2;
                Intrinsics.checkNotNullParameter(str, "path");
                z = KycSubmitActivity.this.isIndianStreamer;
                if (z) {
                    return;
                }
                binding = KycSubmitActivity.this.getBinding();
                View view = binding.bankWalletScreenshotPickerBtn;
                Intrinsics.checkNotNullExpressionValue(view, "binding.bankWalletScreenshotPickerBtn");
                view.setVisibility(0);
                binding2 = KycSubmitActivity.this.getBinding();
                PhotoPickerView photoPickerView = binding2.bankWalletScreenshotPicker;
                Intrinsics.checkNotNullExpressionValue(photoPickerView, "binding.bankWalletScreenshotPicker");
                photoPickerView.setVisibility(8);
            }
        });
        getBinding().gstNumber.setFilters(new InputFilter[]{new OnlyAlphabetsAndNumbersFilter(), new InputFilter.LengthFilter(15), new EmojiFilter()});
        getBinding().pan.setFilters(new InputFilter[]{new OnlyAlphabetsAndNumbersFilter(), new InputFilter.LengthFilter(10), new EmojiFilter()});
        getBinding().realName.setFilters(new InputFilter[]{new OnlyAlphabetsFilter(), new InputFilter.LengthFilter(200), new EmojiFilter()});
        getBinding().ifsc.setFilters(new InputFilter[]{new OnlyAlphabetsAndNumbersFilter(), new InputFilter.LengthFilter(30), new EmojiFilter()});
    }

    private final void getIntentValues() {
        getBinding().kycPicker.setSinglePic(true);
        getBinding().bankWalletScreenshotPicker.setSinglePic(true);
        Intent intent = getIntent();
        if (intent == null || !intent.getBooleanExtra("edit", false)) {
            return;
        }
        getViewModel().setEdit(true);
        UserViewModel.getUserDetails$default(getViewModel(), false, 1, null);
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new KycSubmitActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    public final void prefillData(app.callpe.data.model.Metadata data) {
        ProgressBar progressBar = getBinding().progressBar;
        Intrinsics.checkNotNullExpressionValue(progressBar, "binding.progressBar");
        progressBar.setVisibility(8);
        ScrollView scrollView = getBinding().parentBox;
        Intrinsics.checkNotNullExpressionValue(scrollView, "binding.parentBox");
        scrollView.setVisibility(0);
        KycData kycData = data.getUser().getKycData();
        if (kycData != null) {
            Boolean enableIfscValidation = kycData.getEnableIfscValidation();
            this.enableIfscValidation = enableIfscValidation != null ? enableIfscValidation.booleanValue() : true;
            PhotoPickerView photoPickerView = getBinding().kycPicker;
            List<String> kycPictures = data.getUser().getKycPictures();
            Intrinsics.checkNotNull(kycPictures, "null cannot be cast to non-null type java.util.ArrayList<kotlin.String>{ kotlin.collections.TypeAliasesKt.ArrayList<kotlin.String> }");
            photoPickerView.addItems((ArrayList) kycPictures);
            if (data.getUser().getKycData().getWalletScreenshotPictures().isEmpty()) {
                View view = getBinding().bankWalletScreenshotPickerBtn;
                Intrinsics.checkNotNullExpressionValue(view, "binding.bankWalletScreenshotPickerBtn");
                view.setVisibility(0);
                PhotoPickerView photoPickerView2 = getBinding().bankWalletScreenshotPicker;
                Intrinsics.checkNotNullExpressionValue(photoPickerView2, "binding.bankWalletScreenshotPicker");
                photoPickerView2.setVisibility(8);
            } else {
                View view2 = getBinding().bankWalletScreenshotPickerBtn;
                Intrinsics.checkNotNullExpressionValue(view2, "binding.bankWalletScreenshotPickerBtn");
                view2.setVisibility(8);
                PhotoPickerView photoPickerView3 = getBinding().bankWalletScreenshotPicker;
                Intrinsics.checkNotNullExpressionValue(photoPickerView3, "binding.bankWalletScreenshotPicker");
                photoPickerView3.setVisibility(0);
                PhotoPickerView photoPickerView4 = getBinding().bankWalletScreenshotPicker;
                List<String> walletScreenshotPictures = data.getUser().getKycData().getWalletScreenshotPictures();
                Intrinsics.checkNotNull(walletScreenshotPictures, "null cannot be cast to non-null type java.util.ArrayList<kotlin.String>{ kotlin.collections.TypeAliasesKt.ArrayList<kotlin.String> }");
                photoPickerView4.addItems((ArrayList) walletScreenshotPictures);
            }
            TextInputEditText textInputEditText = getBinding().bankAccountNo;
            String bankAccountNo = kycData.getBankAccountNo();
            if (bankAccountNo == null) {
                bankAccountNo = "";
            }
            textInputEditText.setText(bankAccountNo);
            TextInputEditText textInputEditText2 = getBinding().confirmBankAccountNo;
            String bankAccountNo2 = kycData.getBankAccountNo();
            if (bankAccountNo2 == null) {
                bankAccountNo2 = "";
            }
            textInputEditText2.setText(bankAccountNo2);
            TextInputEditText textInputEditText3 = getBinding().realName;
            String realName = kycData.getRealName();
            if (realName == null) {
                realName = "";
            }
            textInputEditText3.setText(realName);
            TextInputEditText textInputEditText4 = getBinding().pan;
            String panNumber = kycData.getPanNumber();
            if (panNumber == null) {
                panNumber = "";
            }
            textInputEditText4.setText(panNumber);
            TextInputEditText textInputEditText5 = getBinding().gstNumber;
            String gst = kycData.getGst();
            if (gst == null) {
                gst = "";
            }
            textInputEditText5.setText(gst);
            TextInputEditText textInputEditText6 = getBinding().ifsc;
            String ifsc = kycData.getIfsc();
            textInputEditText6.setText(ifsc != null ? ifsc : "");
            if (kycData.getPanUpdateLocked() && getViewModel().getIsEdit()) {
                getBinding().pan.setEnabled(false);
                getBinding().pan.setFocusable(false);
            }
            if (!this.isIndianStreamer) {
                updateSpinnerSelection(kycData);
            }
        }
        handleKyc(data);
    }

    private final void updateSpinnerSelection(KycData kycData) {
        String str;
        String replace$default;
        String bankAccountType = kycData.getBankAccountType();
        if (bankAccountType == null || (replace$default = StringsKt.replace$default(bankAccountType, "WALLET_", "", false, 4, (Object) null)) == null || (str = StringsKt.trim(replace$default).toString()) == null) {
            str = "";
        }
        boolean areEqual = Intrinsics.areEqual(kycData.getKycStatus(), "APPROVED");
        Iterator<String> it = this.walletOptions.iterator();
        int i = 0;
        while (true) {
            if (!it.hasNext()) {
                i = -1;
                break;
            } else if (StringsKt.contains(it.next(), str, true)) {
                break;
            } else {
                i++;
            }
        }
        if (i == -1) {
            if ((str.length() > 0) && areEqual) {
                this.walletOptions.add(StringExtKt.capitalizeFirstLetter(str) + " wallet");
                i = this.walletOptions.size() + (-1);
                SpinnerAdapter adapter = getBinding().spinner.getAdapter();
                Intrinsics.checkNotNull(adapter, "null cannot be cast to non-null type android.widget.ArrayAdapter<kotlin.String>");
                ((ArrayAdapter) adapter).notifyDataSetChanged();
            }
        }
        if (i == -1) {
            i = 0;
        }
        getBinding().spinner.setSelection(i, false);
        String str2 = this.walletOptions.get(i);
        Intrinsics.checkNotNullExpressionValue(str2, "walletOptions[selectedIndex]");
        updateWalletDetails(str2);
    }

    private final void disableSpinnerClick() {
        ((ActivityKycSubmitBinding) getBinding()).walletTypeChooserParent.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).walletTypeChooserParent.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).walletTypeChooserParent.setAlpha(0.9f);
        ((ActivityKycSubmitBinding) getBinding()).spinner.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).spinner.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).spinnerDropIcon.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).spinnerDropIcon.setClickable(false);
        if (this.isIndianStreamer) {
            return;
        }
        ((ActivityKycSubmitBinding) getBinding()).bankAccountNo.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).bankAccountNo.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).bankAccountNo.setAlpha(0.9f);
        ((ActivityKycSubmitBinding) getBinding()).confirmBankAccountNo.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).confirmBankAccountNo.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).confirmBankAccountNo.setAlpha(0.9f);
        ((ActivityKycSubmitBinding) getBinding()).realName.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).realName.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).realName.setAlpha(0.9f);
        ((ActivityKycSubmitBinding) getBinding()).submitBtn.setEnabled(false);
        ((ActivityKycSubmitBinding) getBinding()).submitBtn.setClickable(false);
        ((ActivityKycSubmitBinding) getBinding()).submitBtn.setBackgroundTintList(ContextCompat.getColorStateList((Context) this, 2131100042));
    }

    private final void handleKyc(app.callpe.data.model.Metadata metadata) {
        KycData kycData = metadata.getUser().getKycData();
        String kycStatus = kycData != null ? kycData.getKycStatus() : null;
        if (kycStatus != null) {
            switch (kycStatus.hashCode()) {
                case -1159694117:
                    if (kycStatus.equals("SUBMITTED")) {
                        if (!metadata.getUser().getKycPictures().isEmpty()) {
                            getBinding().kycPicker.hideAddBtn(true);
                        }
                        if (!metadata.getUser().getKycData().getWalletScreenshotPictures().isEmpty()) {
                            getBinding().bankWalletScreenshotPicker.hideAddBtn(true);
                            return;
                        }
                        return;
                    }
                    return;
                case 174130302:
                    if (kycStatus.equals("REJECTED")) {
                        if (!metadata.getUser().getKycPictures().isEmpty()) {
                            getBinding().kycPicker.hideAddBtn(true);
                        }
                        if (!metadata.getUser().getKycData().getWalletScreenshotPictures().isEmpty()) {
                            getBinding().bankWalletScreenshotPicker.hideAddBtn(true);
                            return;
                        }
                        return;
                    }
                    return;
                case 1746537160:
                    if (!kycStatus.equals("CREATED")) {
                        return;
                    }
                    break;
                case 1967871671:
                    if (kycStatus.equals("APPROVED")) {
                        String panNumber = metadata.getUser().getKycData().getPanNumber();
                        if (panNumber != null) {
                            panNumber.length();
                        }
                        disableSpinnerClick();
                        getBinding().kycPicker.setHideDelete(true);
                        getBinding().kycPicker.hideAddBtn(true);
                        getBinding().bankWalletScreenshotPicker.setHideDelete(true);
                        getBinding().bankWalletScreenshotPicker.hideAddBtn(true);
                        return;
                    }
                    return;
                default:
                    return;
            }
        }
        if (!metadata.getUser().getKycPictures().isEmpty()) {
            getBinding().kycPicker.hideAddBtn(true);
        }
        KycData kycData2 = metadata.getUser().getKycData();
        List<String> walletScreenshotPictures = kycData2 != null ? kycData2.getWalletScreenshotPictures() : null;
        if (walletScreenshotPictures == null || walletScreenshotPictures.isEmpty()) {
            return;
        }
        getBinding().bankWalletScreenshotPicker.hideAddBtn(true);
    }

    private final void goToHomeActivity() {
        if (BaseActivity.INSTANCE.isStreamer()) {
            Intent intent = new Intent((Context) this, (Class<?>) StreamerHomeActivity.class);
            intent.addFlags(268468224);
            startActivity(intent);
            overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
            return;
        }
        Intent intent2 = new Intent((Context) this, (Class<?>) AgentHomeActivity.class);
        intent2.addFlags(268468224);
        startActivity(intent2);
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }

    private final void observeUploadProgress() {
        getViewModel().getResult().observe((LifecycleOwner) this, new KycSubmitActivity$sam$androidx_lifecycle_Observer$0(new Function1<ResultState<? extends Double>, Unit>() {

            @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
            public class WhenMappings {
                public static final int[] $EnumSwitchMapping$0;

                static {
                    int[] iArr = new int[ResultState.Status.values().length];
                    try {
                        iArr[ResultState.Status.LOADING.ordinal()] = 1;
                    } catch (NoSuchFieldError unused) {
                    }
                    try {
                        iArr[ResultState.Status.ERROR.ordinal()] = 2;
                    } catch (NoSuchFieldError unused2) {
                    }
                    try {
                        iArr[ResultState.Status.SUCCESS.ordinal()] = 3;
                    } catch (NoSuchFieldError unused3) {
                    }
                    try {
                        iArr[ResultState.Status.RESET.ordinal()] = 4;
                    } catch (NoSuchFieldError unused4) {
                    }
                    $EnumSwitchMapping$0 = iArr;
                }
            }

            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((ResultState<Double>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(ResultState<Double> resultState) {
                UploadProgressHelper uploadProgressHelper;
                UploadProgressHelper uploadProgressHelper2;
                UploadProgressHelper uploadProgressHelper3;
                UploadProgressHelper uploadProgressHelper4;
                UploadProgressHelper uploadProgressHelper5;
                int i = WhenMappings.$EnumSwitchMapping$0[resultState.getStatus().ordinal()];
                if (i == 1) {
                    uploadProgressHelper = KycSubmitActivity.this.uploadProgressHelper;
                    if (uploadProgressHelper != null) {
                        Double data = resultState.getData();
                        uploadProgressHelper.progressDialogPercent(data != null ? (float) data.doubleValue() : 0.0f);
                        return;
                    }
                    return;
                }
                if (i == 2) {
                    uploadProgressHelper2 = KycSubmitActivity.this.uploadProgressHelper;
                    if (uploadProgressHelper2 != null) {
                        uploadProgressHelper2.dismiss();
                        return;
                    }
                    return;
                }
                if (i == 3) {
                    uploadProgressHelper3 = KycSubmitActivity.this.uploadProgressHelper;
                    if (uploadProgressHelper3 != null) {
                        uploadProgressHelper3.dismiss();
                        return;
                    }
                    return;
                }
                if (i != 4) {
                    return;
                }
                uploadProgressHelper4 = KycSubmitActivity.this.uploadProgressHelper;
                if (uploadProgressHelper4 != null) {
                    uploadProgressHelper4.dismiss();
                }
                uploadProgressHelper5 = KycSubmitActivity.this.uploadProgressHelper;
                if (uploadProgressHelper5 != null) {
                    uploadProgressHelper5.setProgressDialog();
                }
            }
        }));
    }

    private final void onClick() {
        getBinding().submitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KycSubmitActivity.onClick$lambda$5(KycSubmitActivity.this, view);
            }
        });
        getBinding().popupClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KycSubmitActivity.onClick$lambda$6(KycSubmitActivity.this, view);
            }
        });
        getBinding().bankWalletScreenshotPickerBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                KycSubmitActivity.onClick$lambda$7(KycSubmitActivity.this, view);
            }
        });
    }

    public static final void onClick$lambda$5(KycSubmitActivity kycSubmitActivity, View view) {
        Intrinsics.checkNotNullParameter(kycSubmitActivity, "this$0");
        Editable text = kycSubmitActivity.getBinding().ifsc.getText();
        if (!(text == null || text.length() == 0) && kycSubmitActivity.isIndianStreamer && kycSubmitActivity.enableIfscValidation) {
            kycSubmitActivity.validateIfsc(String.valueOf(kycSubmitActivity.getBinding().ifsc.getText()), new KycSubmitActivity$onClick$1$1(kycSubmitActivity));
        } else {
            kycSubmitActivity.save();
        }
    }

    public static final void onClick$lambda$6(KycSubmitActivity kycSubmitActivity, View view) {
        Intrinsics.checkNotNullParameter(kycSubmitActivity, "this$0");
        kycSubmitActivity.finish();
    }

    public static final void onClick$lambda$7(final KycSubmitActivity kycSubmitActivity, View view) {
        Intrinsics.checkNotNullParameter(kycSubmitActivity, "this$0");
        try {
            InternationalStreamerPayoneerScreenshotUploadDialog newInstance = InternationalStreamerPayoneerScreenshotUploadDialog.INSTANCE.newInstance(Intrinsics.areEqual(kycSubmitActivity.walletType, "WALLET_EPAY"), new Function1<String, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((String) obj);
                    return Unit.INSTANCE;
                }

                public final void invoke(String str) {
                    ActivityKycSubmitBinding binding;
                    ActivityKycSubmitBinding binding2;
                    ActivityKycSubmitBinding binding3;
                    ActivityKycSubmitBinding binding4;
                    ActivityKycSubmitBinding binding5;
                    Intrinsics.checkNotNullParameter(str, "payoneerImageUri");
                    ArrayList<String> arrayList = new ArrayList<>();
                    arrayList.add(str);
                    binding = KycSubmitActivity.this.getBinding();
                    View view2 = binding.bankWalletScreenshotPickerBtn;
                    Intrinsics.checkNotNullExpressionValue(view2, "binding.bankWalletScreenshotPickerBtn");
                    view2.setVisibility(8);
                    binding2 = KycSubmitActivity.this.getBinding();
                    binding2.bankWalletScreenshotPicker.setSinglePic(true);
                    binding3 = KycSubmitActivity.this.getBinding();
                    binding3.bankWalletScreenshotPicker.hideAddBtn(true);
                    binding4 = KycSubmitActivity.this.getBinding();
                    PhotoPickerView photoPickerView = binding4.bankWalletScreenshotPicker;
                    Intrinsics.checkNotNullExpressionValue(photoPickerView, "binding.bankWalletScreenshotPicker");
                    photoPickerView.setVisibility(0);
                    binding5 = KycSubmitActivity.this.getBinding();
                    binding5.bankWalletScreenshotPicker.addItems(arrayList);
                }
            });
            if (!newInstance.isAdded() && !newInstance.isVisible()) {
                newInstance.show(kycSubmitActivity.getSupportFragmentManager(), "InternationalPayoneerDialog");
            }
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    public final void save() {
        throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.user.KycSubmitActivity.save():void");
    }

    private final void validateIfsc(String ifscCode, final Function1<? super Boolean, Unit> isValidIfsc) {
        final ProgressDialog progressDialog = new ProgressDialog((Context) this, 0, 2, (DefaultConstructorMarker) null);
        progressDialog.setMessage("Validating IFSC code...");
        progressDialog.setCancelable(false);
        progressDialog.show();
        getApiService().validateIfscCode("https://ifsc.razorpay.com/" + ifscCode).enqueue(new Callback<IfscDataModel>() {
            public void onResponse(Call<IfscDataModel> call, Response<IfscDataModel> response) {
                IfscDataModel ifscDataModel;
                Intrinsics.checkNotNullParameter(call, "call");
                Intrinsics.checkNotNullParameter(response, "response");
                try {
                    boolean z = true;
                    Timber.d("onResponse: %s", new Object[]{response.raw()});
                    if (response.code() == 404) {
                        z = false;
                    } else if (response.isSuccessful() && (ifscDataModel = (IfscDataModel) response.body()) != null) {
                        ifscDataModel.getIFSC();
                    }
                    isValidIfsc.invoke(Boolean.valueOf(z));
                } finally {
                    progressDialog.dismiss();
                }
            }

            public void onFailure(Call<IfscDataModel> call, Throwable t) {
                Intrinsics.checkNotNullParameter(call, "call");
                Intrinsics.checkNotNullParameter(t, "t");
                Timber.e("Failed to fetch IFSC details: " + t.getMessage(), new Object[0]);
                progressDialog.dismiss();
                isValidIfsc.invoke(true);
            }
        });
    }

    private final void requestPermissions() {
        if (Build.VERSION.SDK_INT <= 29) {
            if (EasyPermissions.hasPermissions((Context) this, new String[]{this.PERMISSIONS_R.toString()})) {
                return;
            }
            EasyPermissions.requestPermissions(new PermissionRequest.Builder((Activity) this, 1010, new String[]{this.PERMISSIONS_Q.toString()}).setRationale(2131952600).setPositiveButtonText(2131952378).build());
        } else if (Build.VERSION.SDK_INT > 29) {
            String[] strArr = this.PERMISSIONS_Q;
            if (EasyPermissions.hasPermissions((Context) this, (String[]) Arrays.copyOf(strArr, strArr.length))) {
                return;
            }
            EasyPermissions.requestPermissions(new PermissionRequest.Builder((Activity) this, 1010, new String[]{this.PERMISSIONS_R.toString()}).setRationale(2131952600).setPositiveButtonText(2131952378).build());
        }
    }

    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if (intent == null || !intent.getBooleanExtra("edit", false)) {
            return;
        }
        getViewModel().setEdit(true);
        UserViewModel.getUserDetails$default(getViewModel(), false, 1, null);
    }

    public void finish() {
        if (isTaskRoot()) {
            goToHomeActivity();
        } else {
            super.finish();
        }
    }

    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        Intrinsics.checkNotNullParameter(permissions, NativeProtocol.RESULT_ARGS_PERMISSIONS);
        Intrinsics.checkNotNullParameter(grantResults, "grantResults");
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, new Object[]{this});
    }

    public void onPermissionsDenied(int requestCode, List<String> perms) {
        Intrinsics.checkNotNullParameter(perms, "perms");
        if (requestCode == 1010) {
            if (Build.VERSION.SDK_INT >= 30) {
                if (perms.contains("android.permission.CAMERA") || perms.contains("android.permission.READ_EXTERNAL_STORAGE")) {
                    Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
                    intent.setData(Uri.fromParts("package", getPackageName(), null));
                    startActivityForResult(intent, requestCode);
                    return;
                }
                return;
            }
            if (perms.contains("android.permission.CAMERA") || perms.contains("android.permission.WRITE_EXTERNAL_STORAGE") || perms.contains("android.permission.READ_EXTERNAL_STORAGE")) {
                Intent intent2 = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
                intent2.setData(Uri.fromParts("package", getPackageName(), null));
                startActivityForResult(intent2, requestCode);
            }
        }
    }
}