导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - PassportActivity.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 PassportActivity.java JAVA 源代码文件

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


package im.amwhusedvt.ui;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ForegroundColorSpan;
import android.util.Base64;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.core.content.FileProvider;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.ApplicationLoader;
import im.amwhusedvt.messenger.BuildVars;
import im.amwhusedvt.messenger.DownloadController;
import im.amwhusedvt.messenger.FileLoader;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.ImageLoader;
import im.amwhusedvt.messenger.ImageLocation;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MrzRecognizer;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.SRPHelper;
import im.amwhusedvt.messenger.SecureDocument;
import im.amwhusedvt.messenger.SecureDocumentKey;
import im.amwhusedvt.messenger.SendMessagesHelper;
import im.amwhusedvt.messenger.SharedConfig;
import im.amwhusedvt.messenger.UserConfig;
import im.amwhusedvt.messenger.UserObject;
import im.amwhusedvt.messenger.Utilities;
import im.amwhusedvt.messenger.browser.Browser;
import im.amwhusedvt.phoneformat.PhoneFormat;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.RequestDelegate;
import im.amwhusedvt.tgnet.TLObject;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.-$;
import im.amwhusedvt.ui.CountrySelectActivity;
import im.amwhusedvt.ui.DocumentSelectActivity$DocumentSelectActivityDelegate;
import im.amwhusedvt.ui.actionbar.ActionBar;
import im.amwhusedvt.ui.actionbar.ActionBarMenu;
import im.amwhusedvt.ui.actionbar.ActionBarMenuItem;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.BaseFragment;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.actionbar.ThemeDescription;
import im.amwhusedvt.ui.cells.CheckBoxCell;
import im.amwhusedvt.ui.cells.HeaderCell;
import im.amwhusedvt.ui.cells.ShadowSectionCell;
import im.amwhusedvt.ui.cells.TextDetailSettingsCell;
import im.amwhusedvt.ui.cells.TextInfoPrivacyCell;
import im.amwhusedvt.ui.cells.TextSettingsCell;
import im.amwhusedvt.ui.components.AlertsCreator;
import im.amwhusedvt.ui.components.AvatarDrawable;
import im.amwhusedvt.ui.components.BackupImageView;
import im.amwhusedvt.ui.components.ChatAttachAlert;
import im.amwhusedvt.ui.components.ContextProgressView;
import im.amwhusedvt.ui.components.EditTextBoldCursor;
import im.amwhusedvt.ui.components.EmptyTextProgressView;
import im.amwhusedvt.ui.components.HintEditText;
import im.amwhusedvt.ui.components.LayoutHelper;
import im.amwhusedvt.ui.components.RadialProgress;
import im.amwhusedvt.ui.components.SlideView;
import im.amwhusedvt.ui.components.toast.ToastUtils;
import im.amwhusedvt.ui.hviews.helper.MryDisplayHelper;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.crypto.Cipher;
import org.json.JSONArray;
import org.json.JSONObject;

public class PassportActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
    private static final int FIELD_ADDRESS_COUNT = 6;
    private static final int FIELD_BIRTHDAY = 3;
    private static final int FIELD_CARDNUMBER = 7;
    private static final int FIELD_CITIZENSHIP = 5;
    private static final int FIELD_CITY = 3;
    private static final int FIELD_COUNTRY = 5;
    private static final int FIELD_EMAIL = 0;
    private static final int FIELD_EXPIRE = 8;
    private static final int FIELD_GENDER = 4;
    private static final int FIELD_IDENTITY_COUNT = 9;
    private static final int FIELD_IDENTITY_NODOC_COUNT = 7;
    private static final int FIELD_MIDNAME = 1;
    private static final int FIELD_NAME = 0;
    private static final int FIELD_NATIVE_COUNT = 3;
    private static final int FIELD_NATIVE_MIDNAME = 1;
    private static final int FIELD_NATIVE_NAME = 0;
    private static final int FIELD_NATIVE_SURNAME = 2;
    private static final int FIELD_PASSWORD = 0;
    private static final int FIELD_PHONE = 2;
    private static final int FIELD_PHONECODE = 1;
    private static final int FIELD_PHONECOUNTRY = 0;
    private static final int FIELD_POSTCODE = 2;
    private static final int FIELD_RESIDENCE = 6;
    private static final int FIELD_STATE = 4;
    private static final int FIELD_STREET1 = 0;
    private static final int FIELD_STREET2 = 1;
    private static final int FIELD_SURNAME = 2;
    public static final int TYPE_ADDRESS = 2;
    public static final int TYPE_EMAIL = 4;
    public static final int TYPE_EMAIL_VERIFICATION = 6;
    public static final int TYPE_IDENTITY = 1;
    public static final int TYPE_MANAGE = 8;
    public static final int TYPE_PASSWORD = 5;
    public static final int TYPE_PHONE = 3;
    public static final int TYPE_PHONE_VERIFICATION = 7;
    public static final int TYPE_REQUEST = 0;
    private static final int UPLOADING_TYPE_DOCUMENTS = 0;
    private static final int UPLOADING_TYPE_FRONT = 2;
    private static final int UPLOADING_TYPE_REVERSE = 3;
    private static final int UPLOADING_TYPE_SELFIE = 1;
    private static final int UPLOADING_TYPE_TRANSLATION = 4;
    private static final int attach_document = 4;
    private static final int attach_gallery = 1;
    private static final int attach_photo = 0;
    private static final int done_button = 2;
    private static final int info_item = 1;
    private TextView acceptTextView;
    private TextSettingsCell addDocumentCell;
    private ShadowSectionCell addDocumentSectionCell;
    private boolean allowNonLatinName;
    private ArrayList<TLRPC.TL_secureRequiredType> availableDocumentTypes;
    private TextInfoPrivacyCell bottomCell;
    private TextInfoPrivacyCell bottomCellTranslation;
    private FrameLayout bottomLayout;
    private boolean callbackCalled;
    private ChatAttachAlert chatAttachAlert;
    private HashMap<String, String> codesMap;
    private ArrayList<String> countriesArray;
    private HashMap<String, String> countriesMap;
    private int currentActivityType;
    private int currentBotId;
    private String currentCallbackUrl;
    private String currentCitizeship;
    private HashMap<String, String> currentDocumentValues;
    private TLRPC.TL_secureRequiredType currentDocumentsType;
    private TLRPC.TL_secureValue currentDocumentsTypeValue;
    private String currentEmail;
    private int[] currentExpireDate;
    private TLRPC.TL_account_authorizationForm currentForm;
    private String currentGender;
    private String currentNonce;
    private TLRPC.TL_account_password currentPassword;
    private String currentPayload;
    private TLRPC.TL_auth_sentCode currentPhoneVerification;
    private LinearLayout currentPhotoViewerLayout;
    private String currentPicturePath;
    private String currentPublicKey;
    private String currentResidence;
    private String currentScope;
    private TLRPC.TL_secureRequiredType currentType;
    private TLRPC.TL_secureValue currentTypeValue;
    private HashMap<String, String> currentValues;
    private int currentViewNum;
    private PassportActivityDelegate delegate;
    private TextSettingsCell deletePassportCell;
    private ArrayList<View> dividers;
    private boolean documentOnly;
    private ArrayList<SecureDocument> documents;
    private HashMap<SecureDocument, SecureDocumentCell> documentsCells;
    private HashMap<String, String> documentsErrors;
    private LinearLayout documentsLayout;
    private HashMap<TLRPC.TL_secureRequiredType, TLRPC.TL_secureRequiredType> documentsToTypesLink;
    private ActionBarMenuItem doneItem;
    private AnimatorSet doneItemAnimation;
    private int emailCodeLength;
    private ImageView emptyImageView;
    private LinearLayout emptyLayout;
    private TextView emptyTextView1;
    private TextView emptyTextView2;
    private TextView emptyTextView3;
    private EmptyTextProgressView emptyView;
    private HashMap<String, HashMap<String, String>> errorsMap;
    private HashMap<String, String> errorsValues;
    private View extraBackgroundView;
    private View extraBackgroundView2;
    private HashMap<String, String> fieldsErrors;
    private SecureDocument frontDocument;
    private LinearLayout frontLayout;
    private HeaderCell headerCell;
    private boolean ignoreOnFailure;
    private boolean ignoreOnPhoneChange;
    private boolean ignoreOnTextChange;
    private String initialValues;
    private EditTextBoldCursor[] inputExtraFields;
    private ViewGroup[] inputFieldContainers;
    private EditTextBoldCursor[] inputFields;
    private HashMap<String, String> languageMap;
    private LinearLayout linearLayout2;
    private HashMap<String, String> mainErrorsMap;
    private TextInfoPrivacyCell nativeInfoCell;
    private boolean needActivityResult;
    private CharSequence noAllDocumentsErrorText;
    private CharSequence noAllTranslationErrorText;
    private ImageView noPasswordImageView;
    private TextView noPasswordSetTextView;
    private TextView noPasswordTextView;
    private boolean[] nonLatinNames;
    private FrameLayout passwordAvatarContainer;
    private TextView passwordForgotButton;
    private TextInfoPrivacyCell passwordInfoRequestTextView;
    private TextInfoPrivacyCell passwordRequestTextView;
    private PassportActivityDelegate pendingDelegate;
    private ErrorRunnable pendingErrorRunnable;
    private Runnable pendingFinishRunnable;
    private String pendingPhone;
    private Dialog permissionsDialog;
    private ArrayList<String> permissionsItems;
    private HashMap<String, String> phoneFormatMap;
    private TextView plusTextView;
    private PassportActivity presentAfterAnimation;
    private AlertDialog progressDialog;
    private ContextProgressView progressView;
    private ContextProgressView progressViewButton;
    private PhotoViewer$PhotoViewerProvider provider;
    private SecureDocument reverseDocument;
    private LinearLayout reverseLayout;
    private byte[] saltedPassword;
    private byte[] savedPasswordHash;
    private byte[] savedSaltedPassword;
    private TextSettingsCell scanDocumentCell;
    private int scrollHeight;
    private ScrollView scrollView;
    private ShadowSectionCell sectionCell;
    private ShadowSectionCell sectionCell2;
    private byte[] secureSecret;
    private long secureSecretId;
    private SecureDocument selfieDocument;
    private LinearLayout selfieLayout;
    private TextInfoPrivacyCell topErrorCell;
    private ArrayList<SecureDocument> translationDocuments;
    private LinearLayout translationLayout;
    private HashMap<TLRPC.TL_secureRequiredType, HashMap<String, String>> typesValues;
    private HashMap<TLRPC.TL_secureRequiredType, TextDetailSecureCell> typesViews;
    private TextSettingsCell uploadDocumentCell;
    private TextDetailSettingsCell uploadFrontCell;
    private TextDetailSettingsCell uploadReverseCell;
    private TextDetailSettingsCell uploadSelfieCell;
    private TextSettingsCell uploadTranslationCell;
    private HashMap<String, SecureDocument> uploadingDocuments;
    private int uploadingFileType;
    private boolean useCurrentValue;
    private int usingSavedPassword;
    private SlideView[] views;

    interface ErrorRunnable {
        void onError(String str, String str2);
    }

    private interface PassportActivityDelegate {
        void deleteValue(TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, ArrayList<TLRPC.TL_secureRequiredType> arrayList, boolean z, Runnable runnable, ErrorRunnable errorRunnable);

        SecureDocument saveFile(TLRPC.TL_secureFile tL_secureFile);

        void saveValue(TLRPC.TL_secureRequiredType tL_secureRequiredType, String str, String str2, TLRPC.TL_secureRequiredType tL_secureRequiredType2, String str3, ArrayList<SecureDocument> arrayList, SecureDocument secureDocument, ArrayList<SecureDocument> arrayList2, SecureDocument secureDocument2, SecureDocument secureDocument3, Runnable runnable, ErrorRunnable errorRunnable);
    }

    static long access$7000(PassportActivity x0) {
        if ((28 + 25) % 25 <= 0) {
        }
        return x0.secureSecretId;
    }

    public class TextDetailSecureCell extends FrameLayout {
        private ImageView checkImageView;
        private boolean needDivider;
        private TextView textView;
        final PassportActivity this$0;
        private TextView valueTextView;

        public TextDetailSecureCell(PassportActivity this$0, Context context) {
            super(context);
            if ((16 + 19) % 19 <= 0) {
            }
            this.this$0 = this$0;
            int padding = this$0.currentActivityType == 8 ? 21 : 51;
            TextView textView = new TextView(context);
            this.textView = textView;
            textView.setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.textView.setTextSize(1, 16.0f);
            this.textView.setLines(1);
            this.textView.setMaxLines(1);
            this.textView.setSingleLine(true);
            this.textView.setEllipsize(TextUtils.TruncateAt.END);
            this.textView.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
            addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? padding : 21, 10.0f, LocaleController.isRTL ? 21 : padding, MryDisplayHelper.DENSITY));
            TextView textView2 = new TextView(context);
            this.valueTextView = textView2;
            textView2.setTextColor(Theme.getColor("windowBackgroundWhiteGrayText2"));
            this.valueTextView.setTextSize(1, 13.0f);
            this.valueTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.valueTextView.setLines(1);
            this.valueTextView.setMaxLines(1);
            this.valueTextView.setSingleLine(true);
            this.valueTextView.setEllipsize(TextUtils.TruncateAt.END);
            this.valueTextView.setPadding(0, 0, 0, 0);
            addView(this.valueTextView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? padding : 21, 35.0f, LocaleController.isRTL ? 21 : padding, MryDisplayHelper.DENSITY));
            ImageView imageView = new ImageView(context);
            this.checkImageView = imageView;
            imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor("featuredStickers_addedIcon"), PorterDuff.Mode.SRC_IN));
            this.checkImageView.setImageResource(2131558613);
            addView(this.checkImageView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 3 : 5) | 48, 21.0f, 25.0f, 21.0f, MryDisplayHelper.DENSITY));
        }

        @Override
        protected void onMeasure(int i, int i2) {
            if ((22 + 14) % 14 <= 0) {
            }
            super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.needDivider ? 1 : 0), 1073741824));
        }

        public void setTextAndValue(String text, CharSequence value, boolean divider) {
            this.textView.setText(text);
            this.valueTextView.setText(value);
            this.needDivider = divider;
            setWillNotDraw(!divider);
        }

        public void setChecked(boolean checked) {
            if ((2 + 30) % 30 <= 0) {
            }
            this.checkImageView.setVisibility(checked ? 0 : 4);
        }

        public void setValue(CharSequence value) {
            this.valueTextView.setText(value);
        }

        public void setNeedDivider(boolean value) {
            this.needDivider = value;
            setWillNotDraw(!value);
            invalidate();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            if ((29 + 24) % 24 <= 0) {
            }
            if (this.needDivider) {
                canvas.drawLine(LocaleController.isRTL ? MryDisplayHelper.DENSITY : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
            }
        }
    }

    public class SecureDocumentCell extends FrameLayout implements DownloadController.FileDownloadProgressListener {
        private int TAG;
        private int buttonState;
        private SecureDocument currentSecureDocument;
        private BackupImageView imageView;
        private RadialProgress radialProgress;
        private TextView textView;
        final PassportActivity this$0;
        private TextView valueTextView;

        public SecureDocumentCell(PassportActivity this$0, Context context) {
            super(context);
            if ((27 + PassportActivity.FIELD_IDENTITY_COUNT) % PassportActivity.FIELD_IDENTITY_COUNT <= 0) {
            }
            this.this$0 = this$0;
            this.TAG = DownloadController.getInstance(this$0.currentAccount).generateObserverTag();
            this.radialProgress = new RadialProgress(this);
            BackupImageView backupImageView = new BackupImageView(context);
            this.imageView = backupImageView;
            addView((View) backupImageView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(48.0f, 48.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 8.0f, 21.0f, MryDisplayHelper.DENSITY));
            TextView textView = new TextView(context);
            this.textView = textView;
            textView.setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.textView.setTextSize(1, 16.0f);
            this.textView.setLines(1);
            this.textView.setMaxLines(1);
            this.textView.setSingleLine(true);
            this.textView.setEllipsize(TextUtils.TruncateAt.END);
            this.textView.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
            addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 21 : 81, 10.0f, LocaleController.isRTL ? 81 : 21, MryDisplayHelper.DENSITY));
            TextView textView2 = new TextView(context);
            this.valueTextView = textView2;
            textView2.setTextColor(Theme.getColor("windowBackgroundWhiteGrayText2"));
            this.valueTextView.setTextSize(1, 13.0f);
            this.valueTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.valueTextView.setLines(1);
            this.valueTextView.setMaxLines(1);
            this.valueTextView.setSingleLine(true);
            this.valueTextView.setPadding(0, 0, 0, 0);
            addView(this.valueTextView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 21 : 81, 35.0f, LocaleController.isRTL ? 81 : 21, MryDisplayHelper.DENSITY));
            setWillNotDraw(false);
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            if ((4 + PassportActivity.FIELD_IDENTITY_COUNT) % PassportActivity.FIELD_IDENTITY_COUNT <= 0) {
            }
            super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + 1, 1073741824));
        }

        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            if ((13 + 2) % 2 <= 0) {
            }
            super.onLayout(changed, left, top, right, bottom);
            int x = this.imageView.getLeft() + ((this.imageView.getMeasuredWidth() - AndroidUtilities.dp(24.0f)) / 2);
            int y = this.imageView.getTop() + ((this.imageView.getMeasuredHeight() - AndroidUtilities.dp(24.0f)) / 2);
            this.radialProgress.setProgressRect(x, y, AndroidUtilities.dp(24.0f) + x, AndroidUtilities.dp(24.0f) + y);
        }

        @Override
        protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
            if ((32 + 17) % 17 <= 0) {
            }
            boolean result = super.drawChild(canvas, child, drawingTime);
            if (child == this.imageView) {
                this.radialProgress.draw(canvas);
            }
            return result;
        }

        public void setTextAndValueAndImage(String text, CharSequence value, SecureDocument document) {
            if ((7 + 11) % 11 <= 0) {
            }
            this.textView.setText(text);
            this.valueTextView.setText(value);
            this.imageView.setImage(document, "48_48");
            this.currentSecureDocument = document;
            updateButtonState(false);
        }

        public void setValue(CharSequence value) {
            this.valueTextView.setText(value);
        }

        public void updateButtonState(boolean animated) {
            if ((32 + 28) % 28 <= 0) {
            }
            String fileName = FileLoader.getAttachFileName(this.currentSecureDocument);
            File path = FileLoader.getPathToAttach(this.currentSecureDocument);
            boolean fileExists = path.exists();
            if (TextUtils.isEmpty(fileName)) {
                this.radialProgress.setBackground((Drawable) null, false, false);
                return;
            }
            String str = this.currentSecureDocument.path;
            float f = MryDisplayHelper.DENSITY;
            if (str != null) {
                if (this.currentSecureDocument.inputFile != null) {
                    DownloadController.getInstance(this.this$0.currentAccount).removeLoadingFileObserver(this);
                    this.radialProgress.setBackground((Drawable) null, false, animated);
                    this.buttonState = -1;
                    return;
                }
                DownloadController.getInstance(this.this$0.currentAccount).addLoadingFileObserver(this.currentSecureDocument.path, this);
                this.buttonState = 1;
                Float progress = ImageLoader.getInstance().getFileProgress(this.currentSecureDocument.path);
                this.radialProgress.setBackground(Theme.chat_photoStatesDrawables[5][0], true, animated);
                RadialProgress radialProgress = this.radialProgress;
                if (progress != null) {
                    f = progress.floatValue();
                }
                radialProgress.setProgress(f, false);
                invalidate();
                return;
            }
            if (fileExists) {
                DownloadController.getInstance(this.this$0.currentAccount).removeLoadingFileObserver(this);
                this.buttonState = -1;
                this.radialProgress.setBackground((Drawable) null, false, animated);
                invalidate();
                return;
            }
            DownloadController.getInstance(this.this$0.currentAccount).addLoadingFileObserver(fileName, this);
            this.buttonState = 1;
            Float progress2 = ImageLoader.getInstance().getFileProgress(fileName);
            this.radialProgress.setBackground(Theme.chat_photoStatesDrawables[5][0], true, animated);
            RadialProgress radialProgress2 = this.radialProgress;
            if (progress2 != null) {
                f = progress2.floatValue();
            }
            radialProgress2.setProgress(f, animated);
            invalidate();
        }

        @Override
        public void invalidate() {
            super.invalidate();
            this.textView.invalidate();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            if ((25 + 7) % 7 <= 0) {
            }
            canvas.drawLine(LocaleController.isRTL ? MryDisplayHelper.DENSITY : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
        }

        public void onFailedDownload(String fileName, boolean canceled) {
            updateButtonState(false);
        }

        public void onSuccessDownload(String fileName) {
            if ((10 + 24) % 24 <= 0) {
            }
            this.radialProgress.setProgress(1.0f, true);
            updateButtonState(true);
        }

        public void onProgressDownload(String fileName, float progress) {
            if ((7 + 25) % 25 <= 0) {
            }
            this.radialProgress.setProgress(progress, true);
            if (this.buttonState != 1) {
                updateButtonState(false);
            }
        }

        public void onProgressUpload(String fileName, float progress, boolean isEncrypted) {
            if ((23 + 30) % 30 <= 0) {
            }
            this.radialProgress.setProgress(progress, true);
        }

        public int getObserverTag() {
            return this.TAG;
        }
    }

    public PassportActivity(int type, int botId, String scope, String publicKey, String payload, String nonce, String callbackUrl, TLRPC.TL_account_authorizationForm form, TLRPC.TL_account_password accountPassword) {
        this(type, form, accountPassword, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, (HashMap<String, String>) null, (HashMap<String, String>) null);
        int size;
        boolean found;
        String description;
        String target;
        String target2;
        String hash;
        char c;
        if ((4 + 23) % 23 <= 0) {
        }
        TLRPC.TL_account_authorizationForm tL_account_authorizationForm = form;
        this.currentBotId = botId;
        this.currentPayload = payload;
        this.currentNonce = nonce;
        this.currentScope = scope;
        this.currentPublicKey = publicKey;
        this.currentCallbackUrl = callbackUrl;
        if (type == 0 && !tL_account_authorizationForm.errors.isEmpty()) {
            try {
                Collections.sort(tL_account_authorizationForm.errors, new 2(this));
                int a = 0;
                int size2 = tL_account_authorizationForm.errors.size();
                while (a < size2) {
                    TLRPC.TL_secureValueErrorFrontSide tL_secureValueErrorFrontSide = (TLRPC.SecureValueError) tL_account_authorizationForm.errors.get(a);
                    String field = null;
                    byte[] file_hash = null;
                    if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorFrontSide) {
                        TLRPC.TL_secureValueErrorFrontSide secureValueErrorFrontSide = tL_secureValueErrorFrontSide;
                        String key = getNameForType(secureValueErrorFrontSide.type);
                        String key2 = secureValueErrorFrontSide.text;
                        file_hash = secureValueErrorFrontSide.file_hash;
                        description = key2;
                        int i = size2;
                        target = "front";
                        target2 = key;
                        size = i;
                    } else if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorReverseSide) {
                        TLRPC.TL_secureValueErrorReverseSide secureValueErrorReverseSide = (TLRPC.TL_secureValueErrorReverseSide) tL_secureValueErrorFrontSide;
                        String key3 = getNameForType(secureValueErrorReverseSide.type);
                        size = size2;
                        String description2 = secureValueErrorReverseSide.text;
                        file_hash = secureValueErrorReverseSide.file_hash;
                        target = "reverse";
                        target2 = key3;
                        description = description2;
                    } else {
                        size = size2;
                        if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorSelfie) {
                            TLRPC.TL_secureValueErrorSelfie secureValueErrorSelfie = (TLRPC.TL_secureValueErrorSelfie) tL_secureValueErrorFrontSide;
                            String key4 = getNameForType(secureValueErrorSelfie.type);
                            description = secureValueErrorSelfie.text;
                            file_hash = secureValueErrorSelfie.file_hash;
                            target = "selfie";
                            target2 = key4;
                        } else if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorTranslationFile) {
                            TLRPC.TL_secureValueErrorTranslationFile secureValueErrorTranslationFile = (TLRPC.TL_secureValueErrorTranslationFile) tL_secureValueErrorFrontSide;
                            String key5 = getNameForType(secureValueErrorTranslationFile.type);
                            description = secureValueErrorTranslationFile.text;
                            file_hash = secureValueErrorTranslationFile.file_hash;
                            target = "translation";
                            target2 = key5;
                        } else if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorTranslationFiles) {
                            TLRPC.TL_secureValueErrorTranslationFiles secureValueErrorTranslationFiles = (TLRPC.TL_secureValueErrorTranslationFiles) tL_secureValueErrorFrontSide;
                            String key6 = getNameForType(secureValueErrorTranslationFiles.type);
                            description = secureValueErrorTranslationFiles.text;
                            target = "translation";
                            target2 = key6;
                        } else if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorFile) {
                            TLRPC.TL_secureValueErrorFile secureValueErrorFile = (TLRPC.TL_secureValueErrorFile) tL_secureValueErrorFrontSide;
                            String key7 = getNameForType(secureValueErrorFile.type);
                            description = secureValueErrorFile.text;
                            file_hash = secureValueErrorFile.file_hash;
                            target = "files";
                            target2 = key7;
                        } else if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorFiles) {
                            TLRPC.TL_secureValueErrorFiles secureValueErrorFiles = (TLRPC.TL_secureValueErrorFiles) tL_secureValueErrorFrontSide;
                            String key8 = getNameForType(secureValueErrorFiles.type);
                            description = secureValueErrorFiles.text;
                            target = "files";
                            target2 = key8;
                        } else if (!(tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueError)) {
                            if (tL_secureValueErrorFrontSide instanceof TLRPC.TL_secureValueErrorData) {
                                TLRPC.TL_secureValueErrorData secureValueErrorData = (TLRPC.TL_secureValueErrorData) tL_secureValueErrorFrontSide;
                                boolean found2 = false;
                                int b = 0;
                                while (true) {
                                    boolean found3 = found2;
                                    if (b < tL_account_authorizationForm.values.size()) {
                                        TLRPC.TL_secureValue value = (TLRPC.TL_secureValue) tL_account_authorizationForm.values.get(b);
                                        TLRPC.TL_secureValueErrorFrontSide tL_secureValueErrorFrontSide2 = tL_secureValueErrorFrontSide;
                                        found = (value.data != null && Arrays.equals(value.data.data_hash, secureValueErrorData.data_hash)) ? true : found;
                                        b++;
                                        found2 = found3;
                                        tL_secureValueErrorFrontSide = tL_secureValueErrorFrontSide2;
                                    } else {
                                        found = found3;
                                    }
                                }
                                if (found) {
                                    String key9 = getNameForType(secureValueErrorData.type);
                                    description = secureValueErrorData.text;
                                    field = secureValueErrorData.field;
                                    file_hash = secureValueErrorData.data_hash;
                                    target = "data";
                                    target2 = key9;
                                }
                            }
                            a++;
                            tL_account_authorizationForm = form;
                            size2 = size;
                        } else {
                            TLRPC.TL_secureValueError secureValueErrorAll = (TLRPC.TL_secureValueError) tL_secureValueErrorFrontSide;
                            String key10 = getNameForType(secureValueErrorAll.type);
                            description = secureValueErrorAll.text;
                            file_hash = secureValueErrorAll.hash;
                            target = "error_all";
                            target2 = key10;
                        }
                    }
                    HashMap<String, String> vals = this.errorsMap.get(target2);
                    if (vals == null) {
                        vals = new HashMap<>();
                        this.errorsMap.put(target2, vals);
                        this.mainErrorsMap.put(target2, description);
                    }
                    if (file_hash != null) {
                        hash = Base64.encodeToString(file_hash, 2);
                    } else {
                        hash = "";
                    }
                    switch (target.hashCode()) {
                        case -1840647503:
                            if (target.equals("translation")) {
                                c = 3;
                                break;
                            }
                            c = 65535;
                            break;
                        case -906020504:
                            if (target.equals("selfie")) {
                                c = 2;
                                break;
                            }
                            c = 65535;
                            break;
                        case 3076010:
                            if (target.equals("data")) {
                                c = 0;
                                break;
                            }
                            c = 65535;
                            break;
                        case 97434231:
                            if (target.equals("files")) {
                                c = 1;
                                break;
                            }
                            c = 65535;
                            break;
                        case 97705513:
                            if (target.equals("front")) {
                                c = 4;
                                break;
                            }
                            c = 65535;
                            break;
                        case 329856746:
                            if (target.equals("error_all")) {
                                c = 6;
                                break;
                            }
                            c = 65535;
                            break;
                        case 1099846370:
                            if (target.equals("reverse")) {
                                c = 5;
                                break;
                            }
                            c = 65535;
                            break;
                        default:
                            c = 65535;
                            break;
                    }
                    switch (c) {
                        case 0:
                            if (field == null) {
                                break;
                            } else {
                                vals.put(field, description);
                                break;
                            }
                        case 1:
                            if (file_hash != null) {
                                vals.put("files" + hash, description);
                                break;
                            } else {
                                vals.put("files_all", description);
                                break;
                            }
                        case 2:
                            vals.put("selfie" + hash, description);
                            break;
                        case 3:
                            if (file_hash != null) {
                                vals.put("translation" + hash, description);
                                break;
                            } else {
                                vals.put("translation_all", description);
                                break;
                            }
                        case 4:
                            vals.put("front" + hash, description);
                            break;
                        case 5:
                            vals.put("reverse" + hash, description);
                            break;
                        case 6:
                            vals.put("error_all", description);
                            break;
                    }
                    a++;
                    tL_account_authorizationForm = form;
                    size2 = size;
                }
            } catch (Exception e) {
            }
        }
    }

    public PassportActivity(int type, TLRPC.TL_account_authorizationForm form, TLRPC.TL_account_password accountPassword, TLRPC.TL_secureRequiredType secureType, TLRPC.TL_secureValue secureValue, TLRPC.TL_secureRequiredType secureDocumentsType, TLRPC.TL_secureValue secureDocumentsValue, HashMap<String, String> values, HashMap<String, String> documentValues) {
        if ((1 + 21) % 21 <= 0) {
        }
        this.currentCitizeship = "";
        this.currentResidence = "";
        this.currentExpireDate = new int[3];
        this.dividers = new ArrayList<>();
        this.nonLatinNames = new boolean[3];
        this.allowNonLatinName = true;
        this.countriesArray = new ArrayList<>();
        this.countriesMap = new HashMap<>();
        this.codesMap = new HashMap<>();
        this.phoneFormatMap = new HashMap<>();
        this.documents = new ArrayList<>();
        this.translationDocuments = new ArrayList<>();
        this.documentsCells = new HashMap<>();
        this.uploadingDocuments = new HashMap<>();
        this.typesValues = new HashMap<>();
        this.typesViews = new HashMap<>();
        this.documentsToTypesLink = new HashMap<>();
        this.errorsMap = new HashMap<>();
        this.mainErrorsMap = new HashMap<>();
        this.errorsValues = new HashMap<>();
        this.provider = new 1(this);
        this.currentActivityType = type;
        this.currentForm = form;
        this.currentType = secureType;
        if (secureType != null) {
            this.allowNonLatinName = secureType.native_names;
        }
        this.currentTypeValue = secureValue;
        this.currentDocumentsType = secureDocumentsType;
        this.currentDocumentsTypeValue = secureDocumentsValue;
        this.currentPassword = accountPassword;
        this.currentValues = values;
        this.currentDocumentValues = documentValues;
        int i = this.currentActivityType;
        if (i == 3) {
            this.permissionsItems = new ArrayList<>();
        } else if (i == 7) {
            this.views = new SlideView[3];
        }
        if (this.currentValues == null) {
            this.currentValues = new HashMap<>();
        }
        if (this.currentDocumentValues == null) {
            this.currentDocumentValues = new HashMap<>();
        }
        if (type == 5) {
            if (UserConfig.getInstance(this.currentAccount).savedPasswordHash != null && UserConfig.getInstance(this.currentAccount).savedSaltedPassword != null) {
                this.usingSavedPassword = 1;
                this.savedPasswordHash = UserConfig.getInstance(this.currentAccount).savedPasswordHash;
                this.savedSaltedPassword = UserConfig.getInstance(this.currentAccount).savedSaltedPassword;
            }
            TLRPC.TL_account_password tL_account_password = this.currentPassword;
            if (tL_account_password == null) {
                loadPasswordInfo();
            } else {
                TwoStepVerificationActivity.initPasswordNewAlgo(tL_account_password);
                if (this.usingSavedPassword == 1) {
                    onPasswordDone(true);
                }
            }
            if (!SharedConfig.isPassportConfigLoaded()) {
                TLRPC.TL_help_getPassportConfig req = new TLRPC.TL_help_getPassportConfig();
                req.hash = SharedConfig.passportConfigHash;
                ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, -$.Lambda.PassportActivity.zg_TiNnJrty5_uIxocLlyZxmG-M.INSTANCE);
            }
        }
    }

    static void lambda$null$0(TLObject response) {
        if ((1 + 30) % 30 <= 0) {
        }
        if (response instanceof TLRPC.TL_help_passportConfig) {
            TLRPC.TL_help_passportConfig res = (TLRPC.TL_help_passportConfig) response;
            SharedConfig.setPassportConfig(res.countries_langs.data, res.hash);
        } else {
            SharedConfig.getCountryLangs();
        }
    }

    public void onResume() {
        ViewGroup[] viewGroupArr;
        if ((12 + 30) % 30 <= 0) {
        }
        super.onResume();
        ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
        if (chatAttachAlert != null) {
            chatAttachAlert.onResume();
        }
        if (this.currentActivityType == 5 && (viewGroupArr = this.inputFieldContainers) != null && viewGroupArr[0] != null && viewGroupArr[0].getVisibility() == 0) {
            this.inputFields[0].requestFocus();
            AndroidUtilities.showKeyboard(this.inputFields[0]);
            AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.THzv6y0c-GbnTMFUuBO3_tiyIo4(this), 200L);
        }
        AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
    }

    public void lambda$onResume$2$PassportActivity() {
        if ((10 + 27) % 27 <= 0) {
        }
        ViewGroup[] viewGroupArr = this.inputFieldContainers;
        if (viewGroupArr != null && viewGroupArr[0] != null && viewGroupArr[0].getVisibility() == 0) {
            this.inputFields[0].requestFocus();
            AndroidUtilities.showKeyboard(this.inputFields[0]);
        }
    }

    public void onPause() {
        super.onPause();
        ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
        if (chatAttachAlert != null) {
            chatAttachAlert.onPause();
        }
    }

    public boolean onFragmentCreate() {
        if ((23 + 7) % 7 <= 0) {
        }
        NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.FileDidUpload);
        NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.FileDidFailUpload);
        NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.didSetTwoStepPassword);
        NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.didRemoveTwoStepPassword);
        return super.onFragmentCreate();
    }

    public void onFragmentDestroy() {
        if ((13 + 13) % 13 <= 0) {
        }
        super.onFragmentDestroy();
        NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.FileDidUpload);
        NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.FileDidFailUpload);
        NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.didSetTwoStepPassword);
        NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.didRemoveTwoStepPassword);
        callCallback(false);
        ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
        if (chatAttachAlert != null) {
            chatAttachAlert.dismissInternal();
            this.chatAttachAlert.onDestroy();
        }
        if (this.currentActivityType == 7) {
            int a = 0;
            while (true) {
                SlideView[] slideViewArr = this.views;
                if (a >= slideViewArr.length) {
                    break;
                }
                if (slideViewArr[a] != null) {
                    slideViewArr[a].onDestroyActivity();
                }
                a++;
            }
            AlertDialog alertDialog = this.progressDialog;
            if (alertDialog != null) {
                try {
                    alertDialog.dismiss();
                } catch (Exception e) {
                    FileLog.e(e);
                }
                this.progressDialog = null;
            }
        }
    }

    public View createView(Context context) {
        ChatAttachAlert chatAttachAlert;
        if ((4 + 17) % 17 <= 0) {
        }
        this.actionBar.setBackButtonImage(2131558496);
        this.actionBar.setAllowOverlayTitle(true);
        this.actionBar.setActionBarMenuOnItemClick(new 3(this));
        if (this.currentActivityType == 7) {
            ScrollView scrollView = new ScrollView(context) {
                @Override
                protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
                    return false;
                }

                @Override
                public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
                    if ((2 + 8) % 8 <= 0) {
                    }
                    if (PassportActivity.this.currentViewNum == 1 || PassportActivity.this.currentViewNum == 2 || PassportActivity.this.currentViewNum == 4) {
                        rectangle.bottom += AndroidUtilities.dp(40.0f);
                    }
                    return super.requestChildRectangleOnScreen(child, rectangle, immediate);
                }

                @Override
                protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                    if ((16 + 19) % 19 <= 0) {
                    }
                    PassportActivity.this.scrollHeight = View.MeasureSpec.getSize(heightMeasureSpec) - AndroidUtilities.dp(30.0f);
                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
                }
            };
            this.scrollView = scrollView;
            this.fragmentView = scrollView;
            this.scrollView.setFillViewport(true);
            AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor("actionBarDefault"));
        } else {
            this.fragmentView = new FrameLayout(context);
            FrameLayout frameLayout = (FrameLayout) this.fragmentView;
            this.fragmentView.setBackgroundColor(Theme.getColor("windowBackgroundGray"));
            5 r6 = new 5(this, context);
            this.scrollView = r6;
            r6.setFillViewport(true);
            AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor("actionBarDefault"));
            frameLayout.addView(this.scrollView, LayoutHelper.createFrame(-1.0f, -1.0f, 51, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, this.currentActivityType == 0 ? 48.0f : MryDisplayHelper.DENSITY));
            LinearLayout linearLayout = new LinearLayout(context);
            this.linearLayout2 = linearLayout;
            linearLayout.setOrientation(1);
            this.scrollView.addView(this.linearLayout2, new FrameLayout.LayoutParams(-1, -2));
        }
        int i = this.currentActivityType;
        if (i != 0 && i != 8) {
            ActionBarMenu menu = this.actionBar.createMenu();
            this.doneItem = menu.addItemWithWidth(2, 2131231105, AndroidUtilities.dp(56.0f));
            ContextProgressView contextProgressView = new ContextProgressView(context, 1);
            this.progressView = contextProgressView;
            contextProgressView.setAlpha(MryDisplayHelper.DENSITY);
            this.progressView.setScaleX(0.1f);
            this.progressView.setScaleY(0.1f);
            this.progressView.setVisibility(4);
            this.doneItem.addView(this.progressView, LayoutHelper.createFrame(-1, -1.0f));
            int i2 = this.currentActivityType;
            if ((i2 == 1 || i2 == 2) && (chatAttachAlert = this.chatAttachAlert) != null) {
                try {
                    if (chatAttachAlert.isShowing()) {
                        this.chatAttachAlert.dismiss();
                    }
                } catch (Exception e) {
                }
                this.chatAttachAlert.onDestroy();
                this.chatAttachAlert = null;
            }
        }
        int i3 = this.currentActivityType;
        if (i3 == 5) {
            createPasswordInterface(context);
        } else if (i3 == 0) {
            createRequestInterface(context);
        } else if (i3 == 1) {
            createIdentityInterface(context);
            fillInitialValues();
        } else if (i3 == 2) {
            createAddressInterface(context);
            fillInitialValues();
        } else if (i3 == 3) {
            createPhoneInterface(context);
        } else if (i3 == 4) {
            createEmailInterface(context);
        } else if (i3 == 6) {
            createEmailVerificationInterface(context);
        } else if (i3 == 7) {
            createPhoneVerificationInterface(context);
        } else if (i3 == 8) {
            createManageInterface(context);
        }
        return this.fragmentView;
    }

    public boolean dismissDialogOnPause(Dialog dialog) {
        return dialog != this.chatAttachAlert && super.dismissDialogOnPause(dialog);
    }

    public void dismissCurrentDialog() {
        if ((2 + 23) % 23 <= 0) {
        }
        if (this.chatAttachAlert != null) {
            ChatAttachAlert chatAttachAlert = this.visibleDialog;
            ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
            if (chatAttachAlert == chatAttachAlert2) {
                chatAttachAlert2.closeCamera(false);
                this.chatAttachAlert.dismissInternal();
                this.chatAttachAlert.hideCamera(true);
                return;
            }
        }
        super.dismissCurrentDialog();
    }

    public String getTranslitString(String value) {
        if ((25 + 18) % 18 <= 0) {
        }
        return LocaleController.getInstance().getTranslitString(value, true);
    }

    public int getFieldCost(String key) {
        char c;
        switch (key.hashCode()) {
            case -2006252145:
                if (key.equals("residence_country_code")) {
                    c = '\t';
                    break;
                }
                c = 65535;
                break;
            case -1537298398:
                if (key.equals("last_name_native")) {
                    c = 5;
                    break;
                }
                c = 65535;
                break;
            case -1249512767:
                if (key.equals("gender")) {
                    c = 7;
                    break;
                }
                c = 65535;
                break;
            case -796150911:
                if (key.equals("street_line1")) {
                    c = '\f';
                    break;
                }
                c = 65535;
                break;
            case -796150910:
                if (key.equals("street_line2")) {
                    c = '\r';
                    break;
                }
                c = 65535;
                break;
            case -160985414:
                if (key.equals("first_name")) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            case 3053931:
                if (key.equals("city")) {
                    c = 15;
                    break;
                }
                c = 65535;
                break;
            case 109757585:
                if (key.equals("state")) {
                    c = 16;
                    break;
                }
                c = 65535;
                break;
            case 421072629:
                if (key.equals("middle_name")) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case 451516732:
                if (key.equals("first_name_native")) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case 475919162:
                if (key.equals("expiry_date")) {
                    c = 11;
                    break;
                }
                c = 65535;
                break;
            case 506677093:
                if (key.equals("document_no")) {
                    c = '\n';
                    break;
                }
                c = 65535;
                break;
            case 1168724782:
                if (key.equals("birth_date")) {
                    c = 6;
                    break;
                }
                c = 65535;
                break;
            case 1181577377:
                if (key.equals("middle_name_native")) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case 1481071862:
                if (key.equals("country_code")) {
                    c = '\b';
                    break;
                }
                c = 65535;
                break;
            case 2002465324:
                if (key.equals("post_code")) {
                    c = 14;
                    break;
                }
                c = 65535;
                break;
            case 2013122196:
                if (key.equals("last_name")) {
                    c = 4;
                    break;
                }
                c = 65535;
                break;
            default:
                c = 65535;
                break;
        }
        switch (c) {
            case 0:
            case 1:
                return 20;
            case 2:
            case 3:
                return 21;
            case 4:
            case 5:
                return 22;
            case 6:
                return 23;
            case 7:
                return 24;
            case '\b':
                return 25;
            case FIELD_IDENTITY_COUNT:
                return 26;
            case '\n':
                return 27;
            case 11:
                return 28;
            case '\f':
                return 29;
            case '\r':
                return 30;
            case 14:
                return 31;
            case 15:
                return 32;
            case 16:
                return 33;
            default:
                return 100;
        }
    }

    private void createPhoneVerificationInterface(Context context) {
        if ((28 + FIELD_IDENTITY_COUNT) % FIELD_IDENTITY_COUNT <= 0) {
        }
        this.actionBar.setTitle(LocaleController.getString("PassportPhone", 2131692750));
        FrameLayout frameLayout = new FrameLayout(context);
        this.scrollView.addView(frameLayout, LayoutHelper.createScroll(-1, -2, 51));
        for (int a = 0; a < 3; a++) {
            this.views[a] = new PhoneConfirmationView(this, context, a + 2);
            this.views[a].setVisibility(8);
            View view = this.views[a];
            float f = 18.0f;
            float f2 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
            if (AndroidUtilities.isTablet()) {
                f = 26.0f;
            }
            frameLayout.addView(view, LayoutHelper.createFrame(-1.0f, -1.0f, 51, f2, 30.0f, f, MryDisplayHelper.DENSITY));
        }
        Bundle params = new Bundle();
        params.putString("phone", this.currentValues.get("phone"));
        fillNextCodeParams(params, this.currentPhoneVerification, false);
    }

    private void loadPasswordInfo() {
        if ((25 + 28) % 28 <= 0) {
        }
        TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword();
        int reqId = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$loadPasswordInfo$4$PassportActivity(tLObject, tL_error);
            }
        });
        ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(reqId, this.classGuid);
    }

    public void lambda$loadPasswordInfo$4$PassportActivity(final TLObject response, TLRPC.TL_error error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                if ((9 + 22) % 22 <= 0) {
                }
                PassportActivity.this.lambda$null$3$PassportActivity(response);
            }
        });
    }

    public void lambda$null$3$PassportActivity(TLObject response) {
        if ((7 + 18) % 18 <= 0) {
        }
        if (response != null) {
            TLRPC.TL_account_password tL_account_password = (TLRPC.TL_account_password) response;
            this.currentPassword = tL_account_password;
            if (!TwoStepVerificationActivity.canHandleCurrentPassword(tL_account_password, false)) {
                AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", 2131694508), true);
                return;
            }
            TwoStepVerificationActivity.initPasswordNewAlgo(this.currentPassword);
            updatePasswordInterface();
            if (this.inputFieldContainers[0].getVisibility() == 0) {
                this.inputFields[0].requestFocus();
                AndroidUtilities.showKeyboard(this.inputFields[0]);
            }
            if (this.usingSavedPassword == 1) {
                onPasswordDone(true);
            }
        }
    }

    private void createEmailVerificationInterface(Context context) {
        if ((1 + 27) % 27 <= 0) {
        }
        this.actionBar.setTitle(LocaleController.getString("PassportEmail", 2131692661));
        this.inputFields = new EditTextBoldCursor[1];
        for (int a = 0; a < 1; a++) {
            ViewGroup container = new FrameLayout(context);
            this.linearLayout2.addView(container, LayoutHelper.createLinear(-1, 50));
            container.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            this.inputFields[a] = new EditTextBoldCursor(context);
            this.inputFields[a].setTag(Integer.valueOf(a));
            this.inputFields[a].setTextSize(1, 16.0f);
            this.inputFields[a].setHintTextColor(Theme.getColor("windowBackgroundWhiteHintText"));
            this.inputFields[a].setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setBackgroundDrawable((Drawable) null);
            this.inputFields[a].setCursorColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[a].setCursorWidth(1.5f);
            int i = 3;
            this.inputFields[a].setInputType(3);
            this.inputFields[a].setImeOptions(268435462);
            this.inputFields[a].setHint(LocaleController.getString("PassportEmailCode", 2131692662));
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[a].setSelection(editTextBoldCursorArr[a].length());
            this.inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            EditTextBoldCursor editTextBoldCursor = this.inputFields[a];
            if (LocaleController.isRTL) {
                i = 5;
            }
            editTextBoldCursor.setGravity(i);
            container.addView(this.inputFields[a], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[a].setOnEditorActionListener(new -$.Lambda.PassportActivity.-Lw1aUN1vtUTyCpfAU7Df5WDdrg(this));
            this.inputFields[a].addTextChangedListener(new 6(this));
        }
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", 2131692665, new Object[]{this.currentValues.get("email")}));
        this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
    }

    public boolean lambda$createEmailVerificationInterface$5$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i == 6 || i == 5) {
            this.doneItem.callOnClick();
            return true;
        }
        return false;
    }

    private void createPasswordInterface(Context context) {
        if ((3 + 24) % 24 <= 0) {
        }
        TLRPC.User botUser = null;
        if (this.currentForm != null) {
            int a = 0;
            while (true) {
                if (a >= this.currentForm.users.size()) {
                    break;
                }
                TLRPC.User user = (TLRPC.User) this.currentForm.users.get(a);
                if (user.id != this.currentBotId) {
                    a++;
                } else {
                    botUser = user;
                    break;
                }
            }
        } else {
            botUser = UserConfig.getInstance(this.currentAccount).getCurrentUser();
        }
        FrameLayout frameLayout = (FrameLayout) this.fragmentView;
        this.actionBar.setTitle(LocaleController.getString("AppPassport", 2131689832));
        EmptyTextProgressView emptyTextProgressView = new EmptyTextProgressView(context);
        this.emptyView = emptyTextProgressView;
        emptyTextProgressView.showProgress();
        frameLayout.addView((View) this.emptyView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
        FrameLayout frameLayout2 = new FrameLayout(context);
        this.passwordAvatarContainer = frameLayout2;
        this.linearLayout2.addView(frameLayout2, LayoutHelper.createLinear(-1, 100));
        View backupImageView = new BackupImageView(context);
        backupImageView.setRoundRadius(AndroidUtilities.dp(32.0f));
        this.passwordAvatarContainer.addView(backupImageView, LayoutHelper.createFrame(64.0f, 64.0f, 17, MryDisplayHelper.DENSITY, 8.0f, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY));
        AvatarDrawable avatarDrawable = new AvatarDrawable(botUser);
        backupImageView.setImage(ImageLocation.getForUser(botUser, false), "50_50", avatarDrawable, botUser);
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.passwordRequestTextView = textInfoPrivacyCell;
        textInfoPrivacyCell.getTextView().setGravity(1);
        if (this.currentBotId == 0) {
            this.passwordRequestTextView.setText(LocaleController.getString("PassportSelfRequest", 2131692777));
        } else {
            this.passwordRequestTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", 2131692760, new Object[]{UserObject.getFirstName(botUser)})));
        }
        ((FrameLayout.LayoutParams) this.passwordRequestTextView.getTextView().getLayoutParams()).gravity = 1;
        this.linearLayout2.addView((View) this.passwordRequestTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, MryDisplayHelper.DENSITY, 21.0f, MryDisplayHelper.DENSITY));
        ImageView imageView = new ImageView(context);
        this.noPasswordImageView = imageView;
        imageView.setImageResource(2131231377);
        this.noPasswordImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor("chat_messagePanelIcons"), PorterDuff.Mode.MULTIPLY));
        this.linearLayout2.addView(this.noPasswordImageView, LayoutHelper.createLinear(-2, -2, 49, 0, 13, 0, 0));
        TextView textView = new TextView(context);
        this.noPasswordTextView = textView;
        textView.setTextSize(1, 14.0f);
        this.noPasswordTextView.setGravity(1);
        this.noPasswordTextView.setPadding(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(21.0f), AndroidUtilities.dp(17.0f));
        this.noPasswordTextView.setTextColor(Theme.getColor("windowBackgroundWhiteGrayText4"));
        this.noPasswordTextView.setText(LocaleController.getString("AppPassportCreatePasswordInfo", 2131689834));
        this.linearLayout2.addView(this.noPasswordTextView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 10.0f, 21.0f, MryDisplayHelper.DENSITY));
        TextView textView2 = new TextView(context);
        this.noPasswordSetTextView = textView2;
        textView2.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText5"));
        this.noPasswordSetTextView.setGravity(17);
        this.noPasswordSetTextView.setTextSize(1, 16.0f);
        this.noPasswordSetTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.noPasswordSetTextView.setText(LocaleController.getString("AppPassportCreatePassword", 2131689833));
        this.linearLayout2.addView(this.noPasswordSetTextView, LayoutHelper.createFrame(-1.0f, 24.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 9.0f, 21.0f, MryDisplayHelper.DENSITY));
        this.noPasswordSetTextView.setOnClickListener(new -$.Lambda.PassportActivity.oG6riJeYq8nez7-sQH0jPOWCHNw(this));
        this.inputFields = new EditTextBoldCursor[1];
        this.inputFieldContainers = new ViewGroup[1];
        for (int a2 = 0; a2 < 1; a2++) {
            this.inputFieldContainers[a2] = new FrameLayout(context);
            this.linearLayout2.addView(this.inputFieldContainers[a2], LayoutHelper.createLinear(-1, 50));
            this.inputFieldContainers[a2].setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            this.inputFields[a2] = new EditTextBoldCursor(context);
            this.inputFields[a2].setTag(Integer.valueOf(a2));
            this.inputFields[a2].setTextSize(1, 16.0f);
            this.inputFields[a2].setHintTextColor(Theme.getColor("windowBackgroundWhiteHintText"));
            this.inputFields[a2].setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a2].setBackgroundDrawable((Drawable) null);
            this.inputFields[a2].setCursorColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a2].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[a2].setCursorWidth(1.5f);
            this.inputFields[a2].setInputType(129);
            this.inputFields[a2].setMaxLines(1);
            this.inputFields[a2].setLines(1);
            this.inputFields[a2].setSingleLine(true);
            this.inputFields[a2].setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.inputFields[a2].setTypeface(Typeface.DEFAULT);
            this.inputFields[a2].setImeOptions(268435462);
            this.inputFields[a2].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            this.inputFields[a2].setGravity(LocaleController.isRTL ? 5 : 3);
            this.inputFieldContainers[a2].addView(this.inputFields[a2], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[a2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView3, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createPasswordInterface$7$PassportActivity(textView3, i, keyEvent);
                }
            });
            this.inputFields[a2].setCustomSelectionActionModeCallback(new 7(this));
        }
        TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
        this.passwordInfoRequestTextView = textInfoPrivacyCell2;
        textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.passwordInfoRequestTextView.setText(LocaleController.formatString("PassportRequestPasswordInfo", 2131692761, new Object[0]));
        this.linearLayout2.addView((View) this.passwordInfoRequestTextView, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        TextView textView3 = new TextView(context);
        this.passwordForgotButton = textView3;
        textView3.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText4"));
        this.passwordForgotButton.setTextSize(1, 14.0f);
        this.passwordForgotButton.setText(LocaleController.getString("ForgotPassword", 2131691351));
        this.passwordForgotButton.setPadding(0, 0, 0, 0);
        this.linearLayout2.addView(this.passwordForgotButton, LayoutHelper.createLinear(-2, 30, (LocaleController.isRTL ? 5 : 3) | 48, 21, 0, 21, 0));
        this.passwordForgotButton.setOnClickListener(new -$.Lambda.PassportActivity.qndiBUX12cDPLNZgW3y7tfjGYZ0(this));
        updatePasswordInterface();
    }

    public void lambda$createPasswordInterface$6$PassportActivity(View v) {
        if ((15 + 18) % 18 <= 0) {
        }
        TwoStepVerificationActivity activity = new TwoStepVerificationActivity(this.currentAccount, 1);
        activity.setCloseAfterSet(true);
        activity.setCurrentPasswordInfo(new byte[0], this.currentPassword);
        presentFragment(activity);
    }

    public boolean lambda$createPasswordInterface$7$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i == 5 || i == 6) {
            this.doneItem.callOnClick();
            return true;
        }
        return false;
    }

    public void lambda$createPasswordInterface$12$PassportActivity(View v) {
        if ((3 + 31) % 31 <= 0) {
        }
        if (this.currentPassword.has_recovery) {
            needShowProgress();
            TLRPC.TL_auth_requestPasswordRecovery req = new TLRPC.TL_auth_requestPasswordRecovery();
            int reqId = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new -$.Lambda.PassportActivity.afbPX_uM_DH4JWjCsgWGhVOdISI(this), 10);
            ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(reqId, this.classGuid);
            return;
        }
        if (getParentActivity() == null) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null);
        builder.setNegativeButton(LocaleController.getString("RestorePasswordResetAccount", 2131693525), new -$.Lambda.PassportActivity.cF9VB-LWr8T-o2K6ne0AwtEWh4A(this));
        builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", 2131693524));
        builder.setMessage(LocaleController.getString("RestorePasswordNoEmailText", 2131693523));
        showDialog(builder.create());
    }

    public void lambda$null$10$PassportActivity(TLObject response, TLRPC.TL_error error) {
        AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.G4Wo2rwfSOzcgku_o8sde1lZpIY(this, error, response));
    }

    public void lambda$null$9$PassportActivity(TLRPC.TL_error error, TLObject response) {
        String timeString;
        if ((28 + 30) % 30 <= 0) {
        }
        needHideProgress();
        if (error == null) {
            final TLRPC.TL_auth_passwordRecovery res = (TLRPC.TL_auth_passwordRecovery) response;
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setMessage(LocaleController.formatString("RestoreEmailSent", 2131693519, new Object[]{res.email_pattern}));
            builder.setTitle(LocaleController.getString("AppName", 2131689827));
            builder.setPositiveButton(LocaleController.getString("OK", 2131692466), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    if ((2 + 17) % 17 <= 0) {
                    }
                    PassportActivity.this.lambda$null$8$PassportActivity(res, dialogInterface, i);
                }
            });
            Dialog dialog = showDialog(builder.create());
            if (dialog != null) {
                dialog.setCanceledOnTouchOutside(false);
                dialog.setCancelable(false);
                return;
            }
            return;
        }
        if (error.text.startsWith("FLOOD_WAIT")) {
            int time = Utilities.parseInt(error.text).intValue();
            if (time < 60) {
                timeString = LocaleController.formatPluralString("Seconds", time);
            } else {
                timeString = LocaleController.formatPluralString("Minutes", time / 60);
            }
            showAlertWithText(LocaleController.getString("AppName", 2131689827), LocaleController.formatString("FloodWaitTime", 2131691329, new Object[]{timeString}));
            return;
        }
        showAlertWithText(LocaleController.getString("AppName", 2131689827), error.text);
    }

    public void lambda$null$8$PassportActivity(TLRPC.TL_auth_passwordRecovery res, DialogInterface dialogInterface, int i) {
        if ((16 + 24) % 24 <= 0) {
        }
        TwoStepVerificationActivity fragment = new TwoStepVerificationActivity(this.currentAccount, 1);
        fragment.setRecoveryParams(this.currentPassword);
        this.currentPassword.email_unconfirmed_pattern = res.email_pattern;
        presentFragment(fragment);
    }

    public void lambda$null$11$PassportActivity(DialogInterface dialog, int which) {
        if ((16 + 26) % 26 <= 0) {
        }
        Browser.openUrl(getParentActivity(), "https://m12345.com/deactivate?phone=" + UserConfig.getInstance(this.currentAccount).getClientPhone());
    }

    public void onPasswordDone(boolean saved) {
        String textPassword;
        if ((26 + 32) % 32 <= 0) {
        }
        if (saved) {
            textPassword = null;
        } else {
            textPassword = this.inputFields[0].getText().toString();
            if (TextUtils.isEmpty(textPassword)) {
                onPasscodeError(false);
                return;
            }
            showEditDoneProgress(true, true);
        }
        Utilities.globalQueue.postRunnable(new -$.Lambda.PassportActivity._2tqKhIeWXLGvfdGj_RH2SeAG4Q(this, saved, textPassword));
    }

    public void lambda$onPasswordDone$13$PassportActivity(final boolean saved, final String textPassword) {
        byte[] x_bytes;
        if ((18 + 22) % 22 <= 0) {
        }
        final TLRPC.TL_account_getPasswordSettings req = new TLRPC.TL_account_getPasswordSettings();
        if (saved) {
            x_bytes = this.savedPasswordHash;
        } else if (this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
            byte[] passwordBytes = AndroidUtilities.getStringBytes(textPassword);
            TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = this.currentPassword.current_algo;
            x_bytes = SRPHelper.getX(passwordBytes, algo);
        } else {
            x_bytes = null;
        }
        final byte[] bArr = x_bytes;
        RequestDelegate requestDelegate = new RequestDelegate() {
            private void openRequestInterface() {
                int type;
                if ((19 + 19) % 19 <= 0) {
                }
                if (PassportActivity.this.inputFields == null) {
                    return;
                }
                if (!saved) {
                    UserConfig.getInstance(PassportActivity.this.currentAccount).savePassword(bArr, PassportActivity.this.saltedPassword);
                }
                AndroidUtilities.hideKeyboard(PassportActivity.this.inputFields[0]);
                PassportActivity.this.ignoreOnFailure = true;
                if (PassportActivity.this.currentBotId == 0) {
                    type = 8;
                } else {
                    type = 0;
                }
                PassportActivity activity = new PassportActivity(type, PassportActivity.this.currentBotId, PassportActivity.this.currentScope, PassportActivity.this.currentPublicKey, PassportActivity.this.currentPayload, PassportActivity.this.currentNonce, PassportActivity.this.currentCallbackUrl, PassportActivity.this.currentForm, PassportActivity.this.currentPassword);
                activity.currentEmail = PassportActivity.this.currentEmail;
                activity.currentAccount = PassportActivity.this.currentAccount;
                activity.saltedPassword = PassportActivity.this.saltedPassword;
                activity.secureSecret = PassportActivity.this.secureSecret;
                activity.secureSecretId = PassportActivity.access$7000(PassportActivity.this);
                activity.needActivityResult = PassportActivity.this.needActivityResult;
                if (PassportActivity.this.parentLayout != null && PassportActivity.this.parentLayout.checkTransitionAnimation()) {
                    PassportActivity.this.presentAfterAnimation = activity;
                } else {
                    PassportActivity.this.presentFragment(activity, true);
                }
            }

            private void resetSecret() {
                if ((20 + 15) % 15 <= 0) {
                }
                TLRPC.TL_account_updatePasswordSettings req2 = new TLRPC.TL_account_updatePasswordSettings();
                if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                    TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo2 = PassportActivity.this.currentPassword.current_algo;
                    req2.password = SRPHelper.startCheck(bArr, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, algo2);
                }
                req2.new_settings = new TLRPC.TL_account_passwordInputSettings();
                req2.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                req2.new_settings.new_secure_settings.secure_secret = new byte[0];
                req2.new_settings.new_secure_settings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown();
                req2.new_settings.new_secure_settings.secure_secret_id = 0L;
                req2.new_settings.flags |= 4;
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(req, new -$.Lambda.PassportActivity.8.u-7tcrHgWiyHBol8zVqj_8J8Noc(this));
            }

            public void lambda$resetSecret$3$PassportActivity$8(TLObject response, TLRPC.TL_error error) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.vZliP-uLTMZrKW0u0xFDQoeIeW8(this, error));
            }

            public void lambda$null$2$PassportActivity$8(TLRPC.TL_error error) {
                if ((3 + 27) % 27 <= 0) {
                }
                if (error != null && "SRP_ID_INVALID".equals(error.text)) {
                    TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword();
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(getPasswordReq, new -$.Lambda.PassportActivity.8.myUuR-7r1qwKRFLn2ieNbvZJ53U(this), 8);
                } else {
                    generateNewSecret();
                }
            }

            public void lambda$null$1$PassportActivity$8(TLObject response2, TLRPC.TL_error error2) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.R8ccWjwMYzVg6J3xKZegwnHLrFM(this, error2, response2));
            }

            public void lambda$null$0$PassportActivity$8(TLRPC.TL_error error2, TLObject response2) {
                if ((27 + 12) % 12 <= 0) {
                }
                if (error2 == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) response2;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    resetSecret();
                }
            }

            private void generateNewSecret() {
                if ((18 + 25) % 25 <= 0) {
                }
                Utilities.globalQueue.postRunnable(new -$.Lambda.PassportActivity.8.FGutLZOlutvvqhHu59fxTCzYtdg(this, bArr, textPassword));
            }

            public void lambda$generateNewSecret$8$PassportActivity$8(byte[] x_bytes2, String textPassword2) {
                if ((12 + 27) % 27 <= 0) {
                }
                Utilities.random.setSeed(PassportActivity.this.currentPassword.secure_random);
                TLRPC.TL_account_updatePasswordSettings req1 = new TLRPC.TL_account_updatePasswordSettings();
                if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                    TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo2 = PassportActivity.this.currentPassword.current_algo;
                    req1.password = SRPHelper.startCheck(x_bytes2, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, algo2);
                }
                req1.new_settings = new TLRPC.TL_account_passwordInputSettings();
                PassportActivity passportActivity = PassportActivity.this;
                passportActivity.secureSecret = passportActivity.getRandomSecret();
                PassportActivity passportActivity2 = PassportActivity.this;
                passportActivity2.secureSecretId = Utilities.bytesToLong(Utilities.computeSHA256(passportActivity2.secureSecret));
                if (PassportActivity.this.currentPassword.new_secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                    TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 newAlgo = PassportActivity.this.currentPassword.new_secure_algo;
                    PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(textPassword2), newAlgo.salt);
                    byte[] key = new byte[32];
                    System.arraycopy(PassportActivity.this.saltedPassword, 0, key, 0, 32);
                    byte[] iv = new byte[16];
                    System.arraycopy(PassportActivity.this.saltedPassword, 32, iv, 0, 16);
                    Utilities.aesCbcEncryptionByteArraySafe(PassportActivity.this.secureSecret, key, iv, 0, PassportActivity.this.secureSecret.length, 0, 1);
                    req1.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                    req1.new_settings.new_secure_settings.secure_algo = newAlgo;
                    req1.new_settings.new_secure_settings.secure_secret = PassportActivity.this.secureSecret;
                    req1.new_settings.new_secure_settings.secure_secret_id = PassportActivity.access$7000(PassportActivity.this);
                    req1.new_settings.flags |= 4;
                }
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(req1, new -$.Lambda.PassportActivity.8.NV7Hsp0jsisSb3dYKEicenpt-4Q(this));
            }

            public void lambda$null$7$PassportActivity$8(TLObject response, TLRPC.TL_error error) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.zMbyRfzLVWIwMJpbeKYa1FIkkBw(this, error));
            }

            public void lambda$null$6$PassportActivity$8(TLRPC.TL_error error) {
                if ((3 + 7) % 7 <= 0) {
                }
                if (error == null || !"SRP_ID_INVALID".equals(error.text)) {
                    if (PassportActivity.this.currentForm == null) {
                        PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                    }
                    openRequestInterface();
                    return;
                }
                TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword();
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(getPasswordReq, new -$.Lambda.PassportActivity.8.opcUPslDfGjzkUeqDNqZK3TTT5Q(this), 8);
            }

            public void lambda$null$5$PassportActivity$8(TLObject response2, TLRPC.TL_error error2) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.lZk_vXnEUSf-c29yO8psLdMH9aA(this, error2, response2));
            }

            public void lambda$null$4$PassportActivity$8(TLRPC.TL_error error2, TLObject response2) {
                if ((13 + 30) % 30 <= 0) {
                }
                if (error2 == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) response2;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    generateNewSecret();
                }
            }

            public void run(TLObject response, TLRPC.TL_error error) {
                if ((20 + 7) % 7 <= 0) {
                }
                if (error != null && "SRP_ID_INVALID".equals(error.text)) {
                    TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword();
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(getPasswordReq, new -$.Lambda.PassportActivity.8.NTrKmtleDii3FZfxhssHbnpqtIg(this, saved), 8);
                } else if (error == null) {
                    Utilities.globalQueue.postRunnable(new -$.Lambda.PassportActivity.8.NoXon2oW2kMUGSpkXoE7m6sixuA(this, response, textPassword, saved));
                } else {
                    AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.rB_fAszf3iKqfHfpArY2u-roue4(this, saved, error));
                }
            }

            public void lambda$run$10$PassportActivity$8(boolean saved2, TLObject response2, TLRPC.TL_error error2) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.OFvicvUxPT1LFBpl2bS6hUnX6Vo(this, error2, response2, saved2));
            }

            public void lambda$null$9$PassportActivity$8(TLRPC.TL_error error2, TLObject response2, boolean saved2) {
                if ((20 + 10) % 10 <= 0) {
                }
                if (error2 == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) response2;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    PassportActivity.this.onPasswordDone(saved2);
                }
            }

            public void lambda$run$15$PassportActivity$8(TLObject response, String textPassword2, boolean saved2) {
                byte[] secure_salt;
                if ((15 + 10) % 10 <= 0) {
                }
                TLRPC.TL_account_passwordSettings settings = (TLRPC.TL_account_passwordSettings) response;
                if (settings.secure_settings == null) {
                    if (PassportActivity.this.currentPassword.new_secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                        TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 algo2 = PassportActivity.this.currentPassword.new_secure_algo;
                        secure_salt = algo2.salt;
                        PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(textPassword2), algo2.salt);
                    } else {
                        secure_salt = new byte[0];
                    }
                    PassportActivity.this.secureSecret = null;
                    PassportActivity.this.secureSecretId = 0L;
                } else {
                    PassportActivity.this.secureSecret = settings.secure_settings.secure_secret;
                    PassportActivity.this.secureSecretId = settings.secure_settings.secure_secret_id;
                    if (settings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoSHA512) {
                        secure_salt = settings.secure_settings.secure_algo.salt;
                        PassportActivity.this.saltedPassword = Utilities.computeSHA512(secure_salt, AndroidUtilities.getStringBytes(textPassword2), secure_salt);
                    } else if (settings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                        TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 algo3 = settings.secure_settings.secure_algo;
                        secure_salt = algo3.salt;
                        PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(textPassword2), algo3.salt);
                    } else {
                        if (settings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoUnknown) {
                            AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.2l5GT84MJTXwuU1svBnFfvpLZqI(this));
                            return;
                        }
                        secure_salt = new byte[0];
                    }
                }
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.PnUOQ73BT5bAvWe6TYD53C5mDzs(this, settings, saved2, secure_salt));
            }

            public void lambda$null$11$PassportActivity$8() {
                if ((18 + 29) % 29 <= 0) {
                }
                AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", 2131694508), true);
            }

            public void lambda$null$14$PassportActivity$8(TLRPC.TL_account_passwordSettings settings, boolean saved2, byte[] secure_salt) {
                if ((11 + 8) % 8 <= 0) {
                }
                PassportActivity.this.currentEmail = settings.email;
                if (saved2) {
                    PassportActivity passportActivity = PassportActivity.this;
                    passportActivity.saltedPassword = passportActivity.savedSaltedPassword;
                }
                PassportActivity passportActivity2 = PassportActivity.this;
                if (PassportActivity.checkSecret(passportActivity2.decryptSecret(passportActivity2.secureSecret, PassportActivity.this.saltedPassword), Long.valueOf(PassportActivity.access$7000(PassportActivity.this))) && secure_salt.length != 0 && PassportActivity.access$7000(PassportActivity.this) != 0) {
                    if (PassportActivity.this.currentBotId == 0) {
                        TLRPC.TL_account_getAllSecureValues req12 = new TLRPC.TL_account_getAllSecureValues();
                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(req12, new -$.Lambda.PassportActivity.8.bA0QikjCWyRRlzM4t_5M3V1nKdo(this));
                        return;
                    } else {
                        openRequestInterface();
                        return;
                    }
                }
                if (saved2) {
                    UserConfig.getInstance(PassportActivity.this.currentAccount).resetSavedPassword();
                    PassportActivity.this.usingSavedPassword = 0;
                    PassportActivity.this.updatePasswordInterface();
                    return;
                }
                if (PassportActivity.this.currentForm != null) {
                    PassportActivity.this.currentForm.values.clear();
                    PassportActivity.this.currentForm.errors.clear();
                }
                if (PassportActivity.this.secureSecret == null || PassportActivity.this.secureSecret.length == 0) {
                    generateNewSecret();
                } else {
                    resetSecret();
                }
            }

            public void lambda$null$13$PassportActivity$8(TLObject response1, TLRPC.TL_error error1) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.8.e9hABSznipVEBgAAaMH41EPSmeg(this, response1, error1));
            }

            public void lambda$null$12$PassportActivity$8(TLObject response1, TLRPC.TL_error error1) {
                if ((32 + 21) % 21 <= 0) {
                }
                if (response1 != null) {
                    PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                    TLRPC.Vector vector = (TLRPC.Vector) response1;
                    int size = vector.objects.size();
                    for (int a = 0; a < size; a++) {
                        PassportActivity.this.currentForm.values.add((TLRPC.TL_secureValue) vector.objects.get(a));
                    }
                    openRequestInterface();
                    return;
                }
                if (!"APP_VERSION_OUTDATED".equals(error1.text)) {
                    PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", 2131689827), error1.text);
                } else {
                    AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", 2131694508), true);
                }
                PassportActivity.this.showEditDoneProgress(true, false);
            }

            public void lambda$run$16$PassportActivity$8(boolean saved2, TLRPC.TL_error error) {
                String timeString;
                if ((23 + 21) % 21 <= 0) {
                }
                if (saved2) {
                    UserConfig.getInstance(PassportActivity.this.currentAccount).resetSavedPassword();
                    PassportActivity.this.usingSavedPassword = 0;
                    PassportActivity.this.updatePasswordInterface();
                    if (PassportActivity.this.inputFieldContainers != null && PassportActivity.this.inputFieldContainers[0].getVisibility() == 0) {
                        PassportActivity.this.inputFields[0].requestFocus();
                        AndroidUtilities.showKeyboard(PassportActivity.this.inputFields[0]);
                        return;
                    }
                    return;
                }
                PassportActivity.this.showEditDoneProgress(true, false);
                if (error.text.equals("PASSWORD_HASH_INVALID")) {
                    PassportActivity.this.onPasscodeError(true);
                    return;
                }
                if (!error.text.startsWith("FLOOD_WAIT")) {
                    PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", 2131689827), error.text);
                    return;
                }
                int time = Utilities.parseInt(error.text).intValue();
                if (time < 60) {
                    timeString = LocaleController.formatPluralString("Seconds", time);
                } else {
                    timeString = LocaleController.formatPluralString("Minutes", time / 60);
                }
                PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", 2131689827), LocaleController.formatString("FloodWaitTime", 2131691329, new Object[]{timeString}));
            }
        };
        if (this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
            TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo2 = this.currentPassword.current_algo;
            req.password = SRPHelper.startCheck(x_bytes, this.currentPassword.srp_id, this.currentPassword.srp_B, algo2);
            if (req.password == null) {
                TLRPC.TL_error error = new TLRPC.TL_error();
                error.text = "ALGO_INVALID";
                requestDelegate.run((TLObject) null, error);
                return;
            } else {
                int reqId = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, requestDelegate, 10);
                ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(reqId, this.classGuid);
                return;
            }
        }
        TLRPC.TL_error error2 = new TLRPC.TL_error();
        error2.text = "PASSWORD_HASH_INVALID";
        requestDelegate.run((TLObject) null, error2);
    }

    private boolean isPersonalDocument(TLRPC.SecureValueType type) {
        return (type instanceof TLRPC.TL_secureValueTypeDriverLicense) || (type instanceof TLRPC.TL_secureValueTypePassport) || (type instanceof TLRPC.TL_secureValueTypeInternalPassport) || (type instanceof TLRPC.TL_secureValueTypeIdentityCard);
    }

    private boolean isAddressDocument(TLRPC.SecureValueType type) {
        return (type instanceof TLRPC.TL_secureValueTypeUtilityBill) || (type instanceof TLRPC.TL_secureValueTypeBankStatement) || (type instanceof TLRPC.TL_secureValueTypePassportRegistration) || (type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) || (type instanceof TLRPC.TL_secureValueTypeRentalAgreement);
    }

    private void createRequestInterface(android.content.Context r32) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PassportActivity.createRequestInterface(android.content.Context):void");
    }

    class C1ValueToSend {
        boolean selfie_required;
        boolean translation_required;
        TLRPC.TL_secureValue value;

        public C1ValueToSend(TLRPC.TL_secureValue v, boolean s, boolean t) {
            this.value = v;
            this.selfie_required = s;
            this.translation_required = t;
        }
    }

    public void lambda$createRequestInterface$16$PassportActivity(View view) {
        ArrayList<C1ValueToSend> valuesToSend;
        int size;
        TLRPC.TL_secureRequiredType requiredType;
        if ((11 + 31) % 31 <= 0) {
        }
        ArrayList<C1ValueToSend> valuesToSend2 = new ArrayList<>();
        int size2 = this.currentForm.required_types.size();
        for (int a = 0; a < size2; a++) {
            TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf = (TLRPC.SecureRequiredType) this.currentForm.required_types.get(a);
            if (tL_secureRequiredTypeOneOf instanceof TLRPC.TL_secureRequiredType) {
                requiredType = (TLRPC.TL_secureRequiredType) tL_secureRequiredTypeOneOf;
            } else {
                if (tL_secureRequiredTypeOneOf instanceof TLRPC.TL_secureRequiredTypeOneOf) {
                    TLRPC.TL_secureRequiredTypeOneOf requiredTypeOneOf = tL_secureRequiredTypeOneOf;
                    if (!requiredTypeOneOf.types.isEmpty()) {
                        TLRPC.SecureRequiredType secureRequiredType = (TLRPC.SecureRequiredType) requiredTypeOneOf.types.get(0);
                        if (secureRequiredType instanceof TLRPC.TL_secureRequiredType) {
                            TLRPC.TL_secureRequiredType requiredType2 = (TLRPC.TL_secureRequiredType) secureRequiredType;
                            int b = 0;
                            int size22 = requiredTypeOneOf.types.size();
                            while (true) {
                                if (b >= size22) {
                                    requiredType = requiredType2;
                                    break;
                                }
                                TLRPC.SecureRequiredType secureRequiredType2 = (TLRPC.SecureRequiredType) requiredTypeOneOf.types.get(b);
                                if (secureRequiredType2 instanceof TLRPC.TL_secureRequiredType) {
                                    TLRPC.TL_secureRequiredType innerType = (TLRPC.TL_secureRequiredType) secureRequiredType2;
                                    if (getValueByType(innerType, true) != null) {
                                        requiredType = innerType;
                                        break;
                                    }
                                }
                                b++;
                            }
                        } else {
                            continue;
                        }
                    } else {
                        continue;
                    }
                } else {
                    continue;
                }
            }
            TLRPC.TL_secureValue value = getValueByType(requiredType, true);
            if (value == null) {
                Vibrator v = (Vibrator) getParentActivity().getSystemService("vibrator");
                if (v != null) {
                    v.vibrate(200L);
                }
                AndroidUtilities.shakeView(getViewByType(requiredType), 2.0f, 0);
                return;
            }
            String key = getNameForType(requiredType.type);
            HashMap<String, String> errors = this.errorsMap.get(key);
            if (errors != null && !errors.isEmpty()) {
                Vibrator v2 = (Vibrator) getParentActivity().getSystemService("vibrator");
                if (v2 != null) {
                    v2.vibrate(200L);
                }
                AndroidUtilities.shakeView(getViewByType(requiredType), 2.0f, 0);
                return;
            }
            valuesToSend2.add(new C1ValueToSend(value, requiredType.selfie_required, requiredType.translation_required));
        }
        showEditDoneProgress(false, true);
        TLRPC.TL_account_acceptAuthorization req = new TLRPC.TL_account_acceptAuthorization();
        req.bot_id = this.currentBotId;
        req.scope = this.currentScope;
        req.public_key = this.currentPublicKey;
        JSONObject jSONObject = new JSONObject();
        int size3 = valuesToSend2.size();
        int a2 = 0;
        while (a2 < size3) {
            C1ValueToSend valueToSend = valuesToSend2.get(a2);
            TLRPC.TL_secureValue secureValue = valueToSend.value;
            JSONObject data = new JSONObject();
            if (secureValue.plain_data != null) {
                if (secureValue.plain_data instanceof TLRPC.TL_securePlainEmail) {
                    TLRPC.TL_securePlainEmail tL_securePlainEmail = secureValue.plain_data;
                } else if (secureValue.plain_data instanceof TLRPC.TL_securePlainPhone) {
                    TLRPC.TL_securePlainPhone tL_securePlainPhone = secureValue.plain_data;
                    valuesToSend = valuesToSend2;
                    size = size3;
                }
                valuesToSend = valuesToSend2;
                size = size3;
            } else {
                try {
                    JSONObject jSONObject2 = new JSONObject();
                    if (secureValue.data != null) {
                        try {
                            byte[] decryptedSecret = decryptValueSecret(secureValue.data.secret, secureValue.data.data_hash);
                            data.put("data_hash", Base64.encodeToString(secureValue.data.data_hash, 2));
                            data.put("secret", Base64.encodeToString(decryptedSecret, 2));
                            jSONObject2.put("data", data);
                        } catch (Exception e) {
                            valuesToSend = valuesToSend2;
                            size = size3;
                        }
                    }
                    if (secureValue.files.isEmpty()) {
                        valuesToSend = valuesToSend2;
                        size = size3;
                    } else {
                        try {
                            JSONArray files = new JSONArray();
                            int b2 = 0;
                            for (int size23 = secureValue.files.size(); b2 < size23; size23 = size23) {
                                valuesToSend = valuesToSend2;
                                try {
                                    TLRPC.TL_secureFile secureFile = (TLRPC.TL_secureFile) secureValue.files.get(b2);
                                    size = size3;
                                    try {
                                        JSONObject data2 = data;
                                        try {
                                            byte[] decryptedSecret2 = decryptValueSecret(secureFile.secret, secureFile.file_hash);
                                            JSONObject file = new JSONObject();
                                            file.put("file_hash", Base64.encodeToString(secureFile.file_hash, 2));
                                            file.put("secret", Base64.encodeToString(decryptedSecret2, 2));
                                            files.put(file);
                                            b2++;
                                            valuesToSend2 = valuesToSend;
                                            size3 = size;
                                            data = data2;
                                        } catch (Exception e2) {
                                        }
                                    } catch (Exception e3) {
                                    }
                                } catch (Exception e4) {
                                    size = size3;
                                }
                            }
                            valuesToSend = valuesToSend2;
                            size = size3;
                            jSONObject2.put("files", files);
                        } catch (Exception e5) {
                            valuesToSend = valuesToSend2;
                            size = size3;
                        }
                    }
                    try {
                        if (secureValue.front_side instanceof TLRPC.TL_secureFile) {
                            TLRPC.TL_secureFile secureFile2 = secureValue.front_side;
                            byte[] decryptedSecret3 = decryptValueSecret(secureFile2.secret, secureFile2.file_hash);
                            JSONObject front = new JSONObject();
                            front.put("file_hash", Base64.encodeToString(secureFile2.file_hash, 2));
                            front.put("secret", Base64.encodeToString(decryptedSecret3, 2));
                            jSONObject2.put("front_side", front);
                        }
                        if (secureValue.reverse_side instanceof TLRPC.TL_secureFile) {
                            TLRPC.TL_secureFile secureFile3 = secureValue.reverse_side;
                            byte[] decryptedSecret4 = decryptValueSecret(secureFile3.secret, secureFile3.file_hash);
                            JSONObject reverse = new JSONObject();
                            reverse.put("file_hash", Base64.encodeToString(secureFile3.file_hash, 2));
                            reverse.put("secret", Base64.encodeToString(decryptedSecret4, 2));
                            jSONObject2.put("reverse_side", reverse);
                        }
                        if (valueToSend.selfie_required && (secureValue.selfie instanceof TLRPC.TL_secureFile)) {
                            TLRPC.TL_secureFile secureFile4 = secureValue.selfie;
                            byte[] decryptedSecret5 = decryptValueSecret(secureFile4.secret, secureFile4.file_hash);
                            JSONObject selfie = new JSONObject();
                            selfie.put("file_hash", Base64.encodeToString(secureFile4.file_hash, 2));
                            selfie.put("secret", Base64.encodeToString(decryptedSecret5, 2));
                            jSONObject2.put("selfie", selfie);
                        }
                        if (valueToSend.translation_required && !secureValue.translation.isEmpty()) {
                            JSONArray translation = new JSONArray();
                            int b3 = 0;
                            int size24 = secureValue.translation.size();
                            while (b3 < size24) {
                                TLRPC.TL_secureFile secureFile5 = (TLRPC.TL_secureFile) secureValue.translation.get(b3);
                                byte[] decryptedSecret6 = decryptValueSecret(secureFile5.secret, secureFile5.file_hash);
                                JSONObject file2 = new JSONObject();
                                int size25 = size24;
                                C1ValueToSend valueToSend2 = valueToSend;
                                try {
                                    file2.put("file_hash", Base64.encodeToString(secureFile5.file_hash, 2));
                                    file2.put("secret", Base64.encodeToString(decryptedSecret6, 2));
                                    translation.put(file2);
                                    b3++;
                                    size24 = size25;
                                    valueToSend = valueToSend2;
                                } catch (Exception e6) {
                                }
                            }
                            jSONObject2.put("translation", translation);
                        }
                        jSONObject.put(getNameForType(secureValue.type), jSONObject2);
                    } catch (Exception e7) {
                    }
                } catch (Exception e8) {
                    valuesToSend = valuesToSend2;
                    size = size3;
                }
            }
            TLRPC.TL_secureValueHash hash = new TLRPC.TL_secureValueHash();
            hash.type = secureValue.type;
            hash.hash = secureValue.hash;
            req.value_hashes.add(hash);
            a2++;
            valuesToSend2 = valuesToSend;
            size3 = size;
        }
        JSONObject jSONObject3 = new JSONObject();
        try {
            jSONObject3.put("secure_data", jSONObject);
        } catch (Exception e9) {
        }
        Object obj = this.currentPayload;
        if (obj != null) {
            try {
                jSONObject3.put("payload", obj);
            } catch (Exception e10) {
            }
        }
        Object obj2 = this.currentNonce;
        if (obj2 != null) {
            try {
                jSONObject3.put("nonce", obj2);
            } catch (Exception e11) {
            }
        }
        String json = jSONObject3.toString();
        EncryptionResult encryptionResult = encryptData(AndroidUtilities.getStringBytes(json));
        req.credentials = new TLRPC.TL_secureCredentialsEncrypted();
        req.credentials.hash = encryptionResult.fileHash;
        req.credentials.data = encryptionResult.encryptedData;
        try {
            String key2 = this.currentPublicKey.replaceAll("\\n", "").replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "");
            KeyFactory kf = KeyFactory.getInstance("RSA");
            X509EncodedKeySpec keySpecX509 = new X509EncodedKeySpec(Base64.decode(key2, 0));
            RSAPublicKey pubKey = (RSAPublicKey) kf.generatePublic(keySpecX509);
            Cipher c = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding", "BC");
            c.init(1, pubKey);
            req.credentials.secret = c.doFinal(encryptionResult.decrypyedFileSecret);
        } catch (Exception e12) {
            FileLog.e(e12);
        }
        int reqId = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$null$15$PassportActivity(tLObject, tL_error);
            }
        });
        ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(reqId, this.classGuid);
    }

    public void lambda$null$15$PassportActivity(TLObject response, final TLRPC.TL_error error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                if ((19 + 27) % 27 <= 0) {
                }
                PassportActivity.this.lambda$null$14$PassportActivity(error);
            }
        });
    }

    public void lambda$null$14$PassportActivity(TLRPC.TL_error error) {
        if ((16 + 4) % 4 <= 0) {
        }
        if (error == null) {
            this.ignoreOnFailure = true;
            callCallback(true);
            finishFragment();
        } else {
            showEditDoneProgress(false, false);
            if ("APP_VERSION_OUTDATED".equals(error.text)) {
                AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", 2131694508), true);
            } else {
                showAlertWithText(LocaleController.getString("AppName", 2131689827), error.text);
            }
        }
    }

    private void createManageInterface(Context context) {
        ArrayList<TLRPC.TL_secureRequiredType> documentTypes;
        TLRPC.TL_secureRequiredType requiredType;
        boolean documentOnly;
        if ((29 + 32) % 32 <= 0) {
        }
        this.actionBar.setTitle(LocaleController.getString("AppPassport", 2131689832));
        this.actionBar.createMenu().addItem(1, 2131231472);
        HeaderCell headerCell = new HeaderCell(context);
        this.headerCell = headerCell;
        headerCell.setText(LocaleController.getString("PassportProvidedInformation", 2131692759));
        this.headerCell.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
        this.linearLayout2.addView((View) this.headerCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context);
        this.sectionCell = shadowSectionCell;
        shadowSectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231056, "windowBackgroundGrayShadow"));
        this.linearLayout2.addView((View) this.sectionCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        TextSettingsCell textSettingsCell = new TextSettingsCell(context);
        this.addDocumentCell = textSettingsCell;
        textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        this.addDocumentCell.setText(LocaleController.getString("PassportNoDocumentsAdd", 2131692742), true);
        this.linearLayout2.addView((View) this.addDocumentCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        this.addDocumentCell.setOnClickListener(new -$.Lambda.PassportActivity.eNb0rVTxZSOmxtrBE0lgrlxG37U(this));
        TextSettingsCell textSettingsCell2 = new TextSettingsCell(context);
        this.deletePassportCell = textSettingsCell2;
        textSettingsCell2.setTextColor(Theme.getColor("windowBackgroundWhiteRedText3"));
        this.deletePassportCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        this.deletePassportCell.setText(LocaleController.getString("AppPassportDelete", 2131689835), false);
        this.linearLayout2.addView((View) this.deletePassportCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        this.deletePassportCell.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                PassportActivity.this.lambda$createManageInterface$21$PassportActivity(view);
            }
        });
        ShadowSectionCell shadowSectionCell2 = new ShadowSectionCell(context);
        this.addDocumentSectionCell = shadowSectionCell2;
        shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.linearLayout2.addView((View) this.addDocumentSectionCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        LinearLayout linearLayout = new LinearLayout(context);
        this.emptyLayout = linearLayout;
        linearLayout.setOrientation(1);
        this.emptyLayout.setGravity(17);
        this.emptyLayout.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        if (AndroidUtilities.isTablet()) {
            this.linearLayout2.addView(this.emptyLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.dp(528.0f) - ActionBar.getCurrentActionBarHeight()));
        } else {
            this.linearLayout2.addView(this.emptyLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight()));
        }
        ImageView imageView = new ImageView(context);
        this.emptyImageView = imageView;
        imageView.setImageResource(2131231376);
        this.emptyImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor("sessions_devicesImage"), PorterDuff.Mode.MULTIPLY));
        this.emptyLayout.addView(this.emptyImageView, LayoutHelper.createLinear(-2, -2));
        TextView textView = new TextView(context);
        this.emptyTextView1 = textView;
        textView.setTextColor(Theme.getColor("windowBackgroundWhiteGrayText2"));
        this.emptyTextView1.setGravity(17);
        this.emptyTextView1.setTextSize(1, 15.0f);
        this.emptyTextView1.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.emptyTextView1.setText(LocaleController.getString("PassportNoDocuments", 2131692741));
        this.emptyLayout.addView(this.emptyTextView1, LayoutHelper.createLinear(-2, -2, 17, 0, 16, 0, 0));
        TextView textView2 = new TextView(context);
        this.emptyTextView2 = textView2;
        textView2.setTextColor(Theme.getColor("windowBackgroundWhiteGrayText2"));
        this.emptyTextView2.setGravity(17);
        this.emptyTextView2.setTextSize(1, 14.0f);
        this.emptyTextView2.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
        this.emptyTextView2.setText(LocaleController.getString("PassportNoDocumentsInfo", 2131692743));
        this.emptyLayout.addView(this.emptyTextView2, LayoutHelper.createLinear(-2, -2, 17, 0, 14, 0, 0));
        TextView textView3 = new TextView(context);
        this.emptyTextView3 = textView3;
        textView3.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText4"));
        this.emptyTextView3.setGravity(17);
        this.emptyTextView3.setTextSize(1, 15.0f);
        this.emptyTextView3.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.emptyTextView3.setGravity(17);
        this.emptyTextView3.setText(LocaleController.getString("PassportNoDocumentsAdd", 2131692742).toUpperCase());
        this.emptyLayout.addView(this.emptyTextView3, LayoutHelper.createLinear(-2, 30, 17, 0, 16, 0, 0));
        this.emptyTextView3.setOnClickListener(new -$.Lambda.PassportActivity.Q7O7ojttNmQZfISqLsbmNWcvK7E(this));
        int size = this.currentForm.values.size();
        int a = 0;
        while (a < size) {
            TLRPC.TL_secureValue value = (TLRPC.TL_secureValue) this.currentForm.values.get(a);
            if (!isPersonalDocument(value.type)) {
                if (isAddressDocument(value.type)) {
                    ArrayList<TLRPC.TL_secureRequiredType> documentTypes2 = new ArrayList<>();
                    TLRPC.TL_secureRequiredType requiredType2 = new TLRPC.TL_secureRequiredType();
                    requiredType2.type = value.type;
                    requiredType2.translation_required = true;
                    documentTypes2.add(requiredType2);
                    TLRPC.TL_secureRequiredType requiredType3 = new TLRPC.TL_secureRequiredType();
                    requiredType3.type = new TLRPC.TL_secureValueTypeAddress();
                    documentTypes = documentTypes2;
                    requiredType = requiredType3;
                    documentOnly = true;
                } else {
                    TLRPC.TL_secureRequiredType requiredType4 = new TLRPC.TL_secureRequiredType();
                    requiredType4.type = value.type;
                    documentTypes = null;
                    requiredType = requiredType4;
                    documentOnly = false;
                }
            } else {
                ArrayList<TLRPC.TL_secureRequiredType> documentTypes3 = new ArrayList<>();
                TLRPC.TL_secureRequiredType requiredType5 = new TLRPC.TL_secureRequiredType();
                requiredType5.type = value.type;
                requiredType5.selfie_required = true;
                requiredType5.translation_required = true;
                documentTypes3.add(requiredType5);
                TLRPC.TL_secureRequiredType requiredType6 = new TLRPC.TL_secureRequiredType();
                requiredType6.type = new TLRPC.TL_secureValueTypePersonalDetails();
                documentTypes = documentTypes3;
                requiredType = requiredType6;
                documentOnly = true;
            }
            addField(context, requiredType, documentTypes, documentOnly, a == size + (-1));
            a++;
        }
        updateManageVisibility();
    }

    public void lambda$createManageInterface$17$PassportActivity(View v) {
        openAddDocumentAlert();
    }

    public void lambda$createManageInterface$21$PassportActivity(View v) {
        if ((16 + 24) % 24 <= 0) {
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), new -$.Lambda.PassportActivity.C81Nx5IFZSxlGf23K0P19dSNLrM(this));
        builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
        builder.setTitle(LocaleController.getString("AppName", 2131689827));
        builder.setMessage(LocaleController.getString("AppPassportDeleteAlert", 2131689836));
        showDialog(builder.create());
    }

    public void lambda$null$20$PassportActivity(DialogInterface dialog, int which) {
        if ((21 + 19) % 19 <= 0) {
        }
        TLRPC.TL_account_deleteSecureValue req = new TLRPC.TL_account_deleteSecureValue();
        for (int a = 0; a < this.currentForm.values.size(); a++) {
            req.types.add(((TLRPC.TL_secureValue) this.currentForm.values.get(a)).type);
        }
        needShowProgress();
        ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new -$.Lambda.PassportActivity.41qOJF2zmkPrUUvP_2gA6hd9WO4(this));
    }

    public void lambda$null$19$PassportActivity(TLObject response, TLRPC.TL_error error) {
        AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.zbkbYUdQepN2QHeJ-qaDjwRbhbk(this));
    }

    public void lambda$null$18$PassportActivity() {
        if ((5 + 7) % 7 <= 0) {
        }
        int a = 0;
        while (a < this.linearLayout2.getChildCount()) {
            View child = this.linearLayout2.getChildAt(a);
            if (child instanceof TextDetailSecureCell) {
                this.linearLayout2.removeView(child);
                a--;
            }
            a++;
        }
        needHideProgress();
        this.typesViews.clear();
        this.typesValues.clear();
        this.currentForm.values.clear();
        updateManageVisibility();
    }

    public void lambda$createManageInterface$22$PassportActivity(View v) {
        openAddDocumentAlert();
    }

    private boolean hasNotValueForType(Class<? extends TLRPC.SecureValueType> type) {
        if ((24 + 19) % 19 <= 0) {
        }
        int count = this.currentForm.values.size();
        for (int a = 0; a < count; a++) {
            if (((TLRPC.TL_secureValue) this.currentForm.values.get(a)).type.getClass() == type) {
                return false;
            }
        }
        return true;
    }

    private boolean hasUnfilledValues() {
        return hasNotValueForType(TLRPC.TL_secureValueTypePhone.class) || hasNotValueForType(TLRPC.TL_secureValueTypeEmail.class) || hasNotValueForType(TLRPC.TL_secureValueTypePersonalDetails.class) || hasNotValueForType(TLRPC.TL_secureValueTypePassport.class) || hasNotValueForType(TLRPC.TL_secureValueTypeInternalPassport.class) || hasNotValueForType(TLRPC.TL_secureValueTypeIdentityCard.class) || hasNotValueForType(TLRPC.TL_secureValueTypeDriverLicense.class) || hasNotValueForType(TLRPC.TL_secureValueTypeAddress.class) || hasNotValueForType(TLRPC.TL_secureValueTypeUtilityBill.class) || hasNotValueForType(TLRPC.TL_secureValueTypePassportRegistration.class) || hasNotValueForType(TLRPC.TL_secureValueTypeTemporaryRegistration.class) || hasNotValueForType(TLRPC.TL_secureValueTypeBankStatement.class) || hasNotValueForType(TLRPC.TL_secureValueTypeRentalAgreement.class);
    }

    private void openAddDocumentAlert() {
        if ((FIELD_IDENTITY_COUNT + 11) % 11 <= 0) {
        }
        ArrayList<CharSequence> values = new ArrayList<>();
        ArrayList<Class<? extends TLRPC.SecureValueType>> types = new ArrayList<>();
        if (hasNotValueForType(TLRPC.TL_secureValueTypePhone.class)) {
            values.add(LocaleController.getString("ActionBotDocumentPhone", 2131689602));
            types.add(TLRPC.TL_secureValueTypePhone.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeEmail.class)) {
            values.add(LocaleController.getString("ActionBotDocumentEmail", 2131689596));
            types.add(TLRPC.TL_secureValueTypeEmail.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePersonalDetails.class)) {
            values.add(LocaleController.getString("ActionBotDocumentIdentity", 2131689597));
            types.add(TLRPC.TL_secureValueTypePersonalDetails.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePassport.class)) {
            values.add(LocaleController.getString("ActionBotDocumentPassport", 2131689600));
            types.add(TLRPC.TL_secureValueTypePassport.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeInternalPassport.class)) {
            values.add(LocaleController.getString("ActionBotDocumentInternalPassport", 2131689599));
            types.add(TLRPC.TL_secureValueTypeInternalPassport.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePassportRegistration.class)) {
            values.add(LocaleController.getString("ActionBotDocumentPassportRegistration", 2131689601));
            types.add(TLRPC.TL_secureValueTypePassportRegistration.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeTemporaryRegistration.class)) {
            values.add(LocaleController.getString("ActionBotDocumentTemporaryRegistration", 2131689605));
            types.add(TLRPC.TL_secureValueTypeTemporaryRegistration.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeIdentityCard.class)) {
            values.add(LocaleController.getString("ActionBotDocumentIdentityCard", 2131689598));
            types.add(TLRPC.TL_secureValueTypeIdentityCard.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeDriverLicense.class)) {
            values.add(LocaleController.getString("ActionBotDocumentDriverLicence", 2131689595));
            types.add(TLRPC.TL_secureValueTypeDriverLicense.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeAddress.class)) {
            values.add(LocaleController.getString("ActionBotDocumentAddress", 2131689593));
            types.add(TLRPC.TL_secureValueTypeAddress.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeUtilityBill.class)) {
            values.add(LocaleController.getString("ActionBotDocumentUtilityBill", 2131689606));
            types.add(TLRPC.TL_secureValueTypeUtilityBill.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeBankStatement.class)) {
            values.add(LocaleController.getString("ActionBotDocumentBankStatement", 2131689594));
            types.add(TLRPC.TL_secureValueTypeBankStatement.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeRentalAgreement.class)) {
            values.add(LocaleController.getString("ActionBotDocumentRentalAgreement", 2131689604));
            types.add(TLRPC.TL_secureValueTypeRentalAgreement.class);
        }
        if (getParentActivity() == null || values.isEmpty()) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("PassportNoDocumentsAdd", 2131692742));
        builder.setItems((CharSequence[]) values.toArray(new CharSequence[0]), new -$.Lambda.PassportActivity.RQcZG78ECSwnabEVYZ6AMAstBac(this, types));
        showDialog(builder.create());
    }

    public void lambda$openAddDocumentAlert$23$PassportActivity(ArrayList types, DialogInterface dialog, int which) {
        if ((22 + 2) % 2 <= 0) {
        }
        TLRPC.TL_secureRequiredType requiredType = null;
        TLRPC.TL_secureRequiredType documentRequiredType = null;
        try {
            requiredType = new TLRPC.TL_secureRequiredType();
            requiredType.type = (TLRPC.SecureValueType) ((Class) types.get(which)).newInstance();
        } catch (Exception e) {
        }
        if (isPersonalDocument(requiredType.type)) {
            documentRequiredType = requiredType;
            documentRequiredType.selfie_required = true;
            documentRequiredType.translation_required = true;
            requiredType = new TLRPC.TL_secureRequiredType();
            requiredType.type = new TLRPC.TL_secureValueTypePersonalDetails();
        } else if (isAddressDocument(requiredType.type)) {
            documentRequiredType = requiredType;
            requiredType = new TLRPC.TL_secureRequiredType();
            requiredType.type = new TLRPC.TL_secureValueTypeAddress();
        }
        openTypeActivity(requiredType, documentRequiredType, new ArrayList<>(), documentRequiredType != null);
    }

    private void updateManageVisibility() {
        if ((3 + 14) % 14 <= 0) {
        }
        if (this.currentForm.values.isEmpty()) {
            this.emptyLayout.setVisibility(0);
            this.sectionCell.setVisibility(8);
            this.headerCell.setVisibility(8);
            this.addDocumentCell.setVisibility(8);
            this.deletePassportCell.setVisibility(8);
            this.addDocumentSectionCell.setVisibility(8);
            return;
        }
        this.emptyLayout.setVisibility(8);
        this.sectionCell.setVisibility(0);
        this.headerCell.setVisibility(0);
        this.deletePassportCell.setVisibility(0);
        this.addDocumentSectionCell.setVisibility(0);
        if (hasUnfilledValues()) {
            this.addDocumentCell.setVisibility(0);
        } else {
            this.addDocumentCell.setVisibility(8);
        }
    }

    public void callCallback(boolean success) {
        int i;
        int i2;
        if ((31 + 14) % 14 <= 0) {
        }
        if (!this.callbackCalled) {
            if (!TextUtils.isEmpty(this.currentCallbackUrl)) {
                if (success) {
                    Browser.openUrl(getParentActivity(), Uri.parse(this.currentCallbackUrl + "&tg_passport=success"));
                } else if (!this.ignoreOnFailure && ((i2 = this.currentActivityType) == 5 || i2 == 0)) {
                    Browser.openUrl(getParentActivity(), Uri.parse(this.currentCallbackUrl + "&tg_passport=cancel"));
                }
                this.callbackCalled = true;
                return;
            }
            if (this.needActivityResult) {
                if (success || (!this.ignoreOnFailure && ((i = this.currentActivityType) == 5 || i == 0))) {
                    getParentActivity().setResult(success ? -1 : 0);
                }
                this.callbackCalled = true;
            }
        }
    }

    private void createEmailInterface(Context context) {
        if ((31 + 17) % 17 <= 0) {
        }
        this.actionBar.setTitle(LocaleController.getString("PassportEmail", 2131692661));
        if (!TextUtils.isEmpty(this.currentEmail)) {
            View textSettingsCell = new TextSettingsCell(context);
            textSettingsCell.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText4"));
            textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            textSettingsCell.setText(LocaleController.formatString("PassportPhoneUseSame", 2131692754, new Object[]{this.currentEmail}), false);
            this.linearLayout2.addView(textSettingsCell, LayoutHelper.createLinear(-1, -2));
            textSettingsCell.setOnClickListener(new -$.Lambda.PassportActivity.Rtq2VSQA0rGzQ3LrX7aiAKoeCec(this));
            TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell;
            textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
            this.bottomCell.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", 2131692755));
            this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        }
        this.inputFields = new EditTextBoldCursor[1];
        for (int a = 0; a < 1; a++) {
            ViewGroup container = new FrameLayout(context);
            this.linearLayout2.addView(container, LayoutHelper.createLinear(-1, 50));
            container.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            this.inputFields[a] = new EditTextBoldCursor(context);
            this.inputFields[a].setTag(Integer.valueOf(a));
            this.inputFields[a].setTextSize(1, 16.0f);
            this.inputFields[a].setHintTextColor(Theme.getColor("windowBackgroundWhiteHintText"));
            this.inputFields[a].setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setBackgroundDrawable((Drawable) null);
            this.inputFields[a].setCursorColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[a].setCursorWidth(1.5f);
            this.inputFields[a].setInputType(33);
            this.inputFields[a].setImeOptions(268435462);
            this.inputFields[a].setHint(LocaleController.getString("PaymentShippingEmailPlaceholder", 2131692970));
            TLRPC.TL_secureValue tL_secureValue = this.currentTypeValue;
            if (tL_secureValue != null && (tL_secureValue.plain_data instanceof TLRPC.TL_securePlainEmail)) {
                TLRPC.TL_securePlainEmail securePlainEmail = this.currentTypeValue.plain_data;
                if (!TextUtils.isEmpty(securePlainEmail.email)) {
                    this.inputFields[a].setText(securePlainEmail.email);
                }
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[a].setSelection(editTextBoldCursorArr[a].length());
            this.inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            this.inputFields[a].setGravity(LocaleController.isRTL ? 5 : 3);
            container.addView(this.inputFields[a], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[a].setOnEditorActionListener(new -$.Lambda.PassportActivity.OI54puM5fXEvgSD_dDcPzWXiXHU(this));
        }
        TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell2;
        textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.bottomCell.setText(LocaleController.getString("PassportEmailUploadInfo", 2131692664));
        this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
    }

    public void lambda$createEmailInterface$24$PassportActivity(View v) {
        this.useCurrentValue = true;
        this.doneItem.callOnClick();
        this.useCurrentValue = false;
    }

    public boolean lambda$createEmailInterface$25$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i == 6 || i == 5) {
            this.doneItem.callOnClick();
            return true;
        }
        return false;
    }

    private void createPhoneInterface(Context context) {
        String countryName;
        ViewGroup container;
        if ((25 + 24) % 24 <= 0) {
        }
        this.actionBar.setTitle(LocaleController.getString("PassportPhone", 2131692750));
        this.languageMap = new HashMap<>();
        int i = 3;
        int i2 = 1;
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
            while (true) {
                String line = reader.readLine();
                if (line == null) {
                    break;
                }
                String[] args = line.split(";");
                this.countriesArray.add(0, args[2]);
                this.countriesMap.put(args[2], args[0]);
                this.codesMap.put(args[0], args[2]);
                if (args.length > 3) {
                    this.phoneFormatMap.put(args[0], args[3]);
                }
                this.languageMap.put(args[1], args[2]);
            }
            reader.close();
        } catch (Exception e) {
            FileLog.e(e);
        }
        Collections.sort(this.countriesArray, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE);
        String currentPhone = UserConfig.getInstance(this.currentAccount).getCurrentUser().phone;
        View textSettingsCell = new TextSettingsCell(context);
        textSettingsCell.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText4"));
        textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        textSettingsCell.setText(LocaleController.formatString("PassportPhoneUseSame", 2131692754, new Object[]{PhoneFormat.getInstance().format("+" + currentPhone)}), false);
        int i3 = -1;
        this.linearLayout2.addView(textSettingsCell, LayoutHelper.createLinear(-1, -2));
        textSettingsCell.setOnClickListener(new -$.Lambda.PassportActivity.MycyDF9tb4BwBVRwARw28Riy2yI(this));
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.bottomCell.setText(LocaleController.getString("PassportPhoneUseSameInfo", 2131692756));
        this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        HeaderCell headerCell = new HeaderCell(context);
        this.headerCell = headerCell;
        headerCell.setText(LocaleController.getString("PassportPhoneUseOther", 2131692753));
        this.headerCell.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
        this.linearLayout2.addView((View) this.headerCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        this.inputFields = new EditTextBoldCursor[3];
        int a = 0;
        while (a < i) {
            if (a == 2) {
                this.inputFields[a] = new HintEditText(context);
            } else {
                this.inputFields[a] = new EditTextBoldCursor(context);
            }
            if (a == i2) {
                container = new LinearLayout(context);
                ((LinearLayout) container).setOrientation(0);
                this.linearLayout2.addView(container, LayoutHelper.createLinear(i3, 50));
                container.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            } else if (a == 2) {
                container = (ViewGroup) this.inputFields[i2].getParent();
            } else {
                container = new FrameLayout(context);
                this.linearLayout2.addView(container, LayoutHelper.createLinear(i3, 50));
                container.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            }
            this.inputFields[a].setTag(Integer.valueOf(a));
            this.inputFields[a].setTextSize(i2, 16.0f);
            this.inputFields[a].setHintTextColor(Theme.getColor("windowBackgroundWhiteHintText"));
            this.inputFields[a].setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setBackgroundDrawable((Drawable) null);
            this.inputFields[a].setCursorColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[a].setCursorWidth(1.5f);
            if (a == 0) {
                this.inputFields[a].setOnTouchListener(new -$.Lambda.PassportActivity.A2YqnvRFYwHxfJKoNvw1WBil4d8(this));
                this.inputFields[a].setText(LocaleController.getString("ChooseCountry", 2131690593));
                this.inputFields[a].setInputType(0);
                this.inputFields[a].setFocusable(false);
            } else {
                this.inputFields[a].setInputType(i);
                if (a == 2) {
                    this.inputFields[a].setImeOptions(268435462);
                } else {
                    this.inputFields[a].setImeOptions(268435461);
                }
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[a].setSelection(editTextBoldCursorArr[a].length());
            if (a == 1) {
                TextView textView = new TextView(context);
                this.plusTextView = textView;
                textView.setText("+");
                this.plusTextView.setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
                this.plusTextView.setTextSize(1, 16.0f);
                container.addView(this.plusTextView, LayoutHelper.createLinear(-2, -2, 21.0f, 12.0f, MryDisplayHelper.DENSITY, 6.0f));
                this.inputFields[a].setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
                InputFilter[] inputFilters = {new InputFilter.LengthFilter(5)};
                this.inputFields[a].setFilters(inputFilters);
                this.inputFields[a].setGravity(19);
                container.addView(this.inputFields[a], LayoutHelper.createLinear(55, -2, MryDisplayHelper.DENSITY, 12.0f, 16.0f, 6.0f));
                this.inputFields[a].addTextChangedListener(new 9(this));
            } else if (a == 2) {
                this.inputFields[a].setPadding(0, 0, 0, 0);
                this.inputFields[a].setGravity(19);
                this.inputFields[a].setHintText((CharSequence) null);
                this.inputFields[a].setHint(LocaleController.getString("PaymentShippingPhoneNumber", 2131692974));
                container.addView(this.inputFields[a], LayoutHelper.createLinear(-1, -2, MryDisplayHelper.DENSITY, 12.0f, 21.0f, 6.0f));
                this.inputFields[a].addTextChangedListener(new 10(this));
            } else {
                this.inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
                this.inputFields[a].setGravity(LocaleController.isRTL ? 5 : 3);
                container.addView(this.inputFields[a], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            }
            this.inputFields[a].setOnEditorActionListener(new -$.Lambda.PassportActivity.OsGU6OgRxuXl1o_WjlYq-C_7jFw(this));
            if (a == 2) {
                this.inputFields[a].setOnKeyListener(new -$.Lambda.PassportActivity.iSdVl8E7If8mIW30kJAEzMXPah8(this));
            }
            if (a == 0) {
                View divider = new View(context);
                this.dividers.add(divider);
                divider.setBackgroundColor(Theme.getColor("divider"));
                container.addView(divider, new FrameLayout.LayoutParams(-1, 1, 83));
            }
            a++;
            i = 3;
            i2 = 1;
            i3 = -1;
        }
        String country = null;
        try {
            TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
            if (telephonyManager != null) {
                country = telephonyManager.getSimCountryIso().toUpperCase();
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        if (country != null && (countryName = this.languageMap.get(country)) != null) {
            int index = this.countriesArray.indexOf(countryName);
            if (index != -1) {
                this.inputFields[1].setText(this.countriesMap.get(countryName));
            }
        }
        TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell2;
        textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
        this.bottomCell.setText(LocaleController.getString("PassportPhoneUploadInfo", 2131692752));
        this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
    }

    public void lambda$createPhoneInterface$26$PassportActivity(View v) {
        this.useCurrentValue = true;
        this.doneItem.callOnClick();
        this.useCurrentValue = false;
    }

    public boolean lambda$createPhoneInterface$29$PassportActivity(View v, MotionEvent event) {
        if ((13 + 28) % 28 <= 0) {
        }
        if (getParentActivity() == null) {
            return false;
        }
        if (event.getAction() == 1) {
            CountrySelectActivity fragment = new CountrySelectActivity(false);
            fragment.setCountrySelectActivityDelegate(new -$.Lambda.PassportActivity.SfZA9ysKLNqXHGsELwVv35MOqFU(this));
            presentFragment(fragment);
        }
        return true;
    }

    public void lambda$null$28$PassportActivity(CountrySelectActivity.Country country) {
        if ((5 + 29) % 29 <= 0) {
        }
        if (country != null) {
            this.inputFields[0].setText(country.name);
            int index = this.countriesArray.indexOf(country.name);
            if (index != -1) {
                this.ignoreOnTextChange = true;
                String code = this.countriesMap.get(country.name);
                this.inputFields[1].setText(code);
                String hint = this.phoneFormatMap.get(code);
                this.inputFields[2].setHintText(hint != null ? hint.replace('X', (char) 8211) : null);
                this.ignoreOnTextChange = false;
            }
            AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.jVF9_G4ChzngHHLfJXyF3A0QNxA(this), 300L);
            this.inputFields[2].requestFocus();
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[2].setSelection(editTextBoldCursorArr[2].length());
        }
    }

    public void lambda$null$27$PassportActivity() {
        if ((15 + 30) % 30 <= 0) {
        }
        AndroidUtilities.showKeyboard(this.inputFields[2]);
    }

    public boolean lambda$createPhoneInterface$30$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if ((21 + 20) % 20 <= 0) {
        }
        if (i == 5) {
            this.inputFields[2].requestFocus();
            return true;
        }
        if (i == 6) {
            this.doneItem.callOnClick();
            return true;
        }
        return false;
    }

    public boolean lambda$createPhoneInterface$31$PassportActivity(View v, int keyCode, KeyEvent event) {
        if ((2 + 30) % 30 <= 0) {
        }
        if (keyCode == 67 && this.inputFields[2].length() == 0) {
            this.inputFields[1].requestFocus();
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[1].setSelection(editTextBoldCursorArr[1].length());
            this.inputFields[1].dispatchKeyEvent(event);
            return true;
        }
        return false;
    }

    private void createAddressInterface(Context context) {
        String key;
        String errorText;
        String errorText2;
        if ((3 + FIELD_IDENTITY_COUNT) % FIELD_IDENTITY_COUNT <= 0) {
        }
        this.languageMap = new HashMap<>();
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
            while (true) {
                String line = reader.readLine();
                if (line == null) {
                    break;
                }
                String[] args = line.split(";");
                this.languageMap.put(args[1], args[2]);
            }
            reader.close();
        } catch (Exception e) {
            FileLog.e(e);
        }
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.topErrorCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231058, "windowBackgroundGrayShadow"));
        this.topErrorCell.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
        this.linearLayout2.addView((View) this.topErrorCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        checkTopErrorCell(true);
        TLRPC.TL_secureRequiredType tL_secureRequiredType = this.currentDocumentsType;
        if (tL_secureRequiredType != null) {
            if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentRentalAgreement", 2131689604));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentBankStatement", 2131689594));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentUtilityBill", 2131689606));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentPassportRegistration", 2131689601));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentTemporaryRegistration", 2131689605));
            }
            HeaderCell headerCell = new HeaderCell(context);
            this.headerCell = headerCell;
            headerCell.setText(LocaleController.getString("PassportDocuments", 2131692660));
            this.headerCell.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            this.linearLayout2.addView((View) this.headerCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
            LinearLayout linearLayout = new LinearLayout(context);
            this.documentsLayout = linearLayout;
            linearLayout.setOrientation(1);
            this.linearLayout2.addView(this.documentsLayout, LayoutHelper.createLinear(-1, -2));
            TextSettingsCell textSettingsCell = new TextSettingsCell(context);
            this.uploadDocumentCell = textSettingsCell;
            textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            this.linearLayout2.addView((View) this.uploadDocumentCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
            this.uploadDocumentCell.setOnClickListener(new -$.Lambda.PassportActivity.6k_NqtQ9-pglghNpmeafsPT_HyY(this));
            TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell2;
            textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231056, "windowBackgroundGrayShadow"));
            if (this.currentBotId != 0) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAddressUploadInfo", 2131692605);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAgreementInfo", 2131692609);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddBillInfo", 2131692613);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddPassportRegistrationInfo", 2131692623);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddTemporaryRegistrationInfo", 2131692625);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddBankInfo", 2131692611);
            } else {
                this.noAllDocumentsErrorText = "";
            }
            CharSequence text = this.noAllDocumentsErrorText;
            HashMap<String, String> hashMap = this.documentsErrors;
            if (hashMap != null && (errorText2 = hashMap.get("files_all")) != null) {
                SpannableStringBuilder stringBuilder = new SpannableStringBuilder(errorText2);
                stringBuilder.append((CharSequence) "\n\n");
                stringBuilder.append(this.noAllDocumentsErrorText);
                text = stringBuilder;
                stringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor("windowBackgroundWhiteRedText3")), 0, errorText2.length(), 33);
                this.errorsValues.put("files_all", "");
            }
            this.bottomCell.setText(text);
            this.linearLayout2.addView((View) this.bottomCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
            if (this.currentDocumentsType.translation_required) {
                HeaderCell headerCell2 = new HeaderCell(context);
                this.headerCell = headerCell2;
                headerCell2.setText(LocaleController.getString("PassportTranslation", 2131692786));
                this.headerCell.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
                this.linearLayout2.addView((View) this.headerCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
                LinearLayout linearLayout2 = new LinearLayout(context);
                this.translationLayout = linearLayout2;
                linearLayout2.setOrientation(1);
                this.linearLayout2.addView(this.translationLayout, LayoutHelper.createLinear(-1, -2));
                TextSettingsCell textSettingsCell2 = new TextSettingsCell(context);
                this.uploadTranslationCell = textSettingsCell2;
                textSettingsCell2.setBackgroundDrawable(Theme.getSelectorDrawable(true));
                this.linearLayout2.addView((View) this.uploadTranslationCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
                this.uploadTranslationCell.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        PassportActivity.this.lambda$createAddressInterface$33$PassportActivity(view);
                    }
                });
                TextInfoPrivacyCell textInfoPrivacyCell3 = new TextInfoPrivacyCell(context);
                this.bottomCellTranslation = textInfoPrivacyCell3;
                textInfoPrivacyCell3.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231056, "windowBackgroundGrayShadow"));
                if (this.currentBotId != 0) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", 2131692632);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationAgreementInfo", 2131692627);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBillInfo", 2131692629);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationPassportRegistrationInfo", 2131692630);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationTemporaryRegistrationInfo", 2131692631);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBankInfo", 2131692628);
                } else {
                    this.noAllTranslationErrorText = "";
                }
                CharSequence text2 = this.noAllTranslationErrorText;
                HashMap<String, String> hashMap2 = this.documentsErrors;
                if (hashMap2 != null && (errorText = hashMap2.get("translation_all")) != null) {
                    SpannableStringBuilder stringBuilder2 = new SpannableStringBuilder(errorText);
                    stringBuilder2.append((CharSequence) "\n\n");
                    stringBuilder2.append(this.noAllTranslationErrorText);
                    text2 = stringBuilder2;
                    stringBuilder2.setSpan(new ForegroundColorSpan(Theme.getColor("windowBackgroundWhiteRedText3")), 0, errorText.length(), 33);
                    this.errorsValues.put("translation_all", "");
                }
                this.bottomCellTranslation.setText(text2);
                this.linearLayout2.addView((View) this.bottomCellTranslation, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
            }
        } else {
            this.actionBar.setTitle(LocaleController.getString("PassportAddress", 2131692633));
        }
        HeaderCell headerCell3 = new HeaderCell(context);
        this.headerCell = headerCell3;
        headerCell3.setText(LocaleController.getString("PassportAddressHeader", 2131692634));
        this.headerCell.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
        this.linearLayout2.addView((View) this.headerCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        this.inputFields = new EditTextBoldCursor[6];
        int a = 0;
        for (int i = 6; a < i; i = 6) {
            EditTextBoldCursor field = new EditTextBoldCursor(context);
            this.inputFields[a] = field;
            11 r12 = new 11(this, context, field);
            r12.setWillNotDraw(false);
            this.linearLayout2.addView((View) r12, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
            r12.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
            if (a == 5) {
                View view = new View(context);
                this.extraBackgroundView = view;
                view.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
                this.linearLayout2.addView(this.extraBackgroundView, LayoutHelper.createLinear(-1, i));
            }
            if (this.documentOnly && this.currentDocumentsType != null) {
                r12.setVisibility(8);
                View view2 = this.extraBackgroundView;
                if (view2 != null) {
                    view2.setVisibility(8);
                }
            }
            this.inputFields[a].setTag(Integer.valueOf(a));
            this.inputFields[a].setSupportRtlHint(true);
            this.inputFields[a].setTextSize(1, 16.0f);
            this.inputFields[a].setHintColor(Theme.getColor("windowBackgroundWhiteHintText"));
            this.inputFields[a].setHeaderHintColor(Theme.getColor("windowBackgroundWhiteBlueHeader"));
            this.inputFields[a].setTransformHintToHeader(true);
            this.inputFields[a].setTextColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setBackgroundDrawable((Drawable) null);
            this.inputFields[a].setCursorColor(Theme.getColor("windowBackgroundWhiteBlackText"));
            this.inputFields[a].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[a].setCursorWidth(1.5f);
            this.inputFields[a].setLineColors(Theme.getColor("windowBackgroundWhiteInputField"), Theme.getColor("windowBackgroundWhiteInputFieldActivated"), Theme.getColor("windowBackgroundWhiteRedText3"));
            if (a == 5) {
                this.inputFields[a].setOnTouchListener(new -$.Lambda.PassportActivity.db74W6UqGi1YLxpPqUxyRCF78vk(this));
                this.inputFields[a].setInputType(0);
                this.inputFields[a].setFocusable(false);
            } else {
                this.inputFields[a].setInputType(16385);
                this.inputFields[a].setImeOptions(268435461);
            }
            if (a == 0) {
                this.inputFields[a].setHintText(LocaleController.getString("PassportStreet1", 2131692781));
                key = "street_line1";
            } else if (a == 1) {
                this.inputFields[a].setHintText(LocaleController.getString("PassportStreet2", 2131692782));
                key = "street_line2";
            } else if (a != 2) {
                if (a == 3) {
                    this.inputFields[a].setHintText(LocaleController.getString("PassportCity", 2131692640));
                    key = "city";
                } else if (a != 4) {
                    if (a != 5) {
                        a++;
                    } else {
                        this.inputFields[a].setHintText(LocaleController.getString("PassportCountry", 2131692642));
                        key = "country_code";
                    }
                } else {
                    this.inputFields[a].setHintText(LocaleController.getString("PassportState", 2131692780));
                    key = "state";
                }
            } else {
                this.inputFields[a].setHintText(LocaleController.getString("PassportPostcode", 2131692758));
                key = "post_code";
            }
            setFieldValues(this.currentValues, this.inputFields[a], key);
            if (a == 2) {
                this.inputFields[a].addTextChangedListener(new 12(this, field, key));
                InputFilter[] inputFilters = {new InputFilter.LengthFilter(10)};
                this.inputFields[a].setFilters(inputFilters);
            } else {
                this.inputFields[a].addTextChangedListener(new 13(this, field, key));
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[a].setSelection(editTextBoldCursorArr[a].length());
            this.inputFields[a].setPadding(0, 0, 0, 0);
            this.inputFields[a].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
            r12.addView(this.inputFields[a], LayoutHelper.createFrame(-1.0f, 64.0f, 51, 21.0f, MryDisplayHelper.DENSITY, 21.0f, MryDisplayHelper.DENSITY));
            this.inputFields[a].setOnEditorActionListener(new -$.Lambda.PassportActivity.P8LMXhRcJ7g6XP0JmRl8EjLnzFY(this));
            a++;
        }
        View shadowSectionCell = new ShadowSectionCell(context);
        this.sectionCell = shadowSectionCell;
        this.linearLayout2.addView(shadowSectionCell, LayoutHelper.createLinear(-1, -2));
        if (this.documentOnly && this.currentDocumentsType != null) {
            this.headerCell.setVisibility(8);
            this.sectionCell.setVisibility(8);
        }
        if (((this.currentBotId != 0 || this.currentDocumentsType == null) && this.currentTypeValue != null && !this.documentOnly) || this.currentDocumentsTypeValue != null) {
            TLRPC.TL_secureValue tL_secureValue = this.currentDocumentsTypeValue;
            if (tL_secureValue != null) {
                addDocumentViews(tL_secureValue.files);
                addTranslationDocumentViews(this.currentDocumentsTypeValue.translation);
            }
            this.sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231056, "windowBackgroundGrayShadow"));
            View textSettingsCell3 = new TextSettingsCell(context);
            textSettingsCell3.setTextColor(Theme.getColor("windowBackgroundWhiteRedText3"));
            textSettingsCell3.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            if (this.currentDocumentsType == null) {
                textSettingsCell3.setText(LocaleController.getString("PassportDeleteInfo", 2131692649), false);
            } else {
                textSettingsCell3.setText(LocaleController.getString("PassportDeleteDocument", 2131692644), false);
            }
            this.linearLayout2.addView(textSettingsCell3, LayoutHelper.createLinear(-1, -2));
            textSettingsCell3.setOnClickListener(new -$.Lambda.PassportActivity.PVsi4mddF6xKfA4-ZuYfMJxkQig(this));
            ShadowSectionCell shadowSectionCell2 = new ShadowSectionCell(context);
            this.sectionCell = shadowSectionCell2;
            shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
            this.linearLayout2.addView((View) this.sectionCell, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        } else {
            this.sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
            if (this.documentOnly && this.currentDocumentsType != null) {
                this.bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, 2131231057, "windowBackgroundGrayShadow"));
            }
        }
        updateUploadText(0);
        updateUploadText(4);
    }

    public void lambda$createAddressInterface$32$PassportActivity(View v) {
        this.uploadingFileType = 0;
        openAttachMenu();
    }

    public void lambda$createAddressInterface$33$PassportActivity(View v) {
        this.uploadingFileType = 4;
        openAttachMenu();
    }

    public boolean lambda$createAddressInterface$35$PassportActivity(View v, MotionEvent event) {
        if ((15 + 31) % 31 <= 0) {
        }
        if (getParentActivity() == null) {
            return false;
        }
        if (event.getAction() == 1) {
            CountrySelectActivity fragment = new CountrySelectActivity(false);
            fragment.setCountrySelectActivityDelegate(new -$.Lambda.PassportActivity.lZZGiBqbpAMoyZ5SFU3o9scYlZA(this));
            presentFragment(fragment);
        }
        return true;
    }

    public void lambda$null$34$PassportActivity(CountrySelectActivity.Country country) {
        if ((26 + FIELD_IDENTITY_COUNT) % FIELD_IDENTITY_COUNT <= 0) {
        }
        if (country != null) {
            this.inputFields[5].setText(country.name);
            this.currentCitizeship = country.shortname;
        }
    }

    public boolean lambda$createAddressInterface$36$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if ((31 + 30) % 30 <= 0) {
        }
        if (i == 5) {
            int num = ((Integer) textView.getTag()).intValue() + 1;
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            if (num < editTextBoldCursorArr.length) {
                if (editTextBoldCursorArr[num].isFocusable()) {
                    this.inputFields[num].requestFocus();
                } else {
                    this.inputFields[num].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, 0));
                    textView.clearFocus();
                    AndroidUtilities.hideKeyboard(textView);
                }
            }
            return true;
        }
        return false;
    }

    public void lambda$createAddressInterface$37$PassportActivity(View v) {
        createDocumentDeleteAlert();
    }

    private void createDocumentDeleteAlert() {
        if ((15 + 21) % 21 <= 0) {
        }
        boolean[] checks = {true};
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), new -$.Lambda.PassportActivity.brSKpe8FRhTCPSOxpduynBNG0x0(this, checks));
        builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
        builder.setTitle(LocaleController.getString("AppName", 2131689827));
        if (this.documentOnly && this.currentDocumentsType == null && (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
            builder.setMessage(LocaleController.getString("PassportDeleteAddressAlert", 2131692643));
        } else if (this.documentOnly && this.currentDocumentsType == null && (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
            builder.setMessage(LocaleController.getString("PassportDeletePersonalAlert", 2131692650));
        } else {
            builder.setMessage(LocaleController.getString("PassportDeleteDocumentAlert", 2131692646));
        }
        if (!this.documentOnly && this.currentDocumentsType != null) {
            FrameLayout frameLayout = new FrameLayout(getParentActivity());
            CheckBoxCell cell = new CheckBoxCell(getParentActivity(), 1);
            cell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
            if (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                cell.setText(LocaleController.getString("PassportDeleteDocumentAddress", 2131692645), "", true, false);
            } else if (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                cell.setText(LocaleController.getString("PassportDeleteDocumentPersonal", 2131692647), "", true, false);
            }
            cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0);
            frameLayout.addView((View) cell, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, 48, 51));
            cell.setOnClickListener(new -$.Lambda.PassportActivity.NgmejddC6-AVStrMeNSWVonTasY(checks));
            builder.setView(frameLayout);
        }
        showDialog(builder.create());
    }

    public void lambda$createDocumentDeleteAlert$38$PassportActivity(boolean[] checks, DialogInterface dialog, int which) {
        if ((19 + 12) % 12 <= 0) {
        }
        if (!this.documentOnly) {
            this.currentValues.clear();
        }
        this.currentDocumentValues.clear();
        this.delegate.deleteValue(this.currentType, this.currentDocumentsType, this.availableDocumentTypes, checks[0], null, null);
        finishFragment();
    }

    static void lambda$createDocumentDeleteAlert$39(boolean[] checks, View v) {
        if ((23 + 11) % 11 <= 0) {
        }
        if (!v.isEnabled()) {
            return;
        }
        CheckBoxCell cell1 = (CheckBoxCell) v;
        checks[0] = !checks[0];
        cell1.setChecked(checks[0], true);
    }

    public void onFieldError(View field) {
        if ((17 + 21) % 21 <= 0) {
        }
        if (field == null) {
            return;
        }
        Vibrator v = (Vibrator) getParentActivity().getSystemService("vibrator");
        if (v != null) {
            v.vibrate(200L);
        }
        AndroidUtilities.shakeView(field, 2.0f, 0);
        scrollToField(field);
    }

    private void scrollToField(View field) {
        if ((12 + 26) % 26 <= 0) {
        }
        while (field != null && this.linearLayout2.indexOfChild(field) < 0) {
            field = (View) field.getParent();
        }
        if (field != null) {
            this.scrollView.smoothScrollTo(0, field.getTop() - ((this.scrollView.getMeasuredHeight() - field.getMeasuredHeight()) / 2));
        }
    }

    public String getDocumentHash(SecureDocument document) {
        if ((30 + 29) % 29 <= 0) {
        }
        if (document != null) {
            if (document.secureFile != null && document.secureFile.file_hash != null) {
                return Base64.encodeToString(document.secureFile.file_hash, 2);
            }
            if (document.fileHash != null) {
                return Base64.encodeToString(document.fileHash, 2);
            }
            return "";
        }
        return "";
    }

    public void checkFieldForError(EditTextBoldCursor field, String key, Editable s, boolean document) {
        String value;
        String value2;
        String value3;
        if ((27 + 13) % 13 <= 0) {
        }
        HashMap<String, String> hashMap = this.errorsValues;
        if (hashMap != null && (value = hashMap.get(key)) != null) {
            if (TextUtils.equals(value, s)) {
                HashMap<String, String> hashMap2 = this.fieldsErrors;
                if (hashMap2 != null && (value3 = hashMap2.get(key)) != null) {
                    field.setErrorText(value3);
                } else {
                    HashMap<String, String> hashMap3 = this.documentsErrors;
                    if (hashMap3 != null && (value2 = hashMap3.get(key)) != null) {
                        field.setErrorText(value2);
                    }
                }
            } else {
                field.setErrorText((CharSequence) null);
            }
        } else {
            field.setErrorText((CharSequence) null);
        }
        String errorKey = document ? "error_document_all" : "error_all";
        HashMap<String, String> hashMap4 = this.errorsValues;
        if (hashMap4 != null && hashMap4.containsKey(errorKey)) {
            this.errorsValues.remove(errorKey);
            checkTopErrorCell(false);
        }
    }

    public boolean checkFieldsForError() {
        EditTextBoldCursor[] fields;
        String key;
        TextDetailSettingsCell textDetailSettingsCell;
        if ((31 + 16) % 16 <= 0) {
        }
        if (this.currentDocumentsType != null) {
            if (this.errorsValues.containsKey("error_all") || this.errorsValues.containsKey("error_document_all")) {
                onFieldError(this.topErrorCell);
                return true;
            }
            if (this.uploadDocumentCell != null) {
                if (this.documents.isEmpty()) {
                    onFieldError(this.uploadDocumentCell);
                    return true;
                }
                int size = this.documents.size();
                for (int a = 0; a < size; a++) {
                    SecureDocument document = this.documents.get(a);
                    String key2 = "files" + getDocumentHash(document);
                    if (key2 != null && this.errorsValues.containsKey(key2)) {
                        onFieldError(this.documentsCells.get(document));
                        return true;
                    }
                }
            }
            if (this.errorsValues.containsKey("files_all") || this.errorsValues.containsKey("translation_all")) {
                onFieldError(this.bottomCell);
                return true;
            }
            TextDetailSettingsCell textDetailSettingsCell2 = this.uploadFrontCell;
            if (textDetailSettingsCell2 != null) {
                if (this.frontDocument == null) {
                    onFieldError(textDetailSettingsCell2);
                    return true;
                }
                String key3 = "front" + getDocumentHash(this.frontDocument);
                if (this.errorsValues.containsKey(key3)) {
                    onFieldError(this.documentsCells.get(this.frontDocument));
                    return true;
                }
            }
            if (((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) && (textDetailSettingsCell = this.uploadReverseCell) != null) {
                if (this.reverseDocument == null) {
                    onFieldError(textDetailSettingsCell);
                    return true;
                }
                String key4 = "reverse" + getDocumentHash(this.reverseDocument);
                if (this.errorsValues.containsKey(key4)) {
                    onFieldError(this.documentsCells.get(this.reverseDocument));
                    return true;
                }
            }
            TextDetailSettingsCell textDetailSettingsCell3 = this.uploadSelfieCell;
            if (textDetailSettingsCell3 != null && this.currentBotId != 0) {
                if (this.selfieDocument == null) {
                    onFieldError(textDetailSettingsCell3);
                    return true;
                }
                String key5 = "selfie" + getDocumentHash(this.selfieDocument);
                if (this.errorsValues.containsKey(key5)) {
                    onFieldError(this.documentsCells.get(this.selfieDocument));
                    return true;
                }
            }
            if (this.uploadTranslationCell != null && this.currentBotId != 0) {
                if (this.translationDocuments.isEmpty()) {
                    onFieldError(this.uploadTranslationCell);
                    return true;
                }
                int size2 = this.translationDocuments.size();
                for (int a2 = 0; a2 < size2; a2++) {
                    SecureDocument document2 = this.translationDocuments.get(a2);
                    String key6 = "translation" + getDocumentHash(document2);
                    if (key6 != null && this.errorsValues.containsKey(key6)) {
                        onFieldError(this.documentsCells.get(document2));
                        return true;
                    }
                }
            }
        }
        for (int i = 0; i < 2; i++) {
            if (i == 0) {
                fields = this.inputFields;
            } else {
                TextInfoPrivacyCell textInfoPrivacyCell = this.nativeInfoCell;
                fields = (textInfoPrivacyCell == null || textInfoPrivacyCell.getVisibility() != 0) ? null : this.inputExtraFields;
            }
            if (fields != null) {
                for (int a3 = 0; a3 < fields.length; a3++) {
                    boolean error = false;
                    if (fields[a3].hasErrorText()) {
                        error = true;
                    }
                    if (!this.errorsValues.isEmpty()) {
                        if (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                            if (i == 0) {
                                switch (a3) {
                                    case 0:
                                        key = "first_name";
                                        break;
                                    case 1:
                                        key = "middle_name";
                                        break;
                                    case 2:
                                        key = "last_name";
                                        break;
                                    case 3:
                                        key = "birth_date";
                                        break;
                                    case 4:
                                        key = "gender";
                                        break;
                                    case 5:
                                        key = "country_code";
                                        break;
                                    case 6:
                                        key = "residence_country_code";
                                        break;
                                    case 7:
                                        key = "document_no";
                                        break;
                                    case 8:
                                        key = "expiry_date";
                                        break;
                                    default:
                                        key = null;
                                        break;
                                }
                            } else if (a3 == 0) {
                                key = "first_name_native";
                            } else if (a3 == 1) {
                                key = "middle_name_native";
                            } else if (a3 == 2) {
                                key = "last_name_native";
                            } else {
                                key = null;
                            }
                        } else if (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                            if (a3 == 0) {
                                key = "street_line1";
                            } else if (a3 == 1) {
                                key = "street_line2";
                            } else if (a3 == 2) {
                                key = "post_code";
                            } else if (a3 == 3) {
                                key = "city";
                            } else if (a3 == 4) {
                                key = "state";
                            } else if (a3 == 5) {
                                key = "country_code";
                            } else {
                                key = null;
                            }
                        } else {
                            key = null;
                        }
                        if (key != null) {
                            String value = this.errorsValues.get(key);
                            if (!TextUtils.isEmpty(value) && value.equals(fields[a3].getText().toString())) {
                                error = true;
                            }
                        }
                    }
                    if (!this.documentOnly || this.currentDocumentsType == null || a3 >= 7) {
                        if (!error) {
                            int len = fields[a3].length();
                            boolean allowZeroLength = false;
                            int i2 = this.currentActivityType;
                            if (i2 == 1) {
                                if (a3 != 8) {
                                    if ((i == 0 && (a3 == 0 || a3 == 2 || a3 == 1)) || (i == 1 && (a3 == 0 || a3 == 1 || a3 == 2))) {
                                        if (len > 255) {
                                            error = true;
                                        }
                                        if ((i == 0 && a3 == 1) || (i == 1 && a3 == 1)) {
                                            allowZeroLength = true;
                                        }
                                    } else if (a3 == 7 && len > 24) {
                                        error = true;
                                    }
                                    if (!error && !allowZeroLength && len == 0) {
                                        error = true;
                                    }
                                } else {
                                    continue;
                                }
                            } else {
                                if (i2 == 2) {
                                    if (a3 == 1) {
                                        continue;
                                    } else if (a3 == 3) {
                                        if (len < 2) {
                                            error = true;
                                        }
                                    } else if (a3 == 4) {
                                        if (!"US".equals(this.currentCitizeship)) {
                                            continue;
                                        } else if (len < 2) {
                                            error = true;
                                        }
                                    } else if (a3 == 2 && (len < 2 || len > 10)) {
                                        error = true;
                                    }
                                }
                                if (!error) {
                                    error = true;
                                }
                            }
                        }
                        if (error) {
                            onFieldError(fields[a3]);
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    private void createIdentityInterface(android.content.Context r27) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PassportActivity.createIdentityInterface(android.content.Context):void");
    }

    public void lambda$createIdentityInterface$40$PassportActivity(View v) {
        this.uploadingFileType = 2;
        openAttachMenu();
    }

    public void lambda$createIdentityInterface$41$PassportActivity(View v) {
        this.uploadingFileType = 3;
        openAttachMenu();
    }

    public void lambda$createIdentityInterface$42$PassportActivity(View v) {
        this.uploadingFileType = 1;
        openAttachMenu();
    }

    public void lambda$createIdentityInterface$43$PassportActivity(View v) {
        this.uploadingFileType = 4;
        openAttachMenu();
    }

    public void lambda$createIdentityInterface$45$PassportActivity(View v) {
        if ((25 + 4) % 4 <= 0) {
        }
        if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.CAMERA") != 0) {
            getParentActivity().requestPermissions(new String[]{"android.permission.CAMERA"}, 22);
            return;
        }
        MrzCameraActivity fragment = new MrzCameraActivity();
        fragment.setDelegate(new -$.Lambda.PassportActivity.sMfdvfUG_YtnuvTUG04_qxLVrlg(this));
        presentFragment(fragment);
    }

    public void lambda$null$44$PassportActivity(MrzRecognizer.Result result) {
        if ((31 + 27) % 27 <= 0) {
        }
        if (!TextUtils.isEmpty(result.firstName)) {
            this.inputFields[0].setText(result.firstName);
        }
        if (!TextUtils.isEmpty(result.middleName)) {
            this.inputFields[1].setText(result.middleName);
        }
        if (!TextUtils.isEmpty(result.lastName)) {
            this.inputFields[2].setText(result.lastName);
        }
        if (result.gender != 0) {
            int i = result.gender;
            if (i == 1) {
                this.currentGender = "male";
                this.inputFields[4].setText(LocaleController.getString("PassportMale", 2131692730));
            } else if (i == 2) {
                this.currentGender = "female";
                this.inputFields[4].setText(LocaleController.getString("PassportFemale", 2131692667));
            }
        }
        if (!TextUtils.isEmpty(result.nationality)) {
            String str = result.nationality;
            this.currentCitizeship = str;
            String country = this.languageMap.get(str);
            if (country != null) {
                this.inputFields[5].setText(country);
            }
        }
        if (!TextUtils.isEmpty(result.issuingCountry)) {
            String str2 = result.issuingCountry;
            this.currentResidence = str2;
            String country2 = this.languageMap.get(str2);
            if (country2 != null) {
                this.inputFields[6].setText(country2);
            }
        }
        if (result.birthDay > 0 && result.birthMonth > 0 && result.birthYear > 0) {
            this.inputFields[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.birthDay), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
        }
    }

    public boolean lambda$createIdentityInterface$47$PassportActivity(View v, MotionEvent event) {
        if ((30 + 32) % 32 <= 0) {
        }
        if (getParentActivity() == null) {
            return false;
        }
        if (event.getAction() == 1) {
            CountrySelectActivity fragment = new CountrySelectActivity(false);
            fragment.setCountrySelectActivityDelegate(new -$.Lambda.PassportActivity.zZZclzgbD0y6N8cl3BvaFJJlIT8(this, v));
            presentFragment(fragment);
        }
        return true;
    }

    public void lambda$null$46$PassportActivity(View v, CountrySelectActivity.Country country) {
        if ((FIELD_IDENTITY_COUNT + 23) % 23 <= 0) {
        }
        if (country != null) {
            int field12 = ((Integer) v.getTag()).intValue();
            EditTextBoldCursor editText = this.inputFields[field12];
            if (field12 == 5) {
                this.currentCitizeship = country.shortname;
            } else {
                this.currentResidence = country.shortname;
            }
            editText.setText(country.name + "");
        }
    }

    public boolean lambda$createIdentityInterface$50$PassportActivity(Context context, View v, MotionEvent event) {
        String title;
        int minYear;
        int maxYear;
        int currentYearDiff;
        int selectedDay;
        int selectedMonth;
        int selectedYear;
        if ((28 + 13) % 13 <= 0) {
        }
        if (getParentActivity() == null) {
            return false;
        }
        if (event.getAction() == 1) {
            Calendar calendar = Calendar.getInstance();
            calendar.get(1);
            calendar.get(2);
            calendar.get(5);
            try {
                final EditTextBoldCursor field1 = (EditTextBoldCursor) v;
                final int num = ((Integer) field1.getTag()).intValue();
                if (num == 8) {
                    title = LocaleController.getString("PassportSelectExpiredDate", 2131692774);
                    minYear = 0;
                    maxYear = 20;
                    currentYearDiff = 0;
                } else {
                    title = LocaleController.getString("PassportSelectBithdayDate", 2131692773);
                    minYear = -120;
                    maxYear = 0;
                    currentYearDiff = -18;
                }
                String[] args = field1.getText().toString().split("\\.");
                if (args.length != 3) {
                    selectedDay = -1;
                    selectedMonth = -1;
                    selectedYear = -1;
                } else {
                    int selectedDay2 = Utilities.parseInt(args[0]).intValue();
                    int selectedMonth2 = Utilities.parseInt(args[1]).intValue();
                    int selectedYear2 = Utilities.parseInt(args[2]).intValue();
                    selectedDay = selectedDay2;
                    selectedMonth = selectedMonth2;
                    selectedYear = selectedYear2;
                }
                AlertDialog.Builder builder = AlertsCreator.createDatePickerDialog(context, minYear, maxYear, currentYearDiff, selectedDay, selectedMonth, selectedYear, title, num == 8, new AlertsCreator.DatePickerDelegate() {
                    public final void didSelectDate(int i, int i2, int i3) {
                        if ((31 + 14) % 14 <= 0) {
                        }
                        PassportActivity.this.lambda$null$48$PassportActivity(num, field1, i, i2, i3);
                    }
                });
                if (num == 8) {
                    builder.setNegativeButton(LocaleController.getString("PassportSelectNotExpire", 2131692776), new -$.Lambda.PassportActivity.rcyWWZheSndhFvUaoXaI0zyCu8E(this, field1));
                }
                showDialog(builder.create());
                return true;
            } catch (Exception e) {
                FileLog.e(e);
                return true;
            }
        }
        return true;
    }

    public void lambda$null$48$PassportActivity(int num, EditTextBoldCursor field1, int year1, int month, int dayOfMonth1) {
        if ((32 + 22) % 22 <= 0) {
        }
        if (num == 8) {
            int[] iArr = this.currentExpireDate;
            iArr[0] = year1;
            iArr[1] = month + 1;
            iArr[2] = dayOfMonth1;
        }
        field1.setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(dayOfMonth1), Integer.valueOf(month + 1), Integer.valueOf(year1)));
    }

    public void lambda$null$49$PassportActivity(EditTextBoldCursor field1, DialogInterface dialog, int which) {
        if ((21 + 8) % 8 <= 0) {
        }
        int[] iArr = this.currentExpireDate;
        iArr[2] = 0;
        iArr[1] = 0;
        iArr[0] = 0;
        field1.setText(LocaleController.getString("PassportNoExpireDate", 2131692744));
    }

    public boolean lambda$createIdentityInterface$52$PassportActivity(View v, MotionEvent event) {
        if ((18 + 29) % 29 <= 0) {
        }
        if (getParentActivity() == null) {
            return false;
        }
        if (event.getAction() == 1) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("PassportSelectGender", 2131692775));
            builder.setItems(new CharSequence[]{LocaleController.getString("PassportMale", 2131692730), LocaleController.getString("PassportFemale", 2131692667)}, new -$.Lambda.PassportActivity.E8MjJxYfpy0_yPdd5o_x40xObDg(this));
            builder.setPositiveButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
            showDialog(builder.create());
        }
        return true;
    }

    public void lambda$null$51$PassportActivity(DialogInterface dialogInterface, int i) {
        if ((13 + 11) % 11 <= 0) {
        }
        if (i == 0) {
            this.currentGender = "male";
            this.inputFields[4].setText(LocaleController.getString("PassportMale", 2131692730));
        } else if (i == 1) {
            this.currentGender = "female";
            this.inputFields[4].setText(LocaleController.getString("PassportFemale", 2131692667));
        }
    }

    public boolean lambda$createIdentityInterface$53$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if ((20 + 12) % 12 <= 0) {
        }
        if (i == 5) {
            int num = ((Integer) textView.getTag()).intValue() + 1;
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            if (num < editTextBoldCursorArr.length) {
                if (editTextBoldCursorArr[num].isFocusable()) {
                    this.inputFields[num].requestFocus();
                } else {
                    this.inputFields[num].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, 0));
                    textView.clearFocus();
                    AndroidUtilities.hideKeyboard(textView);
                }
            }
            return true;
        }
        return false;
    }

    public boolean lambda$createIdentityInterface$54$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if ((1 + 2) % 2 <= 0) {
        }
        if (i == 5) {
            int num = ((Integer) textView.getTag()).intValue() + 1;
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputExtraFields;
            if (num < editTextBoldCursorArr.length) {
                if (editTextBoldCursorArr[num].isFocusable()) {
                    this.inputExtraFields[num].requestFocus();
                } else {
                    this.inputExtraFields[num].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, 0));
                    textView.clearFocus();
                    AndroidUtilities.hideKeyboard(textView);
                }
            }
            return true;
        }
        return false;
    }

    public void lambda$createIdentityInterface$55$PassportActivity(View v) {
        createDocumentDeleteAlert();
    }

    private void updateInterfaceStringsForDocumentType() {
        if ((25 + 18) % 18 <= 0) {
        }
        if (this.currentDocumentsType != null) {
            this.actionBar.setTitle(getTextForType(this.currentDocumentsType.type));
        } else {
            this.actionBar.setTitle(LocaleController.getString("PassportPersonal", 2131692746));
        }
        updateUploadText(2);
        updateUploadText(3);
        updateUploadText(1);
        updateUploadText(4);
    }

    public void updateUploadText(int type) {
        if ((10 + 26) % 26 <= 0) {
        }
        boolean z = true;
        if (type == 0) {
            if (this.uploadDocumentCell == null) {
                return;
            }
            if (this.documents.size() >= 1) {
                this.uploadDocumentCell.setText(LocaleController.getString("PassportUploadAdditinalDocument", 2131692788), false);
                return;
            } else {
                this.uploadDocumentCell.setText(LocaleController.getString("PassportUploadDocument", 2131692789), false);
                return;
            }
        }
        if (type == 1) {
            TextDetailSettingsCell textDetailSettingsCell = this.uploadSelfieCell;
            if (textDetailSettingsCell == null) {
                return;
            }
            textDetailSettingsCell.setVisibility(this.selfieDocument != null ? 8 : 0);
            return;
        }
        if (type == 4) {
            if (this.uploadTranslationCell == null) {
                return;
            }
            if (this.translationDocuments.size() >= 1) {
                this.uploadTranslationCell.setText(LocaleController.getString("PassportUploadAdditinalDocument", 2131692788), false);
                return;
            } else {
                this.uploadTranslationCell.setText(LocaleController.getString("PassportUploadDocument", 2131692789), false);
                return;
            }
        }
        if (type == 2) {
            if (this.uploadFrontCell == null) {
                return;
            }
            TLRPC.TL_secureRequiredType tL_secureRequiredType = this.currentDocumentsType;
            if (tL_secureRequiredType == null || (!tL_secureRequiredType.selfie_required && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense))) {
                z = false;
            }
            boolean divider = z;
            if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                this.uploadFrontCell.setTextAndValue(LocaleController.getString("PassportMainPage", 2131692728), LocaleController.getString("PassportMainPageInfo", 2131692729), divider);
            } else {
                this.uploadFrontCell.setTextAndValue(LocaleController.getString("PassportFrontSide", 2131692668), LocaleController.getString("PassportFrontSideInfo", 2131692669), divider);
            }
            this.uploadFrontCell.setVisibility(this.frontDocument != null ? 8 : 0);
            return;
        }
        if (type != 3 || this.uploadReverseCell == null) {
            return;
        }
        if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
            this.reverseLayout.setVisibility(8);
            this.uploadReverseCell.setVisibility(8);
        } else {
            this.reverseLayout.setVisibility(0);
            this.uploadReverseCell.setVisibility(this.reverseDocument != null ? 8 : 0);
        }
    }

    private void checkTopErrorCell(boolean init) {
        String errorText;
        String errorText2;
        if ((11 + 23) % 23 <= 0) {
        }
        if (this.topErrorCell == null) {
            return;
        }
        SpannableStringBuilder stringBuilder = null;
        if (this.fieldsErrors != null && ((init || this.errorsValues.containsKey("error_all")) && (errorText2 = this.fieldsErrors.get("error_all")) != null)) {
            stringBuilder = new SpannableStringBuilder(errorText2);
            if (init) {
                this.errorsValues.put("error_all", "");
            }
        }
        if (this.documentsErrors != null && ((init || this.errorsValues.containsKey("error_document_all")) && (errorText = this.documentsErrors.get("error_all")) != null)) {
            if (stringBuilder == null) {
                stringBuilder = new SpannableStringBuilder(errorText);
            } else {
                stringBuilder.append((CharSequence) "\n\n").append((CharSequence) errorText);
            }
            if (init) {
                this.errorsValues.put("error_document_all", "");
            }
        }
        if (stringBuilder != null) {
            stringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor("windowBackgroundWhiteRedText3")), 0, stringBuilder.length(), 33);
            this.topErrorCell.setText(stringBuilder);
            this.topErrorCell.setVisibility(0);
        } else if (this.topErrorCell.getVisibility() != 8) {
            this.topErrorCell.setVisibility(8);
        }
    }

    private void addDocumentViewInternal(TLRPC.TL_secureFile f, int uploadingType) {
        if ((14 + 20) % 20 <= 0) {
        }
        SecureDocumentKey secureDocumentKey = getSecureDocumentKey(f.secret, f.file_hash);
        SecureDocument secureDocument = new SecureDocument(secureDocumentKey, f, (String) null, (byte[]) null, (byte[]) null);
        addDocumentView(secureDocument, uploadingType);
    }

    private void addDocumentViews(ArrayList<TLRPC.SecureFile> files) {
        if ((27 + 22) % 22 <= 0) {
        }
        this.documents.clear();
        int size = files.size();
        for (int a = 0; a < size; a++) {
            TLRPC.SecureFile secureFile = files.get(a);
            if (secureFile instanceof TLRPC.TL_secureFile) {
                addDocumentViewInternal((TLRPC.TL_secureFile) secureFile, 0);
            }
        }
    }

    private void addTranslationDocumentViews(ArrayList<TLRPC.SecureFile> files) {
        if ((15 + 8) % 8 <= 0) {
        }
        this.translationDocuments.clear();
        int size = files.size();
        for (int a = 0; a < size; a++) {
            TLRPC.SecureFile secureFile = files.get(a);
            if (secureFile instanceof TLRPC.TL_secureFile) {
                addDocumentViewInternal((TLRPC.TL_secureFile) secureFile, 4);
            }
        }
    }

    private void setFieldValues(HashMap<String, String> values, EditTextBoldCursor editText, String key) {
        String value;
        String value2;
        if ((14 + 32) % 32 <= 0) {
        }
        String value3 = values.get(key);
        if (value3 != null) {
            char c = 65535;
            switch (key.hashCode()) {
                case -2006252145:
                    if (key.equals("residence_country_code")) {
                        c = 1;
                        break;
                    }
                    break;
                case -1249512767:
                    if (key.equals("gender")) {
                        c = 2;
                        break;
                    }
                    break;
                case 475919162:
                    if (key.equals("expiry_date")) {
                        c = 3;
                        break;
                    }
                    break;
                case 1481071862:
                    if (key.equals("country_code")) {
                        c = 0;
                        break;
                    }
                    break;
            }
            if (c == 0) {
                this.currentCitizeship = value3;
                String country = this.languageMap.get(value3);
                if (country != null) {
                    editText.setText(country);
                }
            } else if (c == 1) {
                this.currentResidence = value3;
                String country2 = this.languageMap.get(value3);
                if (country2 != null) {
                    editText.setText(country2);
                }
            } else if (c != 2) {
                if (c == 3) {
                    boolean ok = false;
                    if (!TextUtils.isEmpty(value3)) {
                        String[] args = value3.split("\\.");
                        if (args.length == 3) {
                            this.currentExpireDate[0] = Utilities.parseInt(args[2]).intValue();
                            this.currentExpireDate[1] = Utilities.parseInt(args[1]).intValue();
                            this.currentExpireDate[2] = Utilities.parseInt(args[0]).intValue();
                            editText.setText(value3);
                            ok = true;
                        }
                    }
                    if (!ok) {
                        int[] iArr = this.currentExpireDate;
                        iArr[2] = 0;
                        iArr[1] = 0;
                        iArr[0] = 0;
                        editText.setText(LocaleController.getString("PassportNoExpireDate", 2131692744));
                    }
                } else {
                    editText.setText(value3);
                }
            } else if ("male".equals(value3)) {
                this.currentGender = value3;
                editText.setText(LocaleController.getString("PassportMale", 2131692730));
            } else if ("female".equals(value3)) {
                this.currentGender = value3;
                editText.setText(LocaleController.getString("PassportFemale", 2131692667));
            }
        }
        HashMap<String, String> hashMap = this.fieldsErrors;
        if (hashMap != null && (value2 = hashMap.get(key)) != null) {
            editText.setErrorText(value2);
            this.errorsValues.put(key, editText.getText().toString());
            return;
        }
        HashMap<String, String> hashMap2 = this.documentsErrors;
        if (hashMap2 != null && (value = hashMap2.get(key)) != null) {
            editText.setErrorText(value);
            this.errorsValues.put(key, editText.getText().toString());
        }
    }

    private void addDocumentView(SecureDocument document, int type) {
        String text;
        String key;
        String value;
        HashMap<String, String> hashMap;
        if ((19 + 30) % 30 <= 0) {
        }
        if (type == 1) {
            this.selfieDocument = document;
            if (this.selfieLayout == null) {
                return;
            }
        } else if (type == 4) {
            this.translationDocuments.add(document);
            if (this.translationLayout == null) {
                return;
            }
        } else if (type == 2) {
            this.frontDocument = document;
            if (this.frontLayout == null) {
                return;
            }
        } else if (type == 3) {
            this.reverseDocument = document;
            if (this.reverseLayout == null) {
                return;
            }
        } else {
            this.documents.add(document);
            if (this.documentsLayout == null) {
                return;
            }
        }
        if (getParentActivity() == null) {
            return;
        }
        SecureDocumentCell cell = new SecureDocumentCell(this, getParentActivity());
        cell.setTag(document);
        cell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        this.documentsCells.put(document, cell);
        String hash = getDocumentHash(document);
        if (type == 1) {
            text = LocaleController.getString("PassportSelfie", 2131692778);
            this.selfieLayout.addView(cell, LayoutHelper.createLinear(-1, -2));
            key = "selfie" + hash;
        } else if (type == 4) {
            text = LocaleController.getString("AttachPhoto", 2131689960);
            this.translationLayout.addView(cell, LayoutHelper.createLinear(-1, -2));
            key = "translation" + hash;
        } else if (type == 2) {
            if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                text = LocaleController.getString("PassportMainPage", 2131692728);
            } else {
                text = LocaleController.getString("PassportFrontSide", 2131692668);
            }
            this.frontLayout.addView(cell, LayoutHelper.createLinear(-1, -2));
            key = "front" + hash;
        } else if (type == 3) {
            text = LocaleController.getString("PassportReverseSide", 2131692766);
            this.reverseLayout.addView(cell, LayoutHelper.createLinear(-1, -2));
            key = "reverse" + hash;
        } else {
            text = LocaleController.getString("AttachPhoto", 2131689960);
            this.documentsLayout.addView(cell, LayoutHelper.createLinear(-1, -2));
            key = "files" + hash;
        }
        if (key != null && (hashMap = this.documentsErrors) != null) {
            String str = hashMap.get(key);
            value = str;
            if (str != null) {
                cell.valueTextView.setTextColor(Theme.getColor("windowBackgroundWhiteRedText3"));
                this.errorsValues.put(key, "");
                cell.setTextAndValueAndImage(text, value, document);
                cell.setOnClickListener(new -$.Lambda.PassportActivity.eyq8hV8BB59n5BNZqf5O-rud9PQ(this, type));
                cell.setOnLongClickListener(new -$.Lambda.PassportActivity.baJN1tKNS1-dTBsXxZQlBqEwUEY(this, type, document, cell, key));
            }
        }
        value = LocaleController.formatDateForBan(document.secureFile.date);
        cell.setTextAndValueAndImage(text, value, document);
        cell.setOnClickListener(new -$.Lambda.PassportActivity.eyq8hV8BB59n5BNZqf5O-rud9PQ(this, type));
        cell.setOnLongClickListener(new -$.Lambda.PassportActivity.baJN1tKNS1-dTBsXxZQlBqEwUEY(this, type, document, cell, key));
    }

    public void lambda$addDocumentView$56$PassportActivity(int type, View v) {
        if ((16 + 23) % 23 <= 0) {
        }
        this.uploadingFileType = type;
        if (type == 1) {
            this.currentPhotoViewerLayout = this.selfieLayout;
        } else if (type == 4) {
            this.currentPhotoViewerLayout = this.translationLayout;
        } else if (type == 2) {
            this.currentPhotoViewerLayout = this.frontLayout;
        } else if (type == 3) {
            this.currentPhotoViewerLayout = this.reverseLayout;
        } else {
            this.currentPhotoViewerLayout = this.documentsLayout;
        }
        SecureDocument document1 = (SecureDocument) v.getTag();
        PhotoViewer.getInstance().setParentActivity(getParentActivity());
        if (type == 0) {
            PhotoViewer photoViewer = PhotoViewer.getInstance();
            ArrayList<SecureDocument> arrayList = this.documents;
            photoViewer.openPhoto(arrayList, arrayList.indexOf(document1), this.provider);
        } else {
            PhotoViewer photoViewer2 = PhotoViewer.getInstance();
            ArrayList<SecureDocument> arrayList2 = this.translationDocuments;
            photoViewer2.openPhoto(arrayList2, arrayList2.indexOf(document1), this.provider);
        }
    }

    public boolean lambda$addDocumentView$58$PassportActivity(int type, SecureDocument document, SecureDocumentCell cell, String key, View v) {
        if ((7 + 29) % 29 <= 0) {
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        if (type == 1) {
            builder.setMessage(LocaleController.getString("PassportDeleteSelfie", 2131692654));
        } else {
            builder.setMessage(LocaleController.getString("PassportDeleteScan", 2131692652));
        }
        builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
        builder.setTitle(LocaleController.getString("AppName", 2131689827));
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), new -$.Lambda.PassportActivity.9M1AndhyYV21DpTQcJKWf--03z8(this, document, type, cell, key));
        showDialog(builder.create());
        return true;
    }

    public void lambda$null$57$PassportActivity(SecureDocument document, int type, SecureDocumentCell cell, String key, DialogInterface dialog, int which) {
        if ((10 + 15) % 15 <= 0) {
        }
        this.documentsCells.remove(document);
        if (type == 1) {
            this.selfieDocument = null;
            this.selfieLayout.removeView(cell);
        } else if (type == 4) {
            this.translationDocuments.remove(document);
            this.translationLayout.removeView(cell);
        } else if (type == 2) {
            this.frontDocument = null;
            this.frontLayout.removeView(cell);
        } else if (type == 3) {
            this.reverseDocument = null;
            this.reverseLayout.removeView(cell);
        } else {
            this.documents.remove(document);
            this.documentsLayout.removeView(cell);
        }
        if (key != null) {
            HashMap<String, String> hashMap = this.documentsErrors;
            if (hashMap != null) {
                hashMap.remove(key);
            }
            HashMap<String, String> hashMap2 = this.errorsValues;
            if (hashMap2 != null) {
                hashMap2.remove(key);
            }
        }
        updateUploadText(type);
        if (document.path != null && this.uploadingDocuments.remove(document.path) != null) {
            if (this.uploadingDocuments.isEmpty()) {
                this.doneItem.setEnabled(true);
                this.doneItem.setAlpha(1.0f);
            }
            FileLoader.getInstance(this.currentAccount).cancelUploadFile(document.path, false);
        }
    }

    private String getNameForType(TLRPC.SecureValueType type) {
        if (type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            return "personal_details";
        }
        if (type instanceof TLRPC.TL_secureValueTypePassport) {
            return "passport";
        }
        if (type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
            return "internal_passport";
        }
        if (type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
            return "driver_license";
        }
        if (type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
            return "identity_card";
        }
        if (type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
            return "utility_bill";
        }
        if (type instanceof TLRPC.TL_secureValueTypeAddress) {
            return "address";
        }
        if (type instanceof TLRPC.TL_secureValueTypeBankStatement) {
            return "bank_statement";
        }
        if (type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
            return "rental_agreement";
        }
        if (type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
            return "temporary_registration";
        }
        if (type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
            return "passport_registration";
        }
        if (type instanceof TLRPC.TL_secureValueTypeEmail) {
            return "email";
        }
        if (type instanceof TLRPC.TL_secureValueTypePhone) {
            return "phone";
        }
        return "";
    }

    private TextDetailSecureCell getViewByType(TLRPC.TL_secureRequiredType requiredType) {
        TLRPC.TL_secureRequiredType requiredType2;
        if ((31 + 15) % 15 <= 0) {
        }
        TextDetailSecureCell view = this.typesViews.get(requiredType);
        if (view == null && (requiredType2 = this.documentsToTypesLink.get(requiredType)) != null) {
            return this.typesViews.get(requiredType2);
        }
        return view;
    }

    private String getTextForType(TLRPC.SecureValueType type) {
        if ((4 + 2) % 2 <= 0) {
        }
        if (type instanceof TLRPC.TL_secureValueTypePassport) {
            return LocaleController.getString("ActionBotDocumentPassport", 2131689600);
        }
        if (type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
            return LocaleController.getString("ActionBotDocumentDriverLicence", 2131689595);
        }
        if (type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
            return LocaleController.getString("ActionBotDocumentIdentityCard", 2131689598);
        }
        if (type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
            return LocaleController.getString("ActionBotDocumentUtilityBill", 2131689606);
        }
        if (type instanceof TLRPC.TL_secureValueTypeBankStatement) {
            return LocaleController.getString("ActionBotDocumentBankStatement", 2131689594);
        }
        if (type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
            return LocaleController.getString("ActionBotDocumentRentalAgreement", 2131689604);
        }
        if (type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
            return LocaleController.getString("ActionBotDocumentInternalPassport", 2131689599);
        }
        if (type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
            return LocaleController.getString("ActionBotDocumentPassportRegistration", 2131689601);
        }
        if (type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
            return LocaleController.getString("ActionBotDocumentTemporaryRegistration", 2131689605);
        }
        if (type instanceof TLRPC.TL_secureValueTypePhone) {
            return LocaleController.getString("ActionBotDocumentPhone", 2131689602);
        }
        if (type instanceof TLRPC.TL_secureValueTypeEmail) {
            return LocaleController.getString("ActionBotDocumentEmail", 2131689596);
        }
        return "";
    }

    public void setTypeValue(im.amwhusedvt.tgnet.TLRPC.TL_secureRequiredType r37, java.lang.String r38, java.lang.String r39, im.amwhusedvt.tgnet.TLRPC.TL_secureRequiredType r40, java.lang.String r41, boolean r42, int r43) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PassportActivity.setTypeValue(im.amwhusedvt.tgnet.TLRPC$TL_secureRequiredType, java.lang.String, java.lang.String, im.amwhusedvt.tgnet.TLRPC$TL_secureRequiredType, java.lang.String, boolean, int):void");
    }

    public void checkNativeFields(boolean byEdit) {
        EditTextBoldCursor[] editTextBoldCursorArr;
        if ((14 + 32) % 32 <= 0) {
        }
        if (this.inputExtraFields == null) {
            return;
        }
        String country = this.languageMap.get(this.currentResidence);
        HashMap<String, String> map = SharedConfig.getCountryLangs();
        String lang = map.get(this.currentResidence);
        if (!this.currentType.native_names || TextUtils.isEmpty(this.currentResidence) || "EN".equals(lang)) {
            if (this.nativeInfoCell.getVisibility() != 8) {
                this.nativeInfoCell.setVisibility(8);
                this.headerCell.setVisibility(8);
                this.extraBackgroundView2.setVisibility(8);
                int a = 0;
                while (true) {
                    EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                    if (a >= editTextBoldCursorArr2.length) {
                        break;
                    }
                    ((View) editTextBoldCursorArr2[a].getParent()).setVisibility(8);
                    a++;
                }
                int a2 = this.currentBotId;
                if (((a2 != 0 || this.currentDocumentsType == null) && this.currentTypeValue != null && !this.documentOnly) || this.currentDocumentsTypeValue != null) {
                    this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), 2131231056, "windowBackgroundGrayShadow"));
                    return;
                } else {
                    this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), 2131231057, "windowBackgroundGrayShadow"));
                    return;
                }
            }
            return;
        }
        if (this.nativeInfoCell.getVisibility() != 0) {
            this.nativeInfoCell.setVisibility(0);
            this.headerCell.setVisibility(0);
            this.extraBackgroundView2.setVisibility(0);
            int a3 = 0;
            while (true) {
                editTextBoldCursorArr = this.inputExtraFields;
                if (a3 >= editTextBoldCursorArr.length) {
                    break;
                }
                ((View) editTextBoldCursorArr[a3].getParent()).setVisibility(0);
                a3++;
            }
            if (editTextBoldCursorArr[0].length() == 0 && this.inputExtraFields[1].length() == 0 && this.inputExtraFields[2].length() == 0) {
                int a4 = 0;
                while (true) {
                    boolean[] zArr = this.nonLatinNames;
                    if (a4 >= zArr.length) {
                        break;
                    }
                    if (!zArr[a4]) {
                        a4++;
                    } else {
                        this.inputExtraFields[0].setText(this.inputFields[0].getText());
                        this.inputExtraFields[1].setText(this.inputFields[1].getText());
                        this.inputExtraFields[2].setText(this.inputFields[2].getText());
                        break;
                    }
                }
            }
            this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), 2131231056, "windowBackgroundGrayShadow"));
        }
        this.nativeInfoCell.setText(LocaleController.formatString("PassportNativeInfo", 2131692740, new Object[]{country}));
        String header = lang != null ? LocaleController.getServerString("PassportLanguage_" + lang) : null;
        if (header != null) {
            this.headerCell.setText(LocaleController.formatString("PassportNativeHeaderLang", 2131692739, new Object[]{header}));
        } else {
            this.headerCell.setText(LocaleController.getString("PassportNativeHeader", 2131692738));
        }
        for (int a5 = 0; a5 < 3; a5++) {
            if (a5 != 0) {
                if (a5 != 1) {
                    if (a5 == 2) {
                        if (header != null) {
                            this.inputExtraFields[a5].setHintText(LocaleController.getString("PassportSurname", 2131692783));
                        } else {
                            this.inputExtraFields[a5].setHintText(LocaleController.formatString("PassportSurnameCountry", 2131692784, new Object[]{country}));
                        }
                    }
                } else if (header != null) {
                    this.inputExtraFields[a5].setHintText(LocaleController.getString("PassportMidname", 2131692731));
                } else {
                    this.inputExtraFields[a5].setHintText(LocaleController.formatString("PassportMidnameCountry", 2131692732, new Object[]{country}));
                }
            } else if (header != null) {
                this.inputExtraFields[a5].setHintText(LocaleController.getString("PassportName", 2131692734));
            } else {
                this.inputExtraFields[a5].setHintText(LocaleController.formatString("PassportNameCountry", 2131692736, new Object[]{country}));
            }
        }
        if (byEdit) {
            AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.NtfUqMSgGqWqb5NZhGlyudiYD0E(this));
        }
    }

    public void lambda$checkNativeFields$59$PassportActivity() {
        if ((7 + 26) % 26 <= 0) {
        }
        View[] viewArr = this.inputExtraFields;
        if (viewArr != null) {
            scrollToField(viewArr[0]);
        }
    }

    private String getErrorsString(HashMap<String, String> errors, HashMap<String, String> documentErrors) {
        HashMap<String, String> hashMap;
        if ((15 + 5) % 5 <= 0) {
        }
        StringBuilder stringBuilder = new StringBuilder();
        for (int a = 0; a < 2; a++) {
            if (a == 0) {
                hashMap = errors;
            } else {
                hashMap = documentErrors;
            }
            if (hashMap != null) {
                for (Map.Entry<String, String> entry : hashMap.entrySet()) {
                    String value = entry.getValue();
                    if (stringBuilder.length() > 0) {
                        stringBuilder.append(", ");
                        value = value.toLowerCase();
                    }
                    if (value.endsWith(".")) {
                        value = value.substring(0, value.length() - 1);
                    }
                    stringBuilder.append(value);
                }
            }
        }
        int a2 = stringBuilder.length();
        if (a2 > 0) {
            stringBuilder.append('.');
        }
        return stringBuilder.toString();
    }

    private TLRPC.TL_secureValue getValueByType(TLRPC.TL_secureRequiredType requiredType, boolean check) {
        String[] keys;
        if ((14 + 6) % 6 <= 0) {
        }
        if (requiredType == null) {
            return null;
        }
        int size = this.currentForm.values.size();
        for (int a = 0; a < size; a++) {
            TLRPC.TL_secureValue secureValue = (TLRPC.TL_secureValue) this.currentForm.values.get(a);
            if (requiredType.type.getClass() == secureValue.type.getClass()) {
                if (check) {
                    if (requiredType.selfie_required && !(secureValue.selfie instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if (requiredType.translation_required && secureValue.translation.isEmpty()) {
                        return null;
                    }
                    if (isAddressDocument(requiredType.type) && secureValue.files.isEmpty()) {
                        return null;
                    }
                    if (isPersonalDocument(requiredType.type) && !(secureValue.front_side instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if (((requiredType.type instanceof TLRPC.TL_secureValueTypeDriverLicense) || (requiredType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) && !(secureValue.reverse_side instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if ((requiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) || (requiredType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
                        if (requiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                            if (requiredType.native_names) {
                                keys = new String[]{"first_name_native", "last_name_native", "birth_date", "gender", "country_code", "residence_country_code"};
                            } else {
                                keys = new String[]{"first_name", "last_name", "birth_date", "gender", "country_code", "residence_country_code"};
                            }
                        } else {
                            keys = new String[]{"street_line1", "street_line2", "post_code", "city", "state", "country_code"};
                        }
                        try {
                            JSONObject jsonObject = new JSONObject(decryptData(secureValue.data.data, decryptValueSecret(secureValue.data.secret, secureValue.data.data_hash), secureValue.data.data_hash));
                            for (int b = 0; b < keys.length; b++) {
                                if (!jsonObject.has(keys[b]) || TextUtils.isEmpty(jsonObject.getString(keys[b]))) {
                                    return null;
                                }
                            }
                        } catch (Throwable th) {
                            return null;
                        }
                    }
                }
                return secureValue;
            }
        }
        return null;
    }

    private void openTypeActivity(TLRPC.TL_secureRequiredType requiredType, TLRPC.TL_secureRequiredType documentRequiredType, ArrayList<TLRPC.TL_secureRequiredType> availableDocumentTypes, boolean documentOnly) {
        int activityType;
        HashMap<String, String> hashMap;
        HashMap<String, String> hashMap2;
        if ((26 + 24) % 24 <= 0) {
        }
        int availableDocumentTypesCount = availableDocumentTypes != null ? availableDocumentTypes.size() : 0;
        TLRPC.SecureValueType type = requiredType.type;
        TLRPC.SecureValueType documentType = documentRequiredType != null ? documentRequiredType.type : null;
        if (type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            activityType = 1;
        } else if (type instanceof TLRPC.TL_secureValueTypeAddress) {
            activityType = 2;
        } else if (type instanceof TLRPC.TL_secureValueTypePhone) {
            activityType = 3;
        } else if (!(type instanceof TLRPC.TL_secureValueTypeEmail)) {
            activityType = -1;
        } else {
            activityType = 4;
        }
        if (activityType != -1) {
            if (!documentOnly) {
                hashMap = this.errorsMap.get(getNameForType(type));
            } else {
                hashMap = null;
            }
            HashMap<String, String> errors = hashMap;
            HashMap<String, String> documentsErrors = this.errorsMap.get(getNameForType(documentType));
            TLRPC.TL_secureValue value = getValueByType(requiredType, false);
            TLRPC.TL_secureValue documentsValue = getValueByType(documentRequiredType, false);
            TLRPC.TL_account_authorizationForm tL_account_authorizationForm = this.currentForm;
            TLRPC.TL_account_password tL_account_password = this.currentPassword;
            HashMap<String, String> hashMap3 = this.typesValues.get(requiredType);
            if (documentRequiredType != null) {
                hashMap2 = this.typesValues.get(documentRequiredType);
            } else {
                hashMap2 = null;
            }
            int activityType2 = activityType;
            PassportActivity activity = new PassportActivity(activityType, tL_account_authorizationForm, tL_account_password, requiredType, value, documentRequiredType, documentsValue, hashMap3, hashMap2);
            activity.delegate = new 19(this, type, documentOnly, availableDocumentTypesCount);
            activity.currentAccount = this.currentAccount;
            activity.saltedPassword = this.saltedPassword;
            activity.secureSecret = this.secureSecret;
            activity.currentBotId = this.currentBotId;
            activity.fieldsErrors = errors;
            activity.documentOnly = documentOnly;
            activity.documentsErrors = documentsErrors;
            activity.availableDocumentTypes = availableDocumentTypes;
            if (activityType2 == 4) {
                activity.currentEmail = this.currentEmail;
            }
            presentFragment(activity);
        }
    }

    public TLRPC.TL_secureValue removeValue(TLRPC.TL_secureRequiredType requiredType) {
        if ((32 + 28) % 28 <= 0) {
        }
        if (requiredType == null) {
            return null;
        }
        int size = this.currentForm.values.size();
        for (int a = 0; a < size; a++) {
            TLRPC.TL_secureValue secureValue = (TLRPC.TL_secureValue) this.currentForm.values.get(a);
            if (requiredType.type.getClass() == secureValue.type.getClass()) {
                return (TLRPC.TL_secureValue) this.currentForm.values.remove(a);
            }
        }
        return null;
    }

    public void deleteValueInternal(TLRPC.TL_secureRequiredType requiredType, TLRPC.TL_secureRequiredType documentRequiredType, ArrayList<TLRPC.TL_secureRequiredType> documentRequiredTypes, boolean deleteType, Runnable finishRunnable, ErrorRunnable errorRunnable, boolean documentOnly) {
        if ((7 + 11) % 11 <= 0) {
        }
        if (requiredType == null) {
            return;
        }
        TLRPC.TL_account_deleteSecureValue req = new TLRPC.TL_account_deleteSecureValue();
        if (documentOnly && documentRequiredType != null) {
            req.types.add(documentRequiredType.type);
        } else {
            if (deleteType) {
                req.types.add(requiredType.type);
            }
            if (documentRequiredType != null) {
                req.types.add(documentRequiredType.type);
            }
        }
        ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new -$.Lambda.PassportActivity.0HarnYblt9JmayPUto_4G5ieyws(this, errorRunnable, documentOnly, documentRequiredType, requiredType, deleteType, documentRequiredTypes, finishRunnable));
    }

    public void lambda$deleteValueInternal$61$PassportActivity(ErrorRunnable errorRunnable, boolean documentOnly, TLRPC.TL_secureRequiredType documentRequiredType, TLRPC.TL_secureRequiredType requiredType, boolean deleteType, ArrayList documentRequiredTypes, Runnable finishRunnable, TLObject response, TLRPC.TL_error error) {
        if ((27 + 26) % 26 <= 0) {
        }
        AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.LwnMbAnR8UmI64wAplZHHcPmSPk(this, error, errorRunnable, documentOnly, documentRequiredType, requiredType, deleteType, documentRequiredTypes, finishRunnable));
    }

    public void lambda$null$60$PassportActivity(TLRPC.TL_error error, ErrorRunnable errorRunnable, boolean documentOnly, TLRPC.TL_secureRequiredType documentRequiredType, TLRPC.TL_secureRequiredType requiredType, boolean deleteType, ArrayList documentRequiredTypes, Runnable finishRunnable) {
        String documentJson;
        TLRPC.TL_secureRequiredType documentsType;
        String json;
        if ((26 + 8) % 8 <= 0) {
        }
        if (error != null) {
            if (errorRunnable != null) {
                errorRunnable.onError(error.text, null);
            }
            showAlertWithText(LocaleController.getString("AppName", 2131689827), error.text);
            return;
        }
        if (documentOnly) {
            if (documentRequiredType != null) {
                removeValue(documentRequiredType);
            } else {
                removeValue(requiredType);
            }
        } else {
            if (deleteType) {
                removeValue(requiredType);
            }
            removeValue(documentRequiredType);
        }
        if (this.currentActivityType == 8) {
            TextDetailSecureCell view = this.typesViews.remove(requiredType);
            if (view != null) {
                this.linearLayout2.removeView(view);
                View child = this.linearLayout2.getChildAt(r1.getChildCount() - 6);
                if (child instanceof TextDetailSecureCell) {
                    ((TextDetailSecureCell) child).setNeedDivider(false);
                }
            }
            updateManageVisibility();
        } else {
            String documentJson2 = null;
            TLRPC.TL_secureRequiredType documentsType2 = documentRequiredType;
            if (documentsType2 != null && documentRequiredTypes != null && documentRequiredTypes.size() > 1) {
                int a = 0;
                int count = documentRequiredTypes.size();
                while (true) {
                    if (a >= count) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType documentType = (TLRPC.TL_secureRequiredType) documentRequiredTypes.get(a);
                    TLRPC.TL_secureValue documentValue = getValueByType(documentType, false);
                    if (documentValue == null) {
                        a++;
                    } else {
                        if (documentValue.data != null) {
                            documentJson2 = decryptData(documentValue.data.data, decryptValueSecret(documentValue.data.secret, documentValue.data.data_hash), documentValue.data.data_hash);
                        }
                        documentsType2 = documentType;
                    }
                }
                if (documentsType2 != null) {
                    documentJson = documentJson2;
                    documentsType = documentsType2;
                } else {
                    documentJson = documentJson2;
                    documentsType = (TLRPC.TL_secureRequiredType) documentRequiredTypes.get(0);
                }
            } else {
                documentJson = null;
                documentsType = documentsType2;
            }
            if (deleteType) {
                setTypeValue(requiredType, null, null, documentsType, documentJson, documentOnly, documentRequiredTypes != null ? documentRequiredTypes.size() : 0);
            } else {
                TLRPC.TL_secureValue value = getValueByType(requiredType, false);
                if (value != null && value.data != null) {
                    String json2 = decryptData(value.data.data, decryptValueSecret(value.data.secret, value.data.data_hash), value.data.data_hash);
                    json = json2;
                } else {
                    json = null;
                }
                setTypeValue(requiredType, null, json, documentsType, documentJson, documentOnly, documentRequiredTypes != null ? documentRequiredTypes.size() : 0);
            }
        }
        if (finishRunnable != null) {
            finishRunnable.run();
        }
    }

    private TextDetailSecureCell addField(Context context, final TLRPC.TL_secureRequiredType requiredType, final ArrayList<TLRPC.TL_secureRequiredType> documentRequiredTypes, final boolean documentOnly, boolean last) {
        String text;
        String text2;
        String json;
        TLRPC.TL_secureRequiredType documentsType;
        String documentJson;
        boolean found;
        int count;
        String documentJson2;
        String text3;
        if ((12 + 4) % 4 <= 0) {
        }
        int availableDocumentTypesCount = documentRequiredTypes != null ? documentRequiredTypes.size() : 0;
        TextDetailSecureCell view = new TextDetailSecureCell(this, context);
        view.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        if (requiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            if (documentRequiredTypes == null || documentRequiredTypes.isEmpty()) {
                text3 = LocaleController.getString("PassportPersonalDetails", 2131692747);
            } else if (documentOnly && documentRequiredTypes.size() == 1) {
                text3 = getTextForType(documentRequiredTypes.get(0).type);
            } else if (documentOnly && documentRequiredTypes.size() == 2) {
                text3 = LocaleController.formatString("PassportTwoDocuments", 2131692787, new Object[]{getTextForType(documentRequiredTypes.get(0).type), getTextForType(documentRequiredTypes.get(1).type)});
            } else {
                text3 = LocaleController.getString("PassportIdentityDocument", 2131692671);
            }
            view.setTextAndValue(text3, "", !last);
        } else if (requiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
            if (documentRequiredTypes == null || documentRequiredTypes.isEmpty()) {
                text = LocaleController.getString("PassportAddress", 2131692633);
            } else if (documentOnly && documentRequiredTypes.size() == 1) {
                text = getTextForType(documentRequiredTypes.get(0).type);
            } else if (documentOnly && documentRequiredTypes.size() == 2) {
                text = LocaleController.formatString("PassportTwoDocuments", 2131692787, new Object[]{getTextForType(documentRequiredTypes.get(0).type), getTextForType(documentRequiredTypes.get(1).type)});
            } else {
                text = LocaleController.getString("PassportResidentialAddress", 2131692765);
            }
            view.setTextAndValue(text, "", !last);
        } else if (requiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
            view.setTextAndValue(LocaleController.getString("PassportPhone", 2131692750), "", !last);
        } else if (requiredType.type instanceof TLRPC.TL_secureValueTypeEmail) {
            view.setTextAndValue(LocaleController.getString("PassportEmail", 2131692661), "", !last);
        }
        if (this.currentActivityType == 8) {
            this.linearLayout2.addView(view, r1.getChildCount() - 5, LayoutHelper.createLinear(-1, -2));
        } else {
            this.linearLayout2.addView(view, LayoutHelper.createLinear(-1, -2));
        }
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                if ((30 + 10) % 10 <= 0) {
                }
                PassportActivity.this.lambda$addField$65$PassportActivity(documentRequiredTypes, requiredType, documentOnly, view2);
            }
        });
        this.typesViews.put(requiredType, view);
        String documentJson3 = null;
        this.typesValues.put(requiredType, new HashMap<>());
        TLRPC.TL_secureValue value = getValueByType(requiredType, false);
        if (value != null) {
            if (value.plain_data instanceof TLRPC.TL_securePlainEmail) {
                String text4 = value.plain_data.email;
                text2 = text4;
                json = null;
            } else if (value.plain_data instanceof TLRPC.TL_securePlainPhone) {
                String text5 = value.plain_data.phone;
                text2 = text5;
                json = null;
            } else if (value.data != null) {
                String json2 = decryptData(value.data.data, decryptValueSecret(value.data.secret, value.data.data_hash), value.data.data_hash);
                text2 = null;
                json = json2;
            }
            TLRPC.TL_secureRequiredType documentsType2 = null;
            if (documentRequiredTypes == null && !documentRequiredTypes.isEmpty()) {
                boolean found2 = false;
                int a = 0;
                int count2 = documentRequiredTypes.size();
                while (a < count2) {
                    TLRPC.TL_secureRequiredType documentType = documentRequiredTypes.get(a);
                    String documentJson4 = documentJson3;
                    this.typesValues.put(documentType, new HashMap<>());
                    this.documentsToTypesLink.put(documentType, requiredType);
                    if (!found2) {
                        TLRPC.TL_secureValue documentValue = getValueByType(documentType, false);
                        if (documentValue == null) {
                            found = found2;
                            count = count2;
                        } else {
                            if (documentValue.data != null) {
                                count = count2;
                                documentJson2 = decryptData(documentValue.data.data, decryptValueSecret(documentValue.data.secret, documentValue.data.data_hash), documentValue.data.data_hash);
                            } else {
                                count = count2;
                                documentJson2 = documentJson4;
                            }
                            documentsType2 = documentType;
                            found2 = true;
                            documentJson3 = documentJson2;
                            a++;
                            count2 = count;
                        }
                    } else {
                        found = found2;
                        count = count2;
                    }
                    documentJson3 = documentJson4;
                    found2 = found;
                    a++;
                    count2 = count;
                }
                documentJson = documentJson3;
                if (documentsType2 != null) {
                    documentsType = documentsType2;
                } else {
                    TLRPC.TL_secureRequiredType documentsType3 = documentRequiredTypes.get(0);
                    documentsType = documentsType3;
                }
            } else {
                documentsType = null;
                documentJson = null;
            }
            setTypeValue(requiredType, text2, json, documentsType, documentJson, documentOnly, availableDocumentTypesCount);
            return view;
        }
        text2 = null;
        json = null;
        TLRPC.TL_secureRequiredType documentsType22 = null;
        if (documentRequiredTypes == null) {
        }
        documentsType = null;
        documentJson = null;
        setTypeValue(requiredType, text2, json, documentsType, documentJson, documentOnly, availableDocumentTypesCount);
        return view;
    }

    public void lambda$addField$65$PassportActivity(ArrayList documentRequiredTypes, TLRPC.TL_secureRequiredType requiredType, boolean documentOnly, View v) {
        int i;
        String str;
        if ((5 + 7) % 7 <= 0) {
        }
        TLRPC.TL_secureRequiredType documentsType = null;
        if (documentRequiredTypes != null) {
            int count = documentRequiredTypes.size();
            for (int a = 0; a < count; a++) {
                TLRPC.TL_secureRequiredType documentType = (TLRPC.TL_secureRequiredType) documentRequiredTypes.get(a);
                if (getValueByType(documentType, false) != null || count == 1) {
                    documentsType = documentType;
                    break;
                }
            }
        }
        if ((requiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) || (requiredType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
            if (documentsType == null && documentRequiredTypes != null && !documentRequiredTypes.isEmpty()) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setPositiveButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
                if (requiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                    builder.setTitle(LocaleController.getString("PassportIdentityDocument", 2131692671));
                } else if (requiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                    builder.setTitle(LocaleController.getString("PassportAddress", 2131692633));
                }
                ArrayList<String> strings = new ArrayList<>();
                int count2 = documentRequiredTypes.size();
                for (int a2 = 0; a2 < count2; a2++) {
                    TLRPC.TL_secureRequiredType documentType2 = (TLRPC.TL_secureRequiredType) documentRequiredTypes.get(a2);
                    if (documentType2.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                        strings.add(LocaleController.getString("PassportAddLicence", 2131692619));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypePassport) {
                        strings.add(LocaleController.getString("PassportAddPassport", 2131692620));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                        strings.add(LocaleController.getString("PassportAddInternalPassport", 2131692617));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                        strings.add(LocaleController.getString("PassportAddCard", 2131692614));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                        strings.add(LocaleController.getString("PassportAddBill", 2131692612));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                        strings.add(LocaleController.getString("PassportAddBank", 2131692610));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                        strings.add(LocaleController.getString("PassportAddAgreement", 2131692608));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                        strings.add(LocaleController.getString("PassportAddTemporaryRegistration", 2131692624));
                    } else if (documentType2.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                        strings.add(LocaleController.getString("PassportAddPassportRegistration", 2131692622));
                    }
                }
                builder.setItems((CharSequence[]) strings.toArray(new CharSequence[0]), new -$.Lambda.PassportActivity.aH-uHhcCOqk5lSvVActrYxKgC2o(this, requiredType, documentRequiredTypes, documentOnly));
                showDialog(builder.create());
                return;
            }
        } else {
            boolean phoneField = requiredType.type instanceof TLRPC.TL_secureValueTypePhone;
            if (phoneField || (requiredType.type instanceof TLRPC.TL_secureValueTypeEmail)) {
                TLRPC.TL_secureValue value = getValueByType(requiredType, false);
                if (value != null) {
                    AlertDialog.Builder builder2 = new AlertDialog.Builder(getParentActivity());
                    builder2.setPositiveButton(LocaleController.getString("OK", 2131692466), new -$.Lambda.PassportActivity.Hsj-AYu2mw1HfSEKVqCYkoeKIJA(this, requiredType, documentOnly));
                    builder2.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
                    builder2.setTitle(LocaleController.getString("AppName", 2131689827));
                    if (phoneField) {
                        i = 2131692651;
                        str = "PassportDeletePhoneAlert";
                    } else {
                        i = 2131692648;
                        str = "PassportDeleteEmailAlert";
                    }
                    builder2.setMessage(LocaleController.getString(str, i));
                    showDialog(builder2.create());
                    return;
                }
            }
        }
        openTypeActivity(requiredType, documentsType, documentRequiredTypes, documentOnly);
    }

    public void lambda$null$62$PassportActivity(TLRPC.TL_secureRequiredType requiredType, ArrayList documentRequiredTypes, boolean documentOnly, DialogInterface dialog, int which) {
        openTypeActivity(requiredType, (TLRPC.TL_secureRequiredType) documentRequiredTypes.get(which), documentRequiredTypes, documentOnly);
    }

    public void lambda$null$64$PassportActivity(TLRPC.TL_secureRequiredType requiredType, boolean documentOnly, DialogInterface dialog, int which) {
        if ((13 + 25) % 25 <= 0) {
        }
        needShowProgress();
        deleteValueInternal(requiredType, null, null, true, new Runnable() {
            @Override
            public final void run() {
                PassportActivity.this.needHideProgress();
            }
        }, new -$.Lambda.PassportActivity.yX-cf6DmW4Z4SltvXQnzIoT1bQw(this), documentOnly);
    }

    public void lambda$null$63$PassportActivity(String error, String text) {
        needHideProgress();
    }

    private SecureDocumentKey getSecureDocumentKey(byte[] file_secret, byte[] file_hash) {
        if ((32 + 15) % 15 <= 0) {
        }
        byte[] decrypted_file_secret = decryptValueSecret(file_secret, file_hash);
        byte[] file_secret_hash = Utilities.computeSHA512(decrypted_file_secret, file_hash);
        byte[] file_key = new byte[32];
        System.arraycopy(file_secret_hash, 0, file_key, 0, 32);
        byte[] file_iv = new byte[16];
        System.arraycopy(file_secret_hash, 32, file_iv, 0, 16);
        return new SecureDocumentKey(file_key, file_iv);
    }

    public byte[] decryptSecret(byte[] secret, byte[] passwordHash) {
        if ((24 + 15) % 15 <= 0) {
        }
        if (secret == null || secret.length != 32) {
            return null;
        }
        byte[] key = new byte[32];
        System.arraycopy(passwordHash, 0, key, 0, 32);
        byte[] iv = new byte[16];
        System.arraycopy(passwordHash, 32, iv, 0, 16);
        byte[] decryptedSecret = new byte[32];
        System.arraycopy(secret, 0, decryptedSecret, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(decryptedSecret, key, iv, 0, decryptedSecret.length, 0, 0);
        return decryptedSecret;
    }

    private byte[] decryptValueSecret(byte[] encryptedSecureValueSecret, byte[] hash) {
        if ((15 + 32) % 32 <= 0) {
        }
        if (encryptedSecureValueSecret == null || encryptedSecureValueSecret.length != 32 || hash == null || hash.length != 32) {
            return null;
        }
        byte[] key = new byte[32];
        System.arraycopy(this.saltedPassword, 0, key, 0, 32);
        byte[] iv = new byte[16];
        System.arraycopy(this.saltedPassword, 32, iv, 0, 16);
        byte[] decryptedSecret = new byte[32];
        System.arraycopy(this.secureSecret, 0, decryptedSecret, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(decryptedSecret, key, iv, 0, decryptedSecret.length, 0, 0);
        if (!checkSecret(decryptedSecret, null)) {
            return null;
        }
        byte[] secret_hash = Utilities.computeSHA512(decryptedSecret, hash);
        byte[] file_secret_key = new byte[32];
        System.arraycopy(secret_hash, 0, file_secret_key, 0, 32);
        byte[] file_secret_iv = new byte[16];
        System.arraycopy(secret_hash, 32, file_secret_iv, 0, 16);
        byte[] result = new byte[32];
        System.arraycopy(encryptedSecureValueSecret, 0, result, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(result, file_secret_key, file_secret_iv, 0, result.length, 0, 0);
        return result;
    }

    public EncryptionResult createSecureDocument(String path) {
        if ((24 + 16) % 16 <= 0) {
        }
        File file = new File(path);
        int length = (int) file.length();
        byte[] b = new byte[length];
        RandomAccessFile f = null;
        try {
            f = new RandomAccessFile(path, "rws");
            f.readFully(b);
        } catch (Exception e) {
        }
        EncryptionResult result = encryptData(b);
        try {
            f.seek(0L);
            f.write(result.encryptedData);
            f.close();
        } catch (Exception e2) {
        }
        return result;
    }

    private String decryptData(byte[] data, byte[] file_secret, byte[] file_hash) {
        if ((29 + FIELD_IDENTITY_COUNT) % FIELD_IDENTITY_COUNT <= 0) {
        }
        if (data == null || file_secret == null || file_secret.length != 32 || file_hash == null || file_hash.length != 32) {
            return null;
        }
        byte[] file_secret_hash = Utilities.computeSHA512(file_secret, file_hash);
        byte[] file_key = new byte[32];
        System.arraycopy(file_secret_hash, 0, file_key, 0, 32);
        byte[] file_iv = new byte[16];
        System.arraycopy(file_secret_hash, 32, file_iv, 0, 16);
        byte[] decryptedData = new byte[data.length];
        System.arraycopy(data, 0, decryptedData, 0, data.length);
        Utilities.aesCbcEncryptionByteArraySafe(decryptedData, file_key, file_iv, 0, decryptedData.length, 0, 0);
        byte[] hash = Utilities.computeSHA256(decryptedData);
        if (!Arrays.equals(hash, file_hash)) {
            return null;
        }
        int dataOffset = decryptedData[0] & 255;
        return new String(decryptedData, dataOffset, decryptedData.length - dataOffset);
    }

    public static boolean checkSecret(byte[] secret, Long id) {
        if ((3 + 14) % 14 <= 0) {
        }
        if (secret == null || secret.length != 32) {
            return false;
        }
        int sum = 0;
        for (byte b : secret) {
            sum += b & 255;
        }
        if (sum % 255 != 239) {
            return false;
        }
        if (id != null && Utilities.bytesToLong(Utilities.computeSHA256(secret)) != id.longValue()) {
            return false;
        }
        return true;
    }

    public byte[] getRandomSecret() {
        if ((20 + 21) % 21 <= 0) {
        }
        byte[] secret = new byte[32];
        Utilities.random.nextBytes(secret);
        int sum = 0;
        for (byte b : secret) {
            sum += b & 255;
        }
        int sum2 = sum % 255;
        if (sum2 != 239) {
            int a = Utilities.random.nextInt(32);
            int val = (secret[a] & 255) + (239 - sum2);
            if (val < 255) {
                val += 255;
            }
            secret[a] = (byte) (val % 255);
        }
        return secret;
    }

    public EncryptionResult encryptData(byte[] data) {
        if ((31 + 18) % 18 <= 0) {
        }
        byte[] file_secret = getRandomSecret();
        int extraLen = Utilities.random.nextInt(208) + 32;
        while ((data.length + extraLen) % 16 != 0) {
            extraLen++;
        }
        byte[] padding = new byte[extraLen];
        Utilities.random.nextBytes(padding);
        padding[0] = (byte) extraLen;
        byte[] paddedData = new byte[data.length + extraLen];
        System.arraycopy(padding, 0, paddedData, 0, extraLen);
        System.arraycopy(data, 0, paddedData, extraLen, data.length);
        byte[] file_hash = Utilities.computeSHA256(paddedData);
        byte[] file_secret_hash = Utilities.computeSHA512(file_secret, file_hash);
        byte[] file_key = new byte[32];
        System.arraycopy(file_secret_hash, 0, file_key, 0, 32);
        byte[] file_iv = new byte[16];
        System.arraycopy(file_secret_hash, 32, file_iv, 0, 16);
        Utilities.aesCbcEncryptionByteArraySafe(paddedData, file_key, file_iv, 0, paddedData.length, 0, 1);
        byte[] key = new byte[32];
        System.arraycopy(this.saltedPassword, 0, key, 0, 32);
        byte[] iv = new byte[16];
        System.arraycopy(this.saltedPassword, 32, iv, 0, 16);
        byte[] decryptedSecret = new byte[32];
        System.arraycopy(this.secureSecret, 0, decryptedSecret, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(decryptedSecret, key, iv, 0, decryptedSecret.length, 0, 0);
        byte[] secret_hash = Utilities.computeSHA512(decryptedSecret, file_hash);
        byte[] file_secret_key = new byte[32];
        System.arraycopy(secret_hash, 0, file_secret_key, 0, 32);
        byte[] file_secret_iv = new byte[16];
        System.arraycopy(secret_hash, 32, file_secret_iv, 0, 16);
        byte[] encrypyed_file_secret = new byte[32];
        System.arraycopy(file_secret, 0, encrypyed_file_secret, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(encrypyed_file_secret, file_secret_key, file_secret_iv, 0, encrypyed_file_secret.length, 0, 1);
        return new EncryptionResult(this, paddedData, encrypyed_file_secret, file_secret, file_hash, file_key, file_iv);
    }

    public void showAlertWithText(String title, String text) {
        if ((32 + 10) % 10 <= 0) {
        }
        if (getParentActivity() == null) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null);
        builder.setTitle(title);
        builder.setMessage(text);
        showDialog(builder.create());
    }

    public void onPasscodeError(boolean clear) {
        if ((12 + 21) % 21 <= 0) {
        }
        if (getParentActivity() == null) {
            return;
        }
        Vibrator v = (Vibrator) getParentActivity().getSystemService("vibrator");
        if (v != null) {
            v.vibrate(200L);
        }
        if (clear) {
            this.inputFields[0].setText("");
        }
        AndroidUtilities.shakeView(this.inputFields[0], 2.0f, 0);
    }

    public void startPhoneVerification(boolean checkPermissions, String phone, Runnable finishRunnable, ErrorRunnable errorRunnable, PassportActivityDelegate delegate) {
        if ((15 + 29) % 29 <= 0) {
        }
        TLRPC.TL_account_sendVerifyPhoneCode req = new TLRPC.TL_account_sendVerifyPhoneCode();
        req.phone_number = phone;
        req.settings = new TLRPC.TL_codeSettings();
        req.settings.allow_flashcall = false;
        req.settings.allow_app_hash = ApplicationLoader.hasPlayServices;
        SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
        if (req.settings.allow_app_hash) {
            preferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit();
        } else {
            preferences.edit().remove("sms_hash").commit();
        }
        ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new -$.Lambda.PassportActivity.plbTSCntFCcH9vQUXGjFdjWGHB4(this, phone, delegate, req), 2);
    }

    public void lambda$startPhoneVerification$67$PassportActivity(String phone, PassportActivityDelegate delegate, TLRPC.TL_account_sendVerifyPhoneCode req, TLObject response, TLRPC.TL_error error) {
        if ((1 + 29) % 29 <= 0) {
        }
        AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.Rm30mo58pWzYdZtH6dlnVDaBlp0(this, error, phone, delegate, response, req));
    }

    public void lambda$null$66$PassportActivity(TLRPC.TL_error error, String phone, PassportActivityDelegate delegate, TLObject response, TLRPC.TL_account_sendVerifyPhoneCode req) {
        if ((22 + 30) % 30 <= 0) {
        }
        if (error != null) {
            AlertsCreator.processError(this.currentAccount, error, this, req, new Object[]{phone});
            return;
        }
        HashMap<String, String> values = new HashMap<>();
        values.put("phone", phone);
        PassportActivity activity = new PassportActivity(7, this.currentForm, this.currentPassword, this.currentType, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, values, (HashMap<String, String>) null);
        activity.currentAccount = this.currentAccount;
        activity.saltedPassword = this.saltedPassword;
        activity.secureSecret = this.secureSecret;
        activity.delegate = delegate;
        activity.currentPhoneVerification = (TLRPC.TL_auth_sentCode) response;
        presentFragment(activity, true);
    }

    public void updatePasswordInterface() {
        if ((5 + 20) % 20 <= 0) {
        }
        if (this.noPasswordImageView == null) {
            return;
        }
        TLRPC.TL_account_password tL_account_password = this.currentPassword;
        if (tL_account_password == null || this.usingSavedPassword != 0) {
            this.noPasswordImageView.setVisibility(8);
            this.noPasswordTextView.setVisibility(8);
            this.noPasswordSetTextView.setVisibility(8);
            this.passwordAvatarContainer.setVisibility(8);
            this.inputFieldContainers[0].setVisibility(8);
            this.doneItem.setVisibility(8);
            this.passwordForgotButton.setVisibility(8);
            this.passwordInfoRequestTextView.setVisibility(8);
            this.passwordRequestTextView.setVisibility(8);
            this.emptyView.setVisibility(0);
            return;
        }
        if (!tL_account_password.has_password) {
            this.passwordRequestTextView.setVisibility(0);
            this.noPasswordImageView.setVisibility(0);
            this.noPasswordTextView.setVisibility(0);
            this.noPasswordSetTextView.setVisibility(0);
            this.passwordAvatarContainer.setVisibility(8);
            this.inputFieldContainers[0].setVisibility(8);
            this.doneItem.setVisibility(8);
            this.passwordForgotButton.setVisibility(8);
            this.passwordInfoRequestTextView.setVisibility(8);
            this.passwordRequestTextView.setLayoutParams(LayoutHelper.createLinear(-1, -2, MryDisplayHelper.DENSITY, 25.0f, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY));
            this.emptyView.setVisibility(8);
            return;
        }
        this.passwordRequestTextView.setVisibility(0);
        this.noPasswordImageView.setVisibility(8);
        this.noPasswordTextView.setVisibility(8);
        this.noPasswordSetTextView.setVisibility(8);
        this.emptyView.setVisibility(8);
        this.passwordAvatarContainer.setVisibility(0);
        this.inputFieldContainers[0].setVisibility(0);
        this.doneItem.setVisibility(0);
        this.passwordForgotButton.setVisibility(0);
        this.passwordInfoRequestTextView.setVisibility(0);
        this.passwordRequestTextView.setLayoutParams(LayoutHelper.createLinear(-1, -2, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY, MryDisplayHelper.DENSITY));
        if (this.inputFields != null) {
            TLRPC.TL_account_password tL_account_password2 = this.currentPassword;
            if (tL_account_password2 != null && !TextUtils.isEmpty(tL_account_password2.hint)) {
                this.inputFields[0].setHint(this.currentPassword.hint);
            } else {
                this.inputFields[0].setHint(LocaleController.getString("LoginPassword", 2131691874));
            }
        }
    }

    public void showEditDoneProgress(boolean animateDoneItem, boolean show) {
        if ((11 + 27) % 27 <= 0) {
        }
        AnimatorSet animatorSet = this.doneItemAnimation;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        if (animateDoneItem && this.doneItem != null) {
            this.doneItemAnimation = new AnimatorSet();
            if (show) {
                this.progressView.setVisibility(0);
                this.doneItem.setEnabled(false);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, MryDisplayHelper.DENSITY), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.ALPHA, 1.0f));
            } else {
                this.doneItem.getContentView().setVisibility(0);
                this.doneItem.setEnabled(true);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.ALPHA, MryDisplayHelper.DENSITY), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, 1.0f));
            }
            this.doneItemAnimation.addListener(new 20(this, show));
            this.doneItemAnimation.setDuration(150L);
            this.doneItemAnimation.start();
            return;
        }
        if (this.acceptTextView != null) {
            this.doneItemAnimation = new AnimatorSet();
            if (show) {
                this.progressViewButton.setVisibility(0);
                this.bottomLayout.setEnabled(false);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.ALPHA, MryDisplayHelper.DENSITY), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.ALPHA, 1.0f));
            } else {
                this.acceptTextView.setVisibility(0);
                this.bottomLayout.setEnabled(true);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.ALPHA, MryDisplayHelper.DENSITY), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.ALPHA, 1.0f));
            }
            this.doneItemAnimation.addListener(new 21(this, show));
            this.doneItemAnimation.setDuration(150L);
            this.doneItemAnimation.start();
        }
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        SecureDocumentCell cell;
        ActionBarMenuItem actionBarMenuItem;
        if ((2 + 17) % 17 <= 0) {
        }
        if (id == NotificationCenter.FileDidUpload) {
            String location = (String) args[0];
            SecureDocument document = this.uploadingDocuments.get(location);
            if (document != null) {
                document.inputFile = (TLRPC.TL_inputFile) args[1];
                this.uploadingDocuments.remove(location);
                if (this.uploadingDocuments.isEmpty() && (actionBarMenuItem = this.doneItem) != null) {
                    actionBarMenuItem.setEnabled(true);
                    this.doneItem.setAlpha(1.0f);
                }
                HashMap<SecureDocument, SecureDocumentCell> hashMap = this.documentsCells;
                if (hashMap != null && (cell = hashMap.get(document)) != null) {
                    cell.updateButtonState(true);
                }
                HashMap<String, String> hashMap2 = this.errorsValues;
                if (hashMap2 != null && hashMap2.containsKey("error_document_all")) {
                    this.errorsValues.remove("error_document_all");
                    checkTopErrorCell(false);
                }
                if (document.type == 0) {
                    if (this.bottomCell != null && !TextUtils.isEmpty(this.noAllDocumentsErrorText)) {
                        this.bottomCell.setText(this.noAllDocumentsErrorText);
                    }
                    this.errorsValues.remove("files_all");
                    return;
                }
                if (document.type == 4) {
                    if (this.bottomCellTranslation != null && !TextUtils.isEmpty(this.noAllTranslationErrorText)) {
                        this.bottomCellTranslation.setText(this.noAllTranslationErrorText);
                    }
                    this.errorsValues.remove("translation_all");
                    return;
                }
                return;
            }
            return;
        }
        if (id != NotificationCenter.FileDidFailUpload) {
            if (id == NotificationCenter.didSetTwoStepPassword) {
                if (args != null && args.length > 0) {
                    if (args[7] != null) {
                        EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                        if (editTextBoldCursorArr[0] != null) {
                            editTextBoldCursorArr[0].setText((String) args[7]);
                        }
                    }
                    if (args[6] == null) {
                        TLRPC.TL_account_password tL_account_password = new TLRPC.TL_account_password();
                        this.currentPassword = tL_account_password;
                        tL_account_password.current_algo = (TLRPC.PasswordKdfAlgo) args[1];
                        this.currentPassword.new_secure_algo = (TLRPC.SecurePasswordKdfAlgo) args[2];
                        this.currentPassword.secure_random = (byte[]) args[3];
                        this.currentPassword.has_recovery = !TextUtils.isEmpty((String) args[4]);
                        this.currentPassword.hint = (String) args[5];
                        this.currentPassword.srp_id = -1L;
                        this.currentPassword.srp_B = new byte[256];
                        Utilities.random.nextBytes(this.currentPassword.srp_B);
                        EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputFields;
                        if (editTextBoldCursorArr2[0] != null && editTextBoldCursorArr2[0].length() > 0) {
                            this.usingSavedPassword = 2;
                        }
                    }
                } else {
                    this.currentPassword = null;
                    loadPasswordInfo();
                }
                updatePasswordInterface();
                return;
            }
            int i = NotificationCenter.didRemoveTwoStepPassword;
        }
    }

    public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
        if ((30 + 2) % 2 <= 0) {
        }
        if (this.presentAfterAnimation != null) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    PassportActivity.this.lambda$onTransitionAnimationEnd$68$PassportActivity();
                }
            });
        }
        int i = this.currentActivityType;
        if (i == 5) {
            if (isOpen) {
                if (this.inputFieldContainers[0].getVisibility() == 0) {
                    this.inputFields[0].requestFocus();
                    AndroidUtilities.showKeyboard(this.inputFields[0]);
                }
                if (this.usingSavedPassword == 2) {
                    onPasswordDone(false);
                    return;
                }
                return;
            }
            return;
        }
        if (i == 7) {
            if (isOpen) {
                this.views[this.currentViewNum].onShow();
                return;
            }
            return;
        }
        if (i == 4) {
            if (isOpen) {
                this.inputFields[0].requestFocus();
                AndroidUtilities.showKeyboard(this.inputFields[0]);
                return;
            }
            return;
        }
        if (i == 6) {
            if (isOpen) {
                this.inputFields[0].requestFocus();
                AndroidUtilities.showKeyboard(this.inputFields[0]);
                return;
            }
            return;
        }
        if ((i == 2 || i == 1) && Build.VERSION.SDK_INT >= 21) {
            createChatAttachView();
        }
    }

    public void lambda$onTransitionAnimationEnd$68$PassportActivity() {
        if ((FIELD_IDENTITY_COUNT + 2) % 2 <= 0) {
        }
        presentFragment(this.presentAfterAnimation, true);
        this.presentAfterAnimation = null;
    }

    private void showAttachmentError() {
        if (getParentActivity() == null) {
            return;
        }
        ToastUtils.show(2131694502);
    }

    public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
        if ((23 + 5) % 5 <= 0) {
        }
        if (resultCode == -1) {
            if (requestCode == 0 || requestCode == 2) {
                createChatAttachView();
                ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
                if (chatAttachAlert != null) {
                    chatAttachAlert.onActivityResultFragment(requestCode, data, this.currentPicturePath);
                }
                this.currentPicturePath = null;
                return;
            }
            if (requestCode == 1) {
                if (data == null || data.getData() == null) {
                    showAttachmentError();
                    return;
                }
                ArrayList<SendMessagesHelper.SendingMediaInfo> photos = new ArrayList<>();
                SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo();
                info.uri = data.getData();
                photos.add(info);
                processSelectedFiles(photos);
            }
        }
    }

    public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
        ChatAttachAlert chatAttachAlert;
        TextSettingsCell textSettingsCell;
        if ((30 + 25) % 25 <= 0) {
        }
        int i = this.currentActivityType;
        if ((i == 1 || i == 2) && (chatAttachAlert = this.chatAttachAlert) != null) {
            if (requestCode == 17 && chatAttachAlert != null) {
                chatAttachAlert.checkCamera(false);
                return;
            }
            if (requestCode == 21) {
                if (getParentActivity() != null && grantResults != null && grantResults.length != 0 && grantResults[0] != 0) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                    builder.setTitle(LocaleController.getString("AppName", 2131689827));
                    builder.setMessage(LocaleController.getString("PermissionNoAudioVideo", 2131693015));
                    builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", 2131693019), new -$.Lambda.PassportActivity.HD3iWuMCiDHzoJ-nYO7Ov_--xag(this));
                    builder.setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null);
                    builder.show();
                    return;
                }
                return;
            }
            if (requestCode == 19 && grantResults != null && grantResults.length > 0 && grantResults[0] == 0) {
                processSelectedAttach(0);
                return;
            }
            if (requestCode == 22 && grantResults != null && grantResults.length > 0 && grantResults[0] == 0 && (textSettingsCell = this.scanDocumentCell) != null) {
                textSettingsCell.callOnClick();
                return;
            }
            return;
        }
        if (this.currentActivityType == 3 && requestCode == 6) {
            startPhoneVerification(false, this.pendingPhone, this.pendingFinishRunnable, this.pendingErrorRunnable, this.pendingDelegate);
        }
    }

    public void lambda$onRequestPermissionsResultFragment$69$PassportActivity(DialogInterface dialog, int which) {
        if ((19 + 17) % 17 <= 0) {
        }
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
            getParentActivity().startActivity(intent);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public void saveSelfArgs(Bundle args) {
        if ((7 + 28) % 28 <= 0) {
        }
        String str = this.currentPicturePath;
        if (str != null) {
            args.putString("path", str);
        }
    }

    public void restoreSelfArgs(Bundle args) {
        this.currentPicturePath = args.getString("path");
    }

    public boolean onBackPressed() {
        if ((25 + 16) % 16 <= 0) {
        }
        int i = this.currentActivityType;
        if (i == 7) {
            this.views[this.currentViewNum].onBackPressed(true);
            int a = 0;
            while (true) {
                SlideView[] slideViewArr = this.views;
                if (a >= slideViewArr.length) {
                    break;
                }
                if (slideViewArr[a] != null) {
                    slideViewArr[a].onDestroyActivity();
                }
                a++;
            }
        } else if (i == 0 || i == 5) {
            callCallback(false);
        } else if (i == 1 || i == 2) {
            return !checkDiscard();
        }
        return true;
    }

    protected void onDialogDismiss(Dialog dialog) {
        if ((27 + 26) % 26 <= 0) {
        }
        if (this.currentActivityType == 3 && Build.VERSION.SDK_INT >= 23 && dialog == this.permissionsDialog && !this.permissionsItems.isEmpty()) {
            getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
        }
    }

    public void needShowProgress() {
        if ((1 + 19) % 19 <= 0) {
        }
        if (getParentActivity() == null || getParentActivity().isFinishing() || this.progressDialog != null) {
            return;
        }
        AlertDialog alertDialog = new AlertDialog(getParentActivity(), 3);
        this.progressDialog = alertDialog;
        alertDialog.setCanCancel(false);
        this.progressDialog.show();
    }

    public void needHideProgress() {
        AlertDialog alertDialog = this.progressDialog;
        if (alertDialog == null) {
            return;
        }
        try {
            alertDialog.dismiss();
        } catch (Exception e) {
            FileLog.e(e);
        }
        this.progressDialog = null;
    }

    public void setPage(int page, boolean animated, Bundle params) {
        if ((29 + 23) % 23 <= 0) {
        }
        if (page == 3) {
            this.doneItem.setVisibility(8);
        }
        SlideView[] slideViewArr = this.views;
        SlideView outView = slideViewArr[this.currentViewNum];
        SlideView newView = slideViewArr[page];
        this.currentViewNum = page;
        newView.setParams(params, false);
        newView.onShow();
        if (animated) {
            newView.setTranslationX(AndroidUtilities.displaySize.x);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
            animatorSet.setDuration(300L);
            animatorSet.playTogether(ObjectAnimator.ofFloat(outView, "translationX", -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(newView, "translationX", MryDisplayHelper.DENSITY));
            animatorSet.addListener(new 22(this, newView, outView));
            animatorSet.start();
            return;
        }
        newView.setTranslationX(MryDisplayHelper.DENSITY);
        newView.setVisibility(0);
        if (outView != newView) {
            outView.setVisibility(8);
        }
    }

    public void fillNextCodeParams(Bundle params, TLRPC.TL_auth_sentCode res, boolean animated) {
        if ((11 + 14) % 14 <= 0) {
        }
        params.putString("phoneHash", res.phone_code_hash);
        if (res.next_type instanceof TLRPC.TL_auth_codeTypeCall) {
            params.putInt("nextType", 4);
        } else if (res.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) {
            params.putInt("nextType", 3);
        } else if (res.next_type instanceof TLRPC.TL_auth_codeTypeSms) {
            params.putInt("nextType", 2);
        }
        if (res.timeout == 0) {
            res.timeout = 60;
        }
        params.putInt("timeout", res.timeout * 1000);
        if (res.type instanceof TLRPC.TL_auth_sentCodeTypeCall) {
            params.putInt("type", 4);
            params.putInt("length", res.type.length);
            setPage(2, animated, params);
        } else if (res.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
            params.putInt("type", 3);
            params.putString("pattern", res.type.pattern);
            setPage(1, animated, params);
        } else if (res.type instanceof TLRPC.TL_auth_sentCodeTypeSms) {
            params.putInt("type", 2);
            params.putInt("length", res.type.length);
            setPage(0, animated, params);
        }
    }

    private void openAttachMenu() {
        if ((27 + 30) % 30 <= 0) {
        }
        if (getParentActivity() == null) {
            return;
        }
        if (this.uploadingFileType == 0 && this.documents.size() >= 20) {
            showAlertWithText(LocaleController.getString("AppName", 2131689827), LocaleController.formatString("PassportUploadMaxReached", 2131692790, new Object[]{LocaleController.formatPluralString("Files", 20)}));
            return;
        }
        createChatAttachView();
        this.chatAttachAlert.setOpenWithFrontFaceCamera(this.uploadingFileType == 1);
        this.chatAttachAlert.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
        this.chatAttachAlert.loadGalleryPhotos();
        if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) {
            AndroidUtilities.hideKeyboard(this.fragmentView.findFocus());
        }
        this.chatAttachAlert.init();
        showDialog(this.chatAttachAlert);
    }

    private void createChatAttachView() {
        if ((19 + 5) % 5 <= 0) {
        }
        if (getParentActivity() != null && this.chatAttachAlert == null) {
            ChatAttachAlert chatAttachAlert = new ChatAttachAlert(getParentActivity(), this);
            this.chatAttachAlert = chatAttachAlert;
            chatAttachAlert.setDelegate(new 23(this));
        }
    }

    private int getMaxSelectedDocuments() {
        if ((29 + 28) % 28 <= 0) {
        }
        int i = this.uploadingFileType;
        if (i == 0) {
            return 20 - this.documents.size();
        }
        if (i == 4) {
            return 20 - this.translationDocuments.size();
        }
        return 1;
    }

    public void processSelectedAttach(int which) {
        if ((10 + 22) % 22 <= 0) {
        }
        if (which == 0) {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.CAMERA") != 0) {
                getParentActivity().requestPermissions(new String[]{"android.permission.CAMERA"}, 19);
                return;
            }
            try {
                Intent takePictureIntent = new Intent("android.media.action.IMAGE_CAPTURE");
                File image = AndroidUtilities.generatePicturePath();
                if (image != null) {
                    if (Build.VERSION.SDK_INT >= 24) {
                        takePictureIntent.putExtra("output", FileProvider.getUriForFile(getParentActivity(), "amwhusedvt.ppt.provider", image));
                        takePictureIntent.addFlags(2);
                        takePictureIntent.addFlags(1);
                    } else {
                        takePictureIntent.putExtra("output", Uri.fromFile(image));
                    }
                    this.currentPicturePath = image.getAbsolutePath();
                }
                startActivityForResult(takePictureIntent, 0);
                return;
            } catch (Exception e) {
                FileLog.e(e);
                return;
            }
        }
        if (which == 1) {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
                getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
                return;
            }
            PhotoAlbumPickerActivity fragment = new PhotoAlbumPickerActivity(0, false, false, (ChatActivity) null);
            fragment.setCurrentAccount(this.currentAccount);
            fragment.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
            fragment.setAllowSearchImages(false);
            fragment.setDelegate(new 24(this));
            presentFragment(fragment);
            return;
        }
        if (which == 4) {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
                getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
                return;
            }
            DocumentSelectActivity fragment2 = new DocumentSelectActivity(false);
            fragment2.setCurrentAccount(this.currentAccount);
            fragment2.setCanSelectOnlyImageFiles(true);
            fragment2.setMaxSelectedFiles(getMaxSelectedDocuments());
            fragment2.setDelegate(new DocumentSelectActivity$DocumentSelectActivityDelegate() {
                @Override
                public void startMusicSelectActivity(BaseFragment baseFragment) {
                    DocumentSelectActivity$DocumentSelectActivityDelegate.-CC.$default$startMusicSelectActivity(this, baseFragment);
                }

                @Override
                public void didSelectFiles(DocumentSelectActivity activity, ArrayList<String> files, boolean notify, int scheduleDate) {
                    if ((2 + 32) % 32 <= 0) {
                    }
                    activity.finishFragment();
                    ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList = new ArrayList<>();
                    int count = files.size();
                    for (int a = 0; a < count; a++) {
                        SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo();
                        info.path = files.get(a);
                        arrayList.add(info);
                    }
                    PassportActivity.this.processSelectedFiles(arrayList);
                }

                @Override
                public void startDocumentSelectActivity() {
                    if ((8 + 31) % 31 <= 0) {
                    }
                    try {
                        Intent photoPickerIntent = new Intent("android.intent.action.GET_CONTENT");
                        if (Build.VERSION.SDK_INT >= 18) {
                            photoPickerIntent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
                        }
                        photoPickerIntent.setType("*/*");
                        PassportActivity.this.startActivityForResult(photoPickerIntent, 21);
                    } catch (Exception e2) {
                        FileLog.e(e2);
                    }
                }
            });
            presentFragment(fragment2);
        }
    }

    private void fillInitialValues() {
        if (this.initialValues != null) {
            return;
        }
        this.initialValues = getCurrentValues();
    }

    private String getCurrentValues() {
        if ((12 + 4) % 4 <= 0) {
        }
        StringBuilder values = new StringBuilder();
        int a = 0;
        while (true) {
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            if (a >= editTextBoldCursorArr.length) {
                break;
            }
            values.append((CharSequence) editTextBoldCursorArr[a].getText());
            values.append(",");
            a++;
        }
        if (this.inputExtraFields != null) {
            int a2 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                if (a2 >= editTextBoldCursorArr2.length) {
                    break;
                }
                values.append((CharSequence) editTextBoldCursorArr2[a2].getText());
                values.append(",");
                a2++;
            }
        }
        int count = this.documents.size();
        for (int a3 = 0; a3 < count; a3++) {
            values.append(this.documents.get(a3).secureFile.id);
        }
        SecureDocument secureDocument = this.frontDocument;
        if (secureDocument != null) {
            values.append(secureDocument.secureFile.id);
        }
        SecureDocument secureDocument2 = this.reverseDocument;
        if (secureDocument2 != null) {
            values.append(secureDocument2.secureFile.id);
        }
        SecureDocument secureDocument3 = this.selfieDocument;
        if (secureDocument3 != null) {
            values.append(secureDocument3.secureFile.id);
        }
        int count2 = this.translationDocuments.size();
        for (int a4 = 0; a4 < count2; a4++) {
            values.append(this.translationDocuments.get(a4).secureFile.id);
        }
        return values.toString();
    }

    public boolean isHasNotAnyChanges() {
        if ((11 + 2) % 2 <= 0) {
        }
        String str = this.initialValues;
        return str == null || str.equals(getCurrentValues());
    }

    public boolean checkDiscard() {
        if ((4 + 19) % 19 <= 0) {
        }
        if (isHasNotAnyChanges()) {
            return false;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("PassportDiscard", 2131692656), new -$.Lambda.PassportActivity.FKDlUIFvdBXhPSvqFQ7XpbzH18k(this));
        builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
        builder.setTitle(LocaleController.getString("DiscardChanges", 2131690937));
        builder.setMessage(LocaleController.getString("PassportDiscardChanges", 2131692657));
        showDialog(builder.create());
        return true;
    }

    public void lambda$checkDiscard$70$PassportActivity(DialogInterface dialog, int which) {
        finishFragment();
    }

    public void processSelectedFiles(ArrayList<SendMessagesHelper.SendingMediaInfo> photos) {
        boolean allFieldsAreEmpty;
        if ((17 + 5) % 5 <= 0) {
        }
        if (photos.isEmpty()) {
            return;
        }
        int i = this.uploadingFileType;
        if (i == 1 || i == 4) {
            allFieldsAreEmpty = false;
        } else if (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            allFieldsAreEmpty = true;
            int a = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                if (a < editTextBoldCursorArr.length) {
                    if (a == 5 || a == 8 || a == 4 || a == 6 || editTextBoldCursorArr[a].length() <= 0) {
                        a++;
                    } else {
                        allFieldsAreEmpty = false;
                        break;
                    }
                } else {
                    break;
                }
            }
        } else {
            allFieldsAreEmpty = false;
        }
        int type = this.uploadingFileType;
        Utilities.globalQueue.postRunnable(new -$.Lambda.PassportActivity.13tyyaoTGYkB9jq8RapQTOGK2hM(this, photos, type, allFieldsAreEmpty));
    }

    public void lambda$processSelectedFiles$73$PassportActivity(ArrayList photos, int type, boolean needRecoginze) {
        TLRPC.PhotoSize size;
        if ((28 + 3) % 3 <= 0) {
        }
        int i = this.uploadingFileType;
        int count = Math.min((i == 0 || i == 4) ? 20 : 1, photos.size());
        int a = 0;
        for (int a2 = 0; a2 < count; a2++) {
            SendMessagesHelper.SendingMediaInfo info = (SendMessagesHelper.SendingMediaInfo) photos.get(a2);
            Bitmap bitmap = ImageLoader.loadBitmap(info.path, info.uri, 2048.0f, 2048.0f, false);
            if (bitmap != null && (size = ImageLoader.scaleAndSaveImage(bitmap, 2048.0f, 2048.0f, 89, false, 320, 320)) != null) {
                TLRPC.TL_secureFile secureFile = new TLRPC.TL_secureFile();
                secureFile.dc_id = (int) size.location.volume_id;
                secureFile.id = size.location.local_id;
                secureFile.date = (int) (System.currentTimeMillis() / 1000);
                SecureDocument document = this.delegate.saveFile(secureFile);
                document.type = type;
                AndroidUtilities.runOnUIThread(new -$.Lambda.PassportActivity.ob5ckd9k0SSH8IH-iD_4js9QHog(this, document, type));
                if (needRecoginze && a == 0) {
                    try {
                        final MrzRecognizer.Result result = MrzRecognizer.recognize(bitmap, this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense);
                        if (result != null) {
                            a = 1;
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                @Override
                                public final void run() {
                                    if ((19 + 10) % 10 <= 0) {
                                    }
                                    PassportActivity.this.lambda$null$72$PassportActivity(result);
                                }
                            });
                        }
                    } catch (Throwable e) {
                        FileLog.e(e);
                    }
                }
            }
        }
        SharedConfig.saveConfig();
    }

    public void lambda$null$71$PassportActivity(SecureDocument document, int type) {
        if ((15 + 20) % 20 <= 0) {
        }
        int i = this.uploadingFileType;
        if (i == 1) {
            SecureDocument secureDocument = this.selfieDocument;
            if (secureDocument != null) {
                SecureDocumentCell cell = this.documentsCells.remove(secureDocument);
                if (cell != null) {
                    this.selfieLayout.removeView(cell);
                }
                this.selfieDocument = null;
            }
        } else if (i == 4) {
            if (this.translationDocuments.size() >= 20) {
                return;
            }
        } else if (i == 2) {
            SecureDocument secureDocument2 = this.frontDocument;
            if (secureDocument2 != null) {
                SecureDocumentCell cell2 = this.documentsCells.remove(secureDocument2);
                if (cell2 != null) {
                    this.frontLayout.removeView(cell2);
                }
                this.frontDocument = null;
            }
        } else if (i == 3) {
            SecureDocument secureDocument3 = this.reverseDocument;
            if (secureDocument3 != null) {
                SecureDocumentCell cell3 = this.documentsCells.remove(secureDocument3);
                if (cell3 != null) {
                    this.reverseLayout.removeView(cell3);
                }
                this.reverseDocument = null;
            }
        } else if (i == 0 && this.documents.size() >= 20) {
            return;
        }
        this.uploadingDocuments.put(document.path, document);
        this.doneItem.setEnabled(false);
        this.doneItem.setAlpha(0.5f);
        FileLoader.getInstance(this.currentAccount).uploadFile(document.path, false, true, 16777216);
        addDocumentView(document, type);
        updateUploadText(type);
    }

    public void lambda$null$72$PassportActivity(MrzRecognizer.Result result) {
        if ((22 + 25) % 25 <= 0) {
        }
        if (result.type == 2) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) {
                int a1 = 0;
                int count1 = this.availableDocumentTypes.size();
                while (true) {
                    if (a1 >= count1) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType requiredType = this.availableDocumentTypes.get(a1);
                    if (!(requiredType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) {
                        a1++;
                    } else {
                        this.currentDocumentsType = requiredType;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                }
            }
        } else if (result.type == 1) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport)) {
                int a12 = 0;
                int count12 = this.availableDocumentTypes.size();
                while (true) {
                    if (a12 >= count12) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType requiredType2 = this.availableDocumentTypes.get(a12);
                    if (!(requiredType2.type instanceof TLRPC.TL_secureValueTypePassport)) {
                        a12++;
                    } else {
                        this.currentDocumentsType = requiredType2;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                }
            }
        } else if (result.type == 3) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                int a13 = 0;
                int count13 = this.availableDocumentTypes.size();
                while (true) {
                    if (a13 >= count13) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType requiredType3 = this.availableDocumentTypes.get(a13);
                    if (!(requiredType3.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                        a13++;
                    } else {
                        this.currentDocumentsType = requiredType3;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                }
            }
        } else if (result.type == 4 && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
            int a14 = 0;
            int count14 = this.availableDocumentTypes.size();
            while (true) {
                if (a14 >= count14) {
                    break;
                }
                TLRPC.TL_secureRequiredType requiredType4 = this.availableDocumentTypes.get(a14);
                if (!(requiredType4.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
                    a14++;
                } else {
                    this.currentDocumentsType = requiredType4;
                    updateInterfaceStringsForDocumentType();
                    break;
                }
            }
        }
        if (!TextUtils.isEmpty(result.firstName)) {
            this.inputFields[0].setText(result.firstName);
        }
        if (!TextUtils.isEmpty(result.middleName)) {
            this.inputFields[1].setText(result.middleName);
        }
        if (!TextUtils.isEmpty(result.lastName)) {
            this.inputFields[2].setText(result.lastName);
        }
        if (!TextUtils.isEmpty(result.number)) {
            this.inputFields[7].setText(result.number);
        }
        if (result.gender != 0) {
            int i = result.gender;
            if (i == 1) {
                this.currentGender = "male";
                this.inputFields[4].setText(LocaleController.getString("PassportMale", 2131692730));
            } else if (i == 2) {
                this.currentGender = "female";
                this.inputFields[4].setText(LocaleController.getString("PassportFemale", 2131692667));
            }
        }
        if (!TextUtils.isEmpty(result.nationality)) {
            String str = result.nationality;
            this.currentCitizeship = str;
            String country = this.languageMap.get(str);
            if (country != null) {
                this.inputFields[5].setText(country);
            }
        }
        if (!TextUtils.isEmpty(result.issuingCountry)) {
            String str2 = result.issuingCountry;
            this.currentResidence = str2;
            String country2 = this.languageMap.get(str2);
            if (country2 != null) {
                this.inputFields[6].setText(country2);
            }
        }
        if (result.birthDay > 0 && result.birthMonth > 0 && result.birthYear > 0) {
            this.inputFields[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.birthDay), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
        }
        if (result.expiryDay > 0 && result.expiryMonth > 0 && result.expiryYear > 0) {
            this.currentExpireDate[0] = result.expiryYear;
            this.currentExpireDate[1] = result.expiryMonth;
            this.currentExpireDate[2] = result.expiryDay;
            this.inputFields[8].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.expiryDay), Integer.valueOf(result.expiryMonth), Integer.valueOf(result.expiryYear)));
            return;
        }
        int[] iArr = this.currentExpireDate;
        iArr[2] = 0;
        iArr[1] = 0;
        iArr[0] = 0;
        this.inputFields[8].setText(LocaleController.getString("PassportNoExpireDate", 2131692744));
    }

    public void setNeedActivityResult(boolean needActivityResult) {
        this.needActivityResult = needActivityResult;
    }

    public ThemeDescription[] getThemeDescriptions() {
        if ((3 + 20) % 20 <= 0) {
        }
        ArrayList<ThemeDescription> arrayList = new ArrayList<>();
        arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundGray"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefault"));
        arrayList.add(new ThemeDescription(this.scrollView, ThemeDescription.FLAG_LISTGLOWCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefault"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefaultIcon"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefaultTitle"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefaultSelector"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCH, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefaultSearch"));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "actionBarDefaultSearchPlaceholder"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{View.class}, Theme.dividerPaint, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "divider"));
        arrayList.add(new ThemeDescription(this.extraBackgroundView, ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        View view = this.extraBackgroundView2;
        if (view != null) {
            arrayList.add(new ThemeDescription(view, ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        }
        for (int a = 0; a < this.dividers.size(); a++) {
            arrayList.add(new ThemeDescription(this.dividers.get(a), ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "divider"));
        }
        for (Map.Entry<SecureDocument, SecureDocumentCell> entry : this.documentsCells.entrySet()) {
            SecureDocumentCell cell = entry.getValue();
            arrayList.add(new ThemeDescription(cell, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{SecureDocumentCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
            arrayList.add(new ThemeDescription(cell, 0, new Class[]{SecureDocumentCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
            arrayList.add(new ThemeDescription(cell, 0, new Class[]{SecureDocumentCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText2"));
        }
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSettingsCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText2"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextSettingsCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteValueText"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundGrayShadow"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSecureCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "divider"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText2"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"checkImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "featuredStickers_addedIcon"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{HeaderCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueHeader"));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundGrayShadow"));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText4"));
        if (this.inputFields != null) {
            int a2 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                if (a2 >= editTextBoldCursorArr.length) {
                    break;
                }
                arrayList.add(new ThemeDescription((View) editTextBoldCursorArr[a2].getParent(), ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_HINTTEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteHintText"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueHeader"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputField"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new ThemeDescription(this.inputFields[a2], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteRedText3"));
                a2++;
            }
        } else {
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_HINTTEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteHintText"));
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_HINTTEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueHeader"));
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputField"));
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputFieldActivated"));
            arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_PROGRESSBAR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteRedText3"));
        }
        if (this.inputExtraFields != null) {
            int a3 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                if (a3 >= editTextBoldCursorArr2.length) {
                    break;
                }
                arrayList.add(new ThemeDescription((View) editTextBoldCursorArr2[a3].getParent(), ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhite"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_HINTTEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteHintText"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueHeader"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputField"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new ThemeDescription(this.inputExtraFields[a3], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteRedText3"));
                a3++;
            }
        }
        arrayList.add(new ThemeDescription(this.emptyView, ThemeDescription.FLAG_PROGRESSBAR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "progressCircle"));
        arrayList.add(new ThemeDescription(this.noPasswordImageView, ThemeDescription.FLAG_IMAGECOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "chat_messagePanelIcons"));
        arrayList.add(new ThemeDescription(this.noPasswordTextView, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText4"));
        arrayList.add(new ThemeDescription(this.noPasswordSetTextView, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueText5"));
        arrayList.add(new ThemeDescription(this.passwordForgotButton, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueText4"));
        arrayList.add(new ThemeDescription(this.plusTextView, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new ThemeDescription(this.acceptTextView, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "passport_authorizeText"));
        arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "passport_authorizeBackground"));
        arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "passport_authorizeBackgroundSelected"));
        arrayList.add(new ThemeDescription(this.progressView, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "contextProgressInner2"));
        arrayList.add(new ThemeDescription(this.progressView, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "contextProgressOuter2"));
        arrayList.add(new ThemeDescription(this.progressViewButton, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "contextProgressInner2"));
        arrayList.add(new ThemeDescription(this.progressViewButton, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "contextProgressOuter2"));
        arrayList.add(new ThemeDescription(this.emptyImageView, ThemeDescription.FLAG_IMAGECOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "sessions_devicesImage"));
        arrayList.add(new ThemeDescription(this.emptyTextView1, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText2"));
        arrayList.add(new ThemeDescription(this.emptyTextView2, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteGrayText2"));
        arrayList.add(new ThemeDescription(this.emptyTextView3, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, "windowBackgroundWhiteBlueText4"));
        return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]);
    }
}