盛康基办.apk(点击下载) / PassportActivity.java


package im.guobwnxjuc.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
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.content.pm.PackageInfo;
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.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.util.Base64;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
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 androidx.fragment.app.FragmentActivity;
import com.bjz.comm.net.premission.PermissionUtils;
import com.blankj.utilcode.constant.TimeConstants;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
import com.google.firebase.remoteconfig.RemoteConfigConstants;
import im.guobwnxjuc.messenger.AndroidUtilities;
import im.guobwnxjuc.messenger.ApplicationLoader;
import im.guobwnxjuc.messenger.BuildVars;
import im.guobwnxjuc.messenger.DownloadController;
import im.guobwnxjuc.messenger.FileLoader;
import im.guobwnxjuc.messenger.FileLog;
import im.guobwnxjuc.messenger.ImageLoader;
import im.guobwnxjuc.messenger.ImageLocation;
import im.guobwnxjuc.messenger.LocaleController;
import im.guobwnxjuc.messenger.MediaController;
import im.guobwnxjuc.messenger.MessageObject;
import im.guobwnxjuc.messenger.MrzRecognizer;
import im.guobwnxjuc.messenger.NotificationCenter;
import im.guobwnxjuc.messenger.R;
import im.guobwnxjuc.messenger.SRPHelper;
import im.guobwnxjuc.messenger.SecureDocument;
import im.guobwnxjuc.messenger.SecureDocumentKey;
import im.guobwnxjuc.messenger.SendMessagesHelper;
import im.guobwnxjuc.messenger.SharedConfig;
import im.guobwnxjuc.messenger.UserConfig;
import im.guobwnxjuc.messenger.UserObject;
import im.guobwnxjuc.messenger.Utilities;
import im.guobwnxjuc.messenger.browser.Browser;
import im.guobwnxjuc.phoneformat.PhoneFormat;
import im.guobwnxjuc.tgnet.ConnectionsManager;
import im.guobwnxjuc.tgnet.RequestDelegate;
import im.guobwnxjuc.tgnet.TLObject;
import im.guobwnxjuc.tgnet.TLRPC;
import im.guobwnxjuc.ui.CountrySelectActivity;
import im.guobwnxjuc.ui.DocumentSelectActivity;
import im.guobwnxjuc.ui.MrzCameraActivity;
import im.guobwnxjuc.ui.PassportActivity;
import im.guobwnxjuc.ui.PhotoAlbumPickerActivity;
import im.guobwnxjuc.ui.PhotoViewer;
import im.guobwnxjuc.ui.actionbar.ActionBar;
import im.guobwnxjuc.ui.actionbar.ActionBarMenuItem;
import im.guobwnxjuc.ui.actionbar.AlertDialog;
import im.guobwnxjuc.ui.actionbar.BaseFragment;
import im.guobwnxjuc.ui.actionbar.Theme;
import im.guobwnxjuc.ui.actionbar.ThemeDescription;
import im.guobwnxjuc.ui.cells.CheckBoxCell;
import im.guobwnxjuc.ui.cells.HeaderCell;
import im.guobwnxjuc.ui.cells.ShadowSectionCell;
import im.guobwnxjuc.ui.cells.TextDetailSettingsCell;
import im.guobwnxjuc.ui.cells.TextInfoPrivacyCell;
import im.guobwnxjuc.ui.cells.TextSettingsCell;
import im.guobwnxjuc.ui.components.AlertsCreator;
import im.guobwnxjuc.ui.components.AvatarDrawable;
import im.guobwnxjuc.ui.components.BackupImageView;
import im.guobwnxjuc.ui.components.ChatAttachAlert;
import im.guobwnxjuc.ui.components.ContextProgressView;
import im.guobwnxjuc.ui.components.EditTextBoldCursor;
import im.guobwnxjuc.ui.components.EmptyTextProgressView;
import im.guobwnxjuc.ui.components.HintEditText;
import im.guobwnxjuc.ui.components.LayoutHelper;
import im.guobwnxjuc.ui.components.RadialProgress;
import im.guobwnxjuc.ui.components.SlideView;
import im.guobwnxjuc.ui.components.URLSpanNoUnderline;
import im.guobwnxjuc.ui.components.toast.ToastUtils;
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.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.crypto.Cipher;
import kotlin.UByte;
import kotlin.text.Typography;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Marker;

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;

    /* access modifiers changed from: private */
    public interface ErrorRunnable {
        void onError(String str, String str2);
    }

    /* access modifiers changed from: private */
    public 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);
    }

    public class LinkSpan extends ClickableSpan {
        public LinkSpan() {
        }

        public void updateDrawState(TextPaint textPaint) {
            super.updateDrawState(textPaint);
            textPaint.setUnderlineText(true);
            textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        }

        public void onClick(View view) {
            Browser.openUrl(PassportActivity.this.getParentActivity(), PassportActivity.this.currentForm.privacy_policy_url);
        }
    }

    public class TextDetailSecureCell extends FrameLayout {
        private ImageView checkImageView;
        private boolean needDivider;
        private TextView textView;
        private TextView valueTextView;

        public TextDetailSecureCell(Context context) {
            super(context);
            int i = 21;
            int i2 = PassportActivity.this.currentActivityType == 8 ? 21 : 51;
            TextView textView2 = new TextView(context);
            this.textView = textView2;
            textView2.setTextColor(Theme.getColor(Theme.key_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);
            int i3 = 5;
            this.textView.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
            addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, (float) (LocaleController.isRTL ? i2 : 21), 10.0f, (float) (LocaleController.isRTL ? 21 : i2), 0.0f));
            TextView textView3 = new TextView(context);
            this.valueTextView = textView3;
            textView3.setTextColor(Theme.getColor(Theme.key_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, (float) (LocaleController.isRTL ? i2 : 21), 35.0f, (float) (!LocaleController.isRTL ? i2 : i), 0.0f));
            ImageView imageView = new ImageView(context);
            this.checkImageView = imageView;
            imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.SRC_IN));
            this.checkImageView.setImageResource(R.mipmap.ic_selected);
            addView(this.checkImageView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 3 : i3) | 48, 21.0f, 25.0f, 21.0f, 0.0f));
        }

        /* access modifiers changed from: protected */
        public void onMeasure(int i, int i2) {
            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 str, CharSequence charSequence, boolean z) {
            this.textView.setText(str);
            this.valueTextView.setText(charSequence);
            this.needDivider = z;
            setWillNotDraw(!z);
        }

        public void setChecked(boolean z) {
            this.checkImageView.setVisibility(z ? 0 : 4);
        }

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

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

        /* access modifiers changed from: protected */
        public void onDraw(Canvas canvas) {
            if (this.needDivider) {
                canvas.drawLine(LocaleController.isRTL ? 0.0f : (float) AndroidUtilities.dp(20.0f), (float) (getMeasuredHeight() - 1), (float) (getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0)), (float) (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 = new RadialProgress(this);
        private TextView textView;
        private TextView valueTextView;

        public SecureDocumentCell(Context context) {
            super(context);
            this.TAG = DownloadController.getInstance(PassportActivity.this.currentAccount).generateObserverTag();
            BackupImageView backupImageView = new BackupImageView(context);
            this.imageView = backupImageView;
            int i = 5;
            addView(backupImageView, LayoutHelper.createFrame(48.0f, 48.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 8.0f, 21.0f, 0.0f));
            TextView textView2 = new TextView(context);
            this.textView = textView2;
            textView2.setTextColor(Theme.getColor(Theme.key_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);
            int i2 = 21;
            addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, (float) (LocaleController.isRTL ? 21 : 81), 10.0f, (float) (LocaleController.isRTL ? 81 : 21), 0.0f));
            TextView textView3 = new TextView(context);
            this.valueTextView = textView3;
            textView3.setTextColor(Theme.getColor(Theme.key_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 ? 3 : i) | 48, (float) (LocaleController.isRTL ? 21 : 81), 35.0f, (float) (LocaleController.isRTL ? 81 : i2), 0.0f));
            setWillNotDraw(false);
        }

        /* access modifiers changed from: protected */
        public void onMeasure(int i, int i2) {
            super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + 1, 1073741824));
        }

        /* access modifiers changed from: protected */
        public void onLayout(boolean z, int i, int i2, int i3, int i4) {
            super.onLayout(z, i, i2, i3, i4);
            int left = this.imageView.getLeft() + ((this.imageView.getMeasuredWidth() - AndroidUtilities.dp(24.0f)) / 2);
            int top = this.imageView.getTop() + ((this.imageView.getMeasuredHeight() - AndroidUtilities.dp(24.0f)) / 2);
            this.radialProgress.setProgressRect(left, top, AndroidUtilities.dp(24.0f) + left, AndroidUtilities.dp(24.0f) + top);
        }

        /* access modifiers changed from: protected */
        public boolean drawChild(Canvas canvas, View view, long j) {
            boolean drawChild = super.drawChild(canvas, view, j);
            if (view == this.imageView) {
                this.radialProgress.draw(canvas);
            }
            return drawChild;
        }

        public void setTextAndValueAndImage(String str, CharSequence charSequence, SecureDocument secureDocument) {
            this.textView.setText(str);
            this.valueTextView.setText(charSequence);
            this.imageView.setImage(secureDocument, "48_48");
            this.currentSecureDocument = secureDocument;
            updateButtonState(false);
        }

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

        public void updateButtonState(boolean z) {
            String attachFileName = FileLoader.getAttachFileName(this.currentSecureDocument);
            boolean exists = FileLoader.getPathToAttach(this.currentSecureDocument).exists();
            if (TextUtils.isEmpty(attachFileName)) {
                this.radialProgress.setBackground(null, false, false);
                return;
            }
            float f = 0.0f;
            if (this.currentSecureDocument.path != null) {
                if (this.currentSecureDocument.inputFile != null) {
                    DownloadController.getInstance(PassportActivity.this.currentAccount).removeLoadingFileObserver(this);
                    this.radialProgress.setBackground(null, false, z);
                    this.buttonState = -1;
                    return;
                }
                DownloadController.getInstance(PassportActivity.this.currentAccount).addLoadingFileObserver(this.currentSecureDocument.path, this);
                this.buttonState = 1;
                Float fileProgress = ImageLoader.getInstance().getFileProgress(this.currentSecureDocument.path);
                this.radialProgress.setBackground(Theme.chat_photoStatesDrawables[5][0], true, z);
                RadialProgress radialProgress2 = this.radialProgress;
                if (fileProgress != null) {
                    f = fileProgress.floatValue();
                }
                radialProgress2.setProgress(f, false);
                invalidate();
            } else if (exists) {
                DownloadController.getInstance(PassportActivity.this.currentAccount).removeLoadingFileObserver(this);
                this.buttonState = -1;
                this.radialProgress.setBackground(null, false, z);
                invalidate();
            } else {
                DownloadController.getInstance(PassportActivity.this.currentAccount).addLoadingFileObserver(attachFileName, this);
                this.buttonState = 1;
                Float fileProgress2 = ImageLoader.getInstance().getFileProgress(attachFileName);
                this.radialProgress.setBackground(Theme.chat_photoStatesDrawables[5][0], true, z);
                RadialProgress radialProgress3 = this.radialProgress;
                if (fileProgress2 != null) {
                    f = fileProgress2.floatValue();
                }
                radialProgress3.setProgress(f, z);
                invalidate();
            }
        }

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

        /* access modifiers changed from: protected */
        public void onDraw(Canvas canvas) {
            canvas.drawLine(LocaleController.isRTL ? 0.0f : (float) AndroidUtilities.dp(20.0f), (float) (getMeasuredHeight() - 1), (float) (getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0)), (float) (getMeasuredHeight() - 1), Theme.dividerPaint);
        }

        @Override // im.guobwnxjuc.messenger.DownloadController.FileDownloadProgressListener
        public void onFailedDownload(String str, boolean z) {
            updateButtonState(false);
        }

        @Override // im.guobwnxjuc.messenger.DownloadController.FileDownloadProgressListener
        public void onSuccessDownload(String str) {
            this.radialProgress.setProgress(1.0f, true);
            updateButtonState(true);
        }

        @Override // im.guobwnxjuc.messenger.DownloadController.FileDownloadProgressListener
        public void onProgressDownload(String str, float f) {
            this.radialProgress.setProgress(f, true);
            if (this.buttonState != 1) {
                updateButtonState(false);
            }
        }

        @Override // im.guobwnxjuc.messenger.DownloadController.FileDownloadProgressListener
        public void onProgressUpload(String str, float f, boolean z) {
            this.radialProgress.setProgress(f, true);
        }

        @Override // im.guobwnxjuc.messenger.DownloadController.FileDownloadProgressListener
        public int getObserverTag() {
            return this.TAG;
        }
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARNING: Code restructure failed: missing block: B:73:0x01aa, code lost:
        if (r21.equals("selfie") != false) goto L_0x01b8;
     */
    /* JADX WARNING: Removed duplicated region for block: B:106:0x0239 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x014a  */
    /* JADX WARNING: Removed duplicated region for block: B:50:0x015c  */
    /* JADX WARNING: Removed duplicated region for block: B:53:0x0161  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x0166  */
    /* JADX WARNING: Removed duplicated region for block: B:57:0x0172  */
    /* JADX WARNING: Removed duplicated region for block: B:60:0x017c  */
    /* JADX WARNING: Removed duplicated region for block: B:63:0x0186  */
    /* JADX WARNING: Removed duplicated region for block: B:66:0x0190  */
    /* JADX WARNING: Removed duplicated region for block: B:69:0x019a  */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x01a4  */
    /* JADX WARNING: Removed duplicated region for block: B:74:0x01ad  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x01b7  */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x01bd  */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x01c2  */
    /* JADX WARNING: Removed duplicated region for block: B:81:0x01d5  */
    /* JADX WARNING: Removed duplicated region for block: B:82:0x01e8  */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0203  */
    /* JADX WARNING: Removed duplicated region for block: B:86:0x0216  */
    /* JADX WARNING: Removed duplicated region for block: B:89:0x0231  */
    public PassportActivity(int i, int i2, String str, String str2, String str3, String str4, String str5, TLRPC.TL_account_authorizationForm tL_account_authorizationForm, TLRPC.TL_account_password tL_account_password) {
        this(i, tL_account_authorizationForm, tL_account_password, (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 i3;
        String str6;
        String str7;
        String str8;
        String str9;
        HashMap<String, String> hashMap;
        char c;
        boolean z;
        byte[] bArr;
        this.currentBotId = i2;
        this.currentPayload = str3;
        this.currentNonce = str4;
        this.currentScope = str;
        this.currentPublicKey = str2;
        this.currentCallbackUrl = str5;
        if (i == 0 && !tL_account_authorizationForm.errors.isEmpty()) {
            try {
                Collections.sort(tL_account_authorizationForm.errors, new Comparator<TLRPC.SecureValueError>() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass2 */

                    /* access modifiers changed from: package-private */
                    public int getErrorValue(TLRPC.SecureValueError secureValueError) {
                        if (secureValueError instanceof TLRPC.TL_secureValueError) {
                            return 0;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorFrontSide) {
                            return 1;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorReverseSide) {
                            return 2;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorSelfie) {
                            return 3;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFile) {
                            return 4;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFiles) {
                            return 5;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorFile) {
                            return 6;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorFiles) {
                            return 7;
                        }
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorData) {
                            return PassportActivity.this.getFieldCost(((TLRPC.TL_secureValueErrorData) secureValueError).field);
                        }
                        return 100;
                    }

                    public int compare(TLRPC.SecureValueError secureValueError, TLRPC.SecureValueError secureValueError2) {
                        int errorValue = getErrorValue(secureValueError);
                        int errorValue2 = getErrorValue(secureValueError2);
                        if (errorValue < errorValue2) {
                            return -1;
                        }
                        return errorValue > errorValue2 ? 1 : 0;
                    }
                });
                int size = tL_account_authorizationForm.errors.size();
                int i4 = 0;
                while (i4 < size) {
                    TLRPC.SecureValueError secureValueError = tL_account_authorizationForm.errors.get(i4);
                    String str10 = null;
                    str10 = null;
                    str10 = null;
                    str10 = null;
                    str10 = null;
                    r6 = null;
                    str10 = null;
                    byte[] bArr2 = null;
                    if (secureValueError instanceof TLRPC.TL_secureValueErrorFrontSide) {
                        TLRPC.TL_secureValueErrorFrontSide tL_secureValueErrorFrontSide = (TLRPC.TL_secureValueErrorFrontSide) secureValueError;
                        str7 = getNameForType(tL_secureValueErrorFrontSide.type);
                        str9 = tL_secureValueErrorFrontSide.text;
                        bArr = tL_secureValueErrorFrontSide.file_hash;
                        str6 = "front";
                    } else if (secureValueError instanceof TLRPC.TL_secureValueErrorReverseSide) {
                        TLRPC.TL_secureValueErrorReverseSide tL_secureValueErrorReverseSide = (TLRPC.TL_secureValueErrorReverseSide) secureValueError;
                        str7 = getNameForType(tL_secureValueErrorReverseSide.type);
                        str9 = tL_secureValueErrorReverseSide.text;
                        bArr = tL_secureValueErrorReverseSide.file_hash;
                        str6 = "reverse";
                    } else if (secureValueError instanceof TLRPC.TL_secureValueErrorSelfie) {
                        TLRPC.TL_secureValueErrorSelfie tL_secureValueErrorSelfie = (TLRPC.TL_secureValueErrorSelfie) secureValueError;
                        str7 = getNameForType(tL_secureValueErrorSelfie.type);
                        str9 = tL_secureValueErrorSelfie.text;
                        bArr = tL_secureValueErrorSelfie.file_hash;
                        str6 = "selfie";
                    } else if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFile) {
                        TLRPC.TL_secureValueErrorTranslationFile tL_secureValueErrorTranslationFile = (TLRPC.TL_secureValueErrorTranslationFile) secureValueError;
                        str7 = getNameForType(tL_secureValueErrorTranslationFile.type);
                        str9 = tL_secureValueErrorTranslationFile.text;
                        bArr = tL_secureValueErrorTranslationFile.file_hash;
                        str6 = "translation";
                    } else {
                        if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFiles) {
                            TLRPC.TL_secureValueErrorTranslationFiles tL_secureValueErrorTranslationFiles = (TLRPC.TL_secureValueErrorTranslationFiles) secureValueError;
                            str7 = getNameForType(tL_secureValueErrorTranslationFiles.type);
                            str9 = tL_secureValueErrorTranslationFiles.text;
                            str8 = null;
                            str6 = "translation";
                        } else if (secureValueError instanceof TLRPC.TL_secureValueErrorFile) {
                            TLRPC.TL_secureValueErrorFile tL_secureValueErrorFile = (TLRPC.TL_secureValueErrorFile) secureValueError;
                            str7 = getNameForType(tL_secureValueErrorFile.type);
                            str9 = tL_secureValueErrorFile.text;
                            bArr = tL_secureValueErrorFile.file_hash;
                            str6 = "files";
                        } else if (secureValueError instanceof TLRPC.TL_secureValueErrorFiles) {
                            TLRPC.TL_secureValueErrorFiles tL_secureValueErrorFiles = (TLRPC.TL_secureValueErrorFiles) secureValueError;
                            str7 = getNameForType(tL_secureValueErrorFiles.type);
                            str9 = tL_secureValueErrorFiles.text;
                            str8 = null;
                            str6 = "files";
                        } else if (secureValueError instanceof TLRPC.TL_secureValueError) {
                            TLRPC.TL_secureValueError tL_secureValueError = (TLRPC.TL_secureValueError) secureValueError;
                            str7 = getNameForType(tL_secureValueError.type);
                            str9 = tL_secureValueError.text;
                            bArr = tL_secureValueError.hash;
                            str6 = "error_all";
                        } else {
                            if (secureValueError instanceof TLRPC.TL_secureValueErrorData) {
                                TLRPC.TL_secureValueErrorData tL_secureValueErrorData = (TLRPC.TL_secureValueErrorData) secureValueError;
                                int i5 = 0;
                                while (true) {
                                    if (i5 < tL_account_authorizationForm.values.size()) {
                                        TLRPC.TL_secureValue tL_secureValue = tL_account_authorizationForm.values.get(i5);
                                        if (tL_secureValue.data == null || !Arrays.equals(tL_secureValue.data.data_hash, tL_secureValueErrorData.data_hash)) {
                                            i5++;
                                        } else {
                                            z = true;
                                        }
                                    } else {
                                        z = false;
                                    }
                                }
                                if (z) {
                                    str7 = getNameForType(tL_secureValueErrorData.type);
                                    str9 = tL_secureValueErrorData.text;
                                    str10 = tL_secureValueErrorData.field;
                                    bArr = tL_secureValueErrorData.data_hash;
                                    str6 = "data";
                                }
                            }
                            i3 = size;
                            i4++;
                            size = i3;
                        }
                        hashMap = this.errorsMap.get(str7);
                        if (hashMap != null) {
                            hashMap = new HashMap<>();
                            i3 = size;
                            this.errorsMap.put(str7, hashMap);
                            this.mainErrorsMap.put(str7, str9);
                        } else {
                            i3 = size;
                        }
                        c = 2;
                        String encodeToString = bArr2 == null ? Base64.encodeToString(bArr2, 2) : "";
                        switch (str6.hashCode()) {
                            case -1840647503:
                                if (str6.equals("translation")) {
                                    c = 3;
                                    break;
                                }
                                c = 65535;
                                break;
                            case -906020504:
                                break;
                            case 3076010:
                                if (str6.equals("data")) {
                                    c = 0;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 97434231:
                                if (str6.equals("files")) {
                                    c = 1;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 97705513:
                                if (str6.equals("front")) {
                                    c = 4;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 329856746:
                                if (str6.equals("error_all")) {
                                    c = 6;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 1099846370:
                                if (str6.equals("reverse")) {
                                    c = 5;
                                    break;
                                }
                                c = 65535;
                                break;
                            default:
                                c = 65535;
                                break;
                        }
                        switch (c) {
                            case 0:
                                if (str8 != null) {
                                    hashMap.put(str8, str9);
                                    break;
                                } else {
                                    continue;
                                    continue;
                                }
                            case 1:
                                if (bArr2 == null) {
                                    hashMap.put("files_all", str9);
                                    break;
                                } else {
                                    hashMap.put("files" + encodeToString, str9);
                                    continue;
                                    continue;
                                }
                            case 2:
                                hashMap.put("selfie" + encodeToString, str9);
                                continue;
                                continue;
                            case 3:
                                if (bArr2 == null) {
                                    hashMap.put("translation_all", str9);
                                    break;
                                } else {
                                    hashMap.put("translation" + encodeToString, str9);
                                    continue;
                                    continue;
                                }
                            case 4:
                                hashMap.put("front" + encodeToString, str9);
                                continue;
                                continue;
                            case 5:
                                hashMap.put("reverse" + encodeToString, str9);
                                continue;
                                continue;
                            case 6:
                                hashMap.put("error_all", str9);
                                continue;
                                continue;
                        }
                        i4++;
                        size = i3;
                    }
                    bArr2 = bArr;
                    str8 = str10;
                    hashMap = this.errorsMap.get(str7);
                    if (hashMap != null) {
                    }
                    c = 2;
                    if (bArr2 == null) {
                    }
                    switch (str6.hashCode()) {
                        case -1840647503:
                            break;
                        case -906020504:
                            break;
                        case 3076010:
                            break;
                        case 97434231:
                            break;
                        case 97705513:
                            break;
                        case 329856746:
                            break;
                        case 1099846370:
                            break;
                    }
                    switch (c) {
                    }
                    i4++;
                    size = i3;
                }
            } catch (Exception unused) {
            }
        }
    }

    public PassportActivity(int i, TLRPC.TL_account_authorizationForm tL_account_authorizationForm, TLRPC.TL_account_password tL_account_password, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureValue tL_secureValue, TLRPC.TL_secureRequiredType tL_secureRequiredType2, TLRPC.TL_secureValue tL_secureValue2, HashMap<String, String> hashMap, HashMap<String, String> hashMap2) {
        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 PhotoViewer.EmptyPhotoViewerProvider() {
            /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass1 */

            @Override // im.guobwnxjuc.ui.PhotoViewer.EmptyPhotoViewerProvider, im.guobwnxjuc.ui.PhotoViewer.PhotoViewerProvider
            public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i, boolean z) {
                if (i < 0 || i >= PassportActivity.this.currentPhotoViewerLayout.getChildCount()) {
                    return null;
                }
                SecureDocumentCell secureDocumentCell = (SecureDocumentCell) PassportActivity.this.currentPhotoViewerLayout.getChildAt(i);
                int[] iArr = new int[2];
                secureDocumentCell.imageView.getLocationInWindow(iArr);
                PhotoViewer.PlaceProviderObject placeProviderObject = new PhotoViewer.PlaceProviderObject();
                int i2 = 0;
                placeProviderObject.viewX = iArr[0];
                int i3 = iArr[1];
                if (Build.VERSION.SDK_INT < 21) {
                    i2 = AndroidUtilities.statusBarHeight;
                }
                placeProviderObject.viewY = i3 - i2;
                placeProviderObject.parentView = PassportActivity.this.currentPhotoViewerLayout;
                placeProviderObject.imageReceiver = secureDocumentCell.imageView.getImageReceiver();
                placeProviderObject.thumb = placeProviderObject.imageReceiver.getBitmapSafe();
                return placeProviderObject;
            }

            @Override // im.guobwnxjuc.ui.PhotoViewer.EmptyPhotoViewerProvider, im.guobwnxjuc.ui.PhotoViewer.PhotoViewerProvider
            public void deleteImageAtIndex(int i) {
                SecureDocument secureDocument;
                if (PassportActivity.this.uploadingFileType == 1) {
                    secureDocument = PassportActivity.this.selfieDocument;
                } else if (PassportActivity.this.uploadingFileType == 4) {
                    secureDocument = (SecureDocument) PassportActivity.this.translationDocuments.get(i);
                } else if (PassportActivity.this.uploadingFileType == 2) {
                    secureDocument = PassportActivity.this.frontDocument;
                } else if (PassportActivity.this.uploadingFileType == 3) {
                    secureDocument = PassportActivity.this.reverseDocument;
                } else {
                    secureDocument = (SecureDocument) PassportActivity.this.documents.get(i);
                }
                SecureDocumentCell secureDocumentCell = (SecureDocumentCell) PassportActivity.this.documentsCells.remove(secureDocument);
                if (secureDocumentCell != null) {
                    String documentHash = PassportActivity.this.getDocumentHash(secureDocument);
                    String str = null;
                    if (PassportActivity.this.uploadingFileType == 1) {
                        PassportActivity.this.selfieDocument = null;
                        str = "selfie" + documentHash;
                    } else if (PassportActivity.this.uploadingFileType == 4) {
                        str = "translation" + documentHash;
                    } else if (PassportActivity.this.uploadingFileType == 2) {
                        PassportActivity.this.frontDocument = null;
                        str = "front" + documentHash;
                    } else if (PassportActivity.this.uploadingFileType == 3) {
                        PassportActivity.this.reverseDocument = null;
                        str = "reverse" + documentHash;
                    } else if (PassportActivity.this.uploadingFileType == 0) {
                        str = "files" + documentHash;
                    }
                    if (str != null) {
                        if (PassportActivity.this.documentsErrors != null) {
                            PassportActivity.this.documentsErrors.remove(str);
                        }
                        if (PassportActivity.this.errorsValues != null) {
                            PassportActivity.this.errorsValues.remove(str);
                        }
                    }
                    PassportActivity passportActivity = PassportActivity.this;
                    passportActivity.updateUploadText(passportActivity.uploadingFileType);
                    PassportActivity.this.currentPhotoViewerLayout.removeView(secureDocumentCell);
                }
            }

            @Override // im.guobwnxjuc.ui.PhotoViewer.EmptyPhotoViewerProvider, im.guobwnxjuc.ui.PhotoViewer.PhotoViewerProvider
            public String getDeleteMessageString() {
                if (PassportActivity.this.uploadingFileType == 1) {
                    return LocaleController.formatString("PassportDeleteSelfieAlert", R.string.PassportDeleteSelfieAlert, new Object[0]);
                }
                return LocaleController.formatString("PassportDeleteScanAlert", R.string.PassportDeleteScanAlert, new Object[0]);
            }
        };
        this.currentActivityType = i;
        this.currentForm = tL_account_authorizationForm;
        this.currentType = tL_secureRequiredType;
        if (tL_secureRequiredType != null) {
            this.allowNonLatinName = tL_secureRequiredType.native_names;
        }
        this.currentTypeValue = tL_secureValue;
        this.currentDocumentsType = tL_secureRequiredType2;
        this.currentDocumentsTypeValue = tL_secureValue2;
        this.currentPassword = tL_account_password;
        this.currentValues = hashMap;
        this.currentDocumentValues = hashMap2;
        int i2 = this.currentActivityType;
        if (i2 == 3) {
            this.permissionsItems = new ArrayList<>();
        } else if (i2 == 7) {
            this.views = new SlideView[3];
        }
        if (this.currentValues == null) {
            this.currentValues = new HashMap<>();
        }
        if (this.currentDocumentValues == null) {
            this.currentDocumentValues = new HashMap<>();
        }
        if (i == 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_password2 = this.currentPassword;
            if (tL_account_password2 == null) {
                loadPasswordInfo();
            } else {
                TwoStepVerificationActivity.initPasswordNewAlgo(tL_account_password2);
                if (this.usingSavedPassword == 1) {
                    onPasswordDone(true);
                }
            }
            if (!SharedConfig.isPassportConfigLoaded()) {
                TLRPC.TL_help_getPassportConfig tL_help_getPassportConfig = new TLRPC.TL_help_getPassportConfig();
                tL_help_getPassportConfig.hash = SharedConfig.passportConfigHash;
                ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_help_getPassportConfig, $$Lambda$PassportActivity$NbPfBFhVqjWXvq6u3V_T3OcdYs.INSTANCE);
            }
        }
    }

    static /* synthetic */ void lambda$null$0(TLObject tLObject) {
        if (tLObject instanceof TLRPC.TL_help_passportConfig) {
            TLRPC.TL_help_passportConfig tL_help_passportConfig = (TLRPC.TL_help_passportConfig) tLObject;
            SharedConfig.setPassportConfig(tL_help_passportConfig.countries_langs.data, tL_help_passportConfig.hash);
            return;
        }
        SharedConfig.getCountryLangs();
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onResume() {
        ViewGroup[] viewGroupArr;
        super.onResume();
        ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
        if (chatAttachAlert2 != null) {
            chatAttachAlert2.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 Runnable() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$G3n4KJcNuapFIdurK2X0_26DwCY */

                public final void run() {
                    PassportActivity.this.lambda$onResume$2$PassportActivity();
                }
            }, 200);
        }
        AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
    }

    public /* synthetic */ void lambda$onResume$2$PassportActivity() {
        ViewGroup[] viewGroupArr = this.inputFieldContainers;
        if (viewGroupArr != null && viewGroupArr[0] != null && viewGroupArr[0].getVisibility() == 0) {
            this.inputFields[0].requestFocus();
            AndroidUtilities.showKeyboard(this.inputFields[0]);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onPause() {
        super.onPause();
        ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
        if (chatAttachAlert2 != null) {
            chatAttachAlert2.onPause();
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public boolean onFragmentCreate() {
        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();
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onFragmentDestroy() {
        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);
        int i = 0;
        callCallback(false);
        ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
        if (chatAttachAlert2 != null) {
            chatAttachAlert2.dismissInternal();
            this.chatAttachAlert.onDestroy();
        }
        if (this.currentActivityType == 7) {
            while (true) {
                SlideView[] slideViewArr = this.views;
                if (i >= slideViewArr.length) {
                    break;
                }
                if (slideViewArr[i] != null) {
                    slideViewArr[i].onDestroyActivity();
                }
                i++;
            }
            AlertDialog alertDialog = this.progressDialog;
            if (alertDialog != null) {
                try {
                    alertDialog.dismiss();
                } catch (Exception e) {
                    FileLog.e(e);
                }
                this.progressDialog = null;
            }
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public View createView(Context context) {
        ChatAttachAlert chatAttachAlert2;
        this.actionBar.setBackButtonImage(R.mipmap.ic_back);
        this.actionBar.setAllowOverlayTitle(true);
        this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
            /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass3 */

            /* JADX WARNING: Removed duplicated region for block: B:78:0x0367  */
            /* JADX WARNING: Removed duplicated region for block: B:81:0x0378  */
            /* JADX WARNING: Removed duplicated region for block: B:84:0x0390  */
            /* JADX WARNING: Removed duplicated region for block: B:85:0x0396  */
            /* JADX WARNING: Removed duplicated region for block: B:88:0x039f  */
            /* JADX WARNING: Removed duplicated region for block: B:89:0x03a6  */
            private boolean onIdentityDone(Runnable runnable, ErrorRunnable errorRunnable) {
                JSONObject jSONObject;
                JSONObject jSONObject2;
                String str;
                String str2;
                String str3;
                if (!PassportActivity.this.uploadingDocuments.isEmpty() || PassportActivity.this.checkFieldsForError()) {
                    return false;
                }
                if (PassportActivity.this.allowNonLatinName) {
                    PassportActivity.this.allowNonLatinName = false;
                    boolean z = false;
                    for (int i = 0; i < PassportActivity.this.nonLatinNames.length; i++) {
                        if (PassportActivity.this.nonLatinNames[i]) {
                            PassportActivity.this.inputFields[i].setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
                            if (!z) {
                                if (PassportActivity.this.nonLatinNames[0]) {
                                    PassportActivity passportActivity = PassportActivity.this;
                                    str = passportActivity.getTranslitString(passportActivity.inputExtraFields[0].getText().toString());
                                } else {
                                    str = PassportActivity.this.inputFields[0].getText().toString();
                                }
                                if (PassportActivity.this.nonLatinNames[1]) {
                                    PassportActivity passportActivity2 = PassportActivity.this;
                                    str2 = passportActivity2.getTranslitString(passportActivity2.inputExtraFields[1].getText().toString());
                                } else {
                                    str2 = PassportActivity.this.inputFields[1].getText().toString();
                                }
                                if (PassportActivity.this.nonLatinNames[2]) {
                                    PassportActivity passportActivity3 = PassportActivity.this;
                                    str3 = passportActivity3.getTranslitString(passportActivity3.inputExtraFields[2].getText().toString());
                                } else {
                                    str3 = PassportActivity.this.inputFields[2].getText().toString();
                                }
                                if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2) || TextUtils.isEmpty(str3)) {
                                    PassportActivity passportActivity4 = PassportActivity.this;
                                    passportActivity4.onFieldError(passportActivity4.inputFields[i]);
                                } else {
                                    AlertDialog.Builder builder = new AlertDialog.Builder(PassportActivity.this.getParentActivity());
                                    builder.setMessage(LocaleController.formatString("PassportNameCheckAlert", R.string.PassportNameCheckAlert, str, str2, str3));
                                    builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                                    builder.setPositiveButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener(str, str2, str3, runnable, errorRunnable) {
                                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$O8_LraW9xDUiPJeQR7X5Z0xdbU */
                                        private final /* synthetic */ String f$1;
                                        private final /* synthetic */ String f$2;
                                        private final /* synthetic */ String f$3;
                                        private final /* synthetic */ Runnable f$4;
                                        private final /* synthetic */ PassportActivity.ErrorRunnable f$5;

                                        {
                                            this.f$1 = r2;
                                            this.f$2 = r3;
                                            this.f$3 = r4;
                                            this.f$4 = r5;
                                            this.f$5 = r6;
                                        }

                                        public final void onClick(DialogInterface dialogInterface, int i) {
                                            PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$0$PassportActivity$3(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, dialogInterface, i);
                                        }
                                    });
                                    builder.setNegativeButton(LocaleController.getString("Edit", R.string.Edit), new DialogInterface.OnClickListener(i) {
                                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$41B_OGpcRBZLsL9J9gBXDCpzYYs */
                                        private final /* synthetic */ int f$1;

                                        {
                                            this.f$1 = r2;
                                        }

                                        public final void onClick(DialogInterface dialogInterface, int i) {
                                            PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$1$PassportActivity$3(this.f$1, dialogInterface, i);
                                        }
                                    });
                                    PassportActivity.this.showDialog(builder.create());
                                }
                                z = true;
                            }
                        }
                    }
                    if (z) {
                        return false;
                    }
                }
                if (PassportActivity.this.isHasNotAnyChanges()) {
                    PassportActivity.this.finishFragment();
                    return false;
                }
                SecureDocument secureDocument = null;
                try {
                    if (!PassportActivity.this.documentOnly) {
                        HashMap hashMap = new HashMap(PassportActivity.this.currentValues);
                        if (PassportActivity.this.currentType.native_names) {
                            if (PassportActivity.this.nativeInfoCell.getVisibility() == 0) {
                                hashMap.put("first_name_native", PassportActivity.this.inputExtraFields[0].getText().toString());
                                hashMap.put("middle_name_native", PassportActivity.this.inputExtraFields[1].getText().toString());
                                hashMap.put("last_name_native", PassportActivity.this.inputExtraFields[2].getText().toString());
                            } else {
                                hashMap.put("first_name_native", PassportActivity.this.inputFields[0].getText().toString());
                                hashMap.put("middle_name_native", PassportActivity.this.inputFields[1].getText().toString());
                                hashMap.put("last_name_native", PassportActivity.this.inputFields[2].getText().toString());
                            }
                        }
                        hashMap.put("first_name", PassportActivity.this.inputFields[0].getText().toString());
                        hashMap.put("middle_name", PassportActivity.this.inputFields[1].getText().toString());
                        hashMap.put("last_name", PassportActivity.this.inputFields[2].getText().toString());
                        hashMap.put("birth_date", PassportActivity.this.inputFields[3].getText().toString());
                        hashMap.put("gender", PassportActivity.this.currentGender);
                        hashMap.put("country_code", PassportActivity.this.currentCitizeship);
                        hashMap.put("residence_country_code", PassportActivity.this.currentResidence);
                        jSONObject2 = new JSONObject();
                        try {
                            ArrayList arrayList = new ArrayList(hashMap.keySet());
                            Collections.sort(arrayList, new Comparator() {
                                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$E9tNMChVIGipbYvOxOOIjBYU1c */

                                @Override // java.util.Comparator
                                public final int compare(Object obj, Object obj2) {
                                    return PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$2$PassportActivity$3((String) obj, (String) obj2);
                                }
                            });
                            int size = arrayList.size();
                            for (int i2 = 0; i2 < size; i2++) {
                                String str4 = (String) arrayList.get(i2);
                                jSONObject2.put(str4, hashMap.get(str4));
                            }
                        } catch (Exception unused) {
                        }
                    } else {
                        jSONObject2 = null;
                    }
                    if (PassportActivity.this.currentDocumentsType != null) {
                        HashMap hashMap2 = new HashMap(PassportActivity.this.currentDocumentValues);
                        hashMap2.put("document_no", PassportActivity.this.inputFields[7].getText().toString());
                        if (PassportActivity.this.currentExpireDate[0] != 0) {
                            hashMap2.put("expiry_date", String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(PassportActivity.this.currentExpireDate[2]), Integer.valueOf(PassportActivity.this.currentExpireDate[1]), Integer.valueOf(PassportActivity.this.currentExpireDate[0])));
                        } else {
                            hashMap2.put("expiry_date", "");
                        }
                        jSONObject = new JSONObject();
                        try {
                            ArrayList arrayList2 = new ArrayList(hashMap2.keySet());
                            Collections.sort(arrayList2, new Comparator() {
                                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$VorwrSujR665lxLSyE4WK6SKFsg */

                                @Override // java.util.Comparator
                                public final int compare(Object obj, Object obj2) {
                                    return PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$3$PassportActivity$3((String) obj, (String) obj2);
                                }
                            });
                            int size2 = arrayList2.size();
                            for (int i3 = 0; i3 < size2; i3++) {
                                String str5 = (String) arrayList2.get(i3);
                                jSONObject.put(str5, hashMap2.get(str5));
                            }
                        } catch (Exception unused2) {
                        }
                        if (PassportActivity.this.fieldsErrors != null) {
                            PassportActivity.this.fieldsErrors.clear();
                        }
                        if (PassportActivity.this.documentsErrors != null) {
                            PassportActivity.this.documentsErrors.clear();
                        }
                        PassportActivityDelegate passportActivityDelegate = PassportActivity.this.delegate;
                        TLRPC.TL_secureRequiredType tL_secureRequiredType = PassportActivity.this.currentType;
                        String jSONObject3 = jSONObject2 == null ? jSONObject2.toString() : null;
                        TLRPC.TL_secureRequiredType tL_secureRequiredType2 = PassportActivity.this.currentDocumentsType;
                        String jSONObject4 = jSONObject == null ? jSONObject.toString() : null;
                        SecureDocument secureDocument2 = PassportActivity.this.selfieDocument;
                        ArrayList<SecureDocument> arrayList3 = PassportActivity.this.translationDocuments;
                        SecureDocument secureDocument3 = PassportActivity.this.frontDocument;
                        if (PassportActivity.this.reverseLayout != null && PassportActivity.this.reverseLayout.getVisibility() == 0) {
                            secureDocument = PassportActivity.this.reverseDocument;
                        }
                        passportActivityDelegate.saveValue(tL_secureRequiredType, null, jSONObject3, tL_secureRequiredType2, jSONObject4, null, secureDocument2, arrayList3, secureDocument3, secureDocument, runnable, errorRunnable);
                        return true;
                    }
                    jSONObject = null;
                } catch (Exception unused3) {
                    jSONObject2 = null;
                    jSONObject = null;
                }
                if (PassportActivity.this.fieldsErrors != null) {
                }
                if (PassportActivity.this.documentsErrors != null) {
                }
                PassportActivityDelegate passportActivityDelegate2 = PassportActivity.this.delegate;
                TLRPC.TL_secureRequiredType tL_secureRequiredType3 = PassportActivity.this.currentType;
                if (jSONObject2 == null) {
                }
                TLRPC.TL_secureRequiredType tL_secureRequiredType22 = PassportActivity.this.currentDocumentsType;
                if (jSONObject == null) {
                }
                SecureDocument secureDocument22 = PassportActivity.this.selfieDocument;
                ArrayList<SecureDocument> arrayList32 = PassportActivity.this.translationDocuments;
                SecureDocument secureDocument32 = PassportActivity.this.frontDocument;
                secureDocument = PassportActivity.this.reverseDocument;
                passportActivityDelegate2.saveValue(tL_secureRequiredType3, null, jSONObject3, tL_secureRequiredType22, jSONObject4, null, secureDocument22, arrayList32, secureDocument32, secureDocument, runnable, errorRunnable);
                return true;
            }

            public /* synthetic */ void lambda$onIdentityDone$0$PassportActivity$3(String str, String str2, String str3, Runnable runnable, ErrorRunnable errorRunnable, DialogInterface dialogInterface, int i) {
                PassportActivity.this.inputFields[0].setText(str);
                PassportActivity.this.inputFields[1].setText(str2);
                PassportActivity.this.inputFields[2].setText(str3);
                PassportActivity.this.showEditDoneProgress(true, true);
                onIdentityDone(runnable, errorRunnable);
            }

            public /* synthetic */ void lambda$onIdentityDone$1$PassportActivity$3(int i, DialogInterface dialogInterface, int i2) {
                PassportActivity passportActivity = PassportActivity.this;
                passportActivity.onFieldError(passportActivity.inputFields[i]);
            }

            public /* synthetic */ int lambda$onIdentityDone$2$PassportActivity$3(String str, String str2) {
                int fieldCost = PassportActivity.this.getFieldCost(str);
                int fieldCost2 = PassportActivity.this.getFieldCost(str2);
                if (fieldCost < fieldCost2) {
                    return -1;
                }
                return fieldCost > fieldCost2 ? 1 : 0;
            }

            public /* synthetic */ int lambda$onIdentityDone$3$PassportActivity$3(String str, String str2) {
                int fieldCost = PassportActivity.this.getFieldCost(str);
                int fieldCost2 = PassportActivity.this.getFieldCost(str2);
                if (fieldCost < fieldCost2) {
                    return -1;
                }
                return fieldCost > fieldCost2 ? 1 : 0;
            }

            /* JADX WARNING: Removed duplicated region for block: B:74:0x02a8  */
            /* JADX WARNING: Removed duplicated region for block: B:77:0x02b9  */
            /* JADX WARNING: Removed duplicated region for block: B:80:0x02d1  */
            @Override // im.guobwnxjuc.ui.actionbar.ActionBar.ActionBarMenuOnItemClick
            public void onItemClick(int i) {
                JSONObject jSONObject;
                String str;
                String obj;
                if (i != -1) {
                    String str2 = null;
                    if (i == 1) {
                        if (PassportActivity.this.getParentActivity() != null) {
                            TextView textView = new TextView(PassportActivity.this.getParentActivity());
                            String string = LocaleController.getString("PassportInfo2", R.string.PassportInfo2);
                            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
                            int indexOf = string.indexOf(42);
                            int lastIndexOf = string.lastIndexOf(42);
                            if (!(indexOf == -1 || lastIndexOf == -1)) {
                                spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) "");
                                spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) "");
                                spannableStringBuilder.setSpan(new URLSpanNoUnderline(LocaleController.getString("PassportInfoUrl", R.string.PassportInfoUrl)) {
                                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass3.AnonymousClass1 */

                                    @Override // im.guobwnxjuc.ui.components.URLSpanNoUnderline
                                    public void onClick(View view) {
                                        PassportActivity.this.dismissCurrentDialog();
                                        super.onClick(view);
                                    }
                                }, indexOf, lastIndexOf - 1, 33);
                            }
                            textView.setText(spannableStringBuilder);
                            textView.setTextSize(1, 16.0f);
                            textView.setLinkTextColor(Theme.getColor(Theme.key_dialogTextLink));
                            textView.setHighlightColor(Theme.getColor(Theme.key_dialogLinkSelection));
                            textView.setPadding(AndroidUtilities.dp(23.0f), 0, AndroidUtilities.dp(23.0f), 0);
                            textView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
                            textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
                            AlertDialog.Builder builder = new AlertDialog.Builder(PassportActivity.this.getParentActivity());
                            builder.setView(textView);
                            builder.setTitle(LocaleController.getString("PassportInfoTitle", R.string.PassportInfoTitle));
                            builder.setNegativeButton(LocaleController.getString("Close", R.string.Close), null);
                            PassportActivity.this.showDialog(builder.create());
                        }
                    } else if (i != 2) {
                    } else {
                        if (PassportActivity.this.currentActivityType == 5) {
                            PassportActivity.this.onPasswordDone(false);
                        } else if (PassportActivity.this.currentActivityType == 7) {
                            PassportActivity.this.views[PassportActivity.this.currentViewNum].onNextPressed();
                        } else {
                            final $$Lambda$PassportActivity$3$hzJvd4KZrZyigedIOWRl_SZNJhw r1 = new Runnable() {
                                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$hzJvd4KZrZyigedIOWRl_SZNJhw */

                                public final void run() {
                                    PassportActivity.AnonymousClass3.this.lambda$onItemClick$4$PassportActivity$3();
                                }
                            };
                            AnonymousClass2 r2 = new ErrorRunnable() {
                                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass3.AnonymousClass2 */

                                @Override // im.guobwnxjuc.ui.PassportActivity.ErrorRunnable
                                public void onError(String str, String str2) {
                                    if ("PHONE_VERIFICATION_NEEDED".equals(str)) {
                                        PassportActivity.this.startPhoneVerification(true, str2, r1, this, PassportActivity.this.delegate);
                                    } else {
                                        PassportActivity.this.showEditDoneProgress(true, false);
                                    }
                                }
                            };
                            if (PassportActivity.this.currentActivityType == 4) {
                                if (PassportActivity.this.useCurrentValue) {
                                    obj = PassportActivity.this.currentEmail;
                                } else if (!PassportActivity.this.checkFieldsForError()) {
                                    obj = PassportActivity.this.inputFields[0].getText().toString();
                                } else {
                                    return;
                                }
                                PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, obj, null, null, null, null, null, null, null, null, r1, r2);
                            } else if (PassportActivity.this.currentActivityType == 3) {
                                if (PassportActivity.this.useCurrentValue) {
                                    str = UserConfig.getInstance(PassportActivity.this.currentAccount).getCurrentUser().phone;
                                } else if (!PassportActivity.this.checkFieldsForError()) {
                                    str = PassportActivity.this.inputFields[1].getText().toString() + PassportActivity.this.inputFields[2].getText().toString();
                                } else {
                                    return;
                                }
                                PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, str, null, null, null, null, null, null, null, null, r1, r2);
                            } else if (PassportActivity.this.currentActivityType == 2) {
                                if (PassportActivity.this.uploadingDocuments.isEmpty() && !PassportActivity.this.checkFieldsForError()) {
                                    if (PassportActivity.this.isHasNotAnyChanges()) {
                                        PassportActivity.this.finishFragment();
                                        return;
                                    }
                                    try {
                                        if (!PassportActivity.this.documentOnly) {
                                            jSONObject = new JSONObject();
                                            try {
                                                jSONObject.put("street_line1", PassportActivity.this.inputFields[0].getText().toString());
                                                jSONObject.put("street_line2", PassportActivity.this.inputFields[1].getText().toString());
                                                jSONObject.put("post_code", PassportActivity.this.inputFields[2].getText().toString());
                                                jSONObject.put("city", PassportActivity.this.inputFields[3].getText().toString());
                                                jSONObject.put(RemoteConfigConstants.ResponseFieldKey.STATE, PassportActivity.this.inputFields[4].getText().toString());
                                                jSONObject.put("country_code", PassportActivity.this.currentCitizeship);
                                            } catch (Exception unused) {
                                            }
                                            if (PassportActivity.this.fieldsErrors != null) {
                                                PassportActivity.this.fieldsErrors.clear();
                                            }
                                            if (PassportActivity.this.documentsErrors != null) {
                                                PassportActivity.this.documentsErrors.clear();
                                            }
                                            PassportActivityDelegate passportActivityDelegate = PassportActivity.this.delegate;
                                            TLRPC.TL_secureRequiredType tL_secureRequiredType = PassportActivity.this.currentType;
                                            if (jSONObject != null) {
                                                str2 = jSONObject.toString();
                                            }
                                            passportActivityDelegate.saveValue(tL_secureRequiredType, null, str2, PassportActivity.this.currentDocumentsType, null, PassportActivity.this.documents, PassportActivity.this.selfieDocument, PassportActivity.this.translationDocuments, null, null, r1, r2);
                                        }
                                    } catch (Exception unused2) {
                                    }
                                    jSONObject = null;
                                    if (PassportActivity.this.fieldsErrors != null) {
                                    }
                                    if (PassportActivity.this.documentsErrors != null) {
                                    }
                                    PassportActivityDelegate passportActivityDelegate2 = PassportActivity.this.delegate;
                                    TLRPC.TL_secureRequiredType tL_secureRequiredType2 = PassportActivity.this.currentType;
                                    if (jSONObject != null) {
                                    }
                                    passportActivityDelegate2.saveValue(tL_secureRequiredType2, null, str2, PassportActivity.this.currentDocumentsType, null, PassportActivity.this.documents, PassportActivity.this.selfieDocument, PassportActivity.this.translationDocuments, null, null, r1, r2);
                                } else {
                                    return;
                                }
                            } else if (PassportActivity.this.currentActivityType == 1) {
                                if (!onIdentityDone(r1, r2)) {
                                    return;
                                }
                            } else if (PassportActivity.this.currentActivityType == 6) {
                                TLRPC.TL_account_verifyEmail tL_account_verifyEmail = new TLRPC.TL_account_verifyEmail();
                                tL_account_verifyEmail.email = (String) PassportActivity.this.currentValues.get("email");
                                tL_account_verifyEmail.code = PassportActivity.this.inputFields[0].getText().toString();
                                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_verifyEmail, new RequestDelegate(r1, r2, tL_account_verifyEmail) {
                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$90MzWLQ90GNLUCAUx3tAEwlkkFU */
                                    private final /* synthetic */ Runnable f$1;
                                    private final /* synthetic */ PassportActivity.ErrorRunnable f$2;
                                    private final /* synthetic */ TLRPC.TL_account_verifyEmail f$3;

                                    {
                                        this.f$1 = r2;
                                        this.f$2 = r3;
                                        this.f$3 = r4;
                                    }

                                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                        PassportActivity.AnonymousClass3.this.lambda$onItemClick$6$PassportActivity$3(this.f$1, this.f$2, this.f$3, tLObject, tL_error);
                                    }
                                }), PassportActivity.this.classGuid);
                            }
                            PassportActivity.this.showEditDoneProgress(true, true);
                        }
                    }
                } else if (!PassportActivity.this.checkDiscard()) {
                    if (PassportActivity.this.currentActivityType == 0 || PassportActivity.this.currentActivityType == 5) {
                        PassportActivity.this.callCallback(false);
                    }
                    PassportActivity.this.finishFragment();
                }
            }

            public /* synthetic */ void lambda$onItemClick$4$PassportActivity$3() {
                PassportActivity.this.finishFragment();
            }

            public /* synthetic */ void lambda$onItemClick$6$PassportActivity$3(Runnable runnable, ErrorRunnable errorRunnable, TLRPC.TL_account_verifyEmail tL_account_verifyEmail, TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error, runnable, errorRunnable, tL_account_verifyEmail) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3$jEeAgOi9VbzC4UUZdOyOvMLuSg */
                    private final /* synthetic */ TLRPC.TL_error f$1;
                    private final /* synthetic */ Runnable f$2;
                    private final /* synthetic */ PassportActivity.ErrorRunnable f$3;
                    private final /* synthetic */ TLRPC.TL_account_verifyEmail f$4;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                        this.f$3 = r4;
                        this.f$4 = r5;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass3.this.lambda$null$5$PassportActivity$3(this.f$1, this.f$2, this.f$3, this.f$4);
                    }
                });
            }

            public /* synthetic */ void lambda$null$5$PassportActivity$3(TLRPC.TL_error tL_error, Runnable runnable, ErrorRunnable errorRunnable, TLRPC.TL_account_verifyEmail tL_account_verifyEmail) {
                if (tL_error == null) {
                    PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, (String) PassportActivity.this.currentValues.get("email"), null, null, null, null, null, null, null, null, runnable, errorRunnable);
                    return;
                }
                AlertsCreator.processError(PassportActivity.this.currentAccount, tL_error, PassportActivity.this, tL_account_verifyEmail, new Object[0]);
                errorRunnable.onError(null, null);
            }
        });
        if (this.currentActivityType == 7) {
            AnonymousClass4 r0 = new ScrollView(context) {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass4 */

                /* access modifiers changed from: protected */
                public boolean onRequestFocusInDescendants(int i, Rect rect) {
                    return false;
                }

                public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
                    if (PassportActivity.this.currentViewNum == 1 || PassportActivity.this.currentViewNum == 2 || PassportActivity.this.currentViewNum == 4) {
                        rect.bottom += AndroidUtilities.dp(40.0f);
                    }
                    return super.requestChildRectangleOnScreen(view, rect, z);
                }

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    PassportActivity.this.scrollHeight = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
                    super.onMeasure(i, i2);
                }
            };
            this.scrollView = r0;
            this.fragmentView = r0;
            this.scrollView.setFillViewport(true);
            AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor(Theme.key_actionBarDefault));
        } else {
            this.fragmentView = new FrameLayout(context);
            FrameLayout frameLayout = (FrameLayout) this.fragmentView;
            this.fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
            AnonymousClass5 r6 = new ScrollView(context) {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass5 */

                /* access modifiers changed from: protected */
                public boolean onRequestFocusInDescendants(int i, Rect rect) {
                    return false;
                }

                public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
                    rect.offset(view.getLeft() - view.getScrollX(), view.getTop() - view.getScrollY());
                    rect.top += AndroidUtilities.dp(20.0f);
                    rect.bottom += AndroidUtilities.dp(50.0f);
                    return super.requestChildRectangleOnScreen(view, rect, z);
                }
            };
            this.scrollView = r6;
            r6.setFillViewport(true);
            AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor(Theme.key_actionBarDefault));
            frameLayout.addView(this.scrollView, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, this.currentActivityType == 0 ? 48.0f : 0.0f));
            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)) {
            this.doneItem = this.actionBar.createMenu().addItemWithWidth(2, R.drawable.ic_done, AndroidUtilities.dp(56.0f));
            ContextProgressView contextProgressView = new ContextProgressView(context, 1);
            this.progressView = contextProgressView;
            contextProgressView.setAlpha(0.0f);
            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) && (chatAttachAlert2 = this.chatAttachAlert) != null) {
                try {
                    if (chatAttachAlert2.isShowing()) {
                        this.chatAttachAlert.dismiss();
                    }
                } catch (Exception unused) {
                }
                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;
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public boolean dismissDialogOnPause(Dialog dialog) {
        return dialog != this.chatAttachAlert && super.dismissDialogOnPause(dialog);
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void dismissCurrentDialog() {
        ChatAttachAlert chatAttachAlert2;
        if (this.chatAttachAlert == null || this.visibleDialog != (chatAttachAlert2 = this.chatAttachAlert)) {
            super.dismissCurrentDialog();
            return;
        }
        chatAttachAlert2.closeCamera(false);
        this.chatAttachAlert.dismissInternal();
        this.chatAttachAlert.hideCamera(true);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String getTranslitString(String str) {
        return LocaleController.getInstance().getTranslitString(str, true);
    }

    /* access modifiers changed from: private */
    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* access modifiers changed from: public */
    private int getFieldCost(String str) {
        char c;
        switch (str.hashCode()) {
            case -2006252145:
                if (str.equals("residence_country_code")) {
                    c = '\t';
                    break;
                }
                c = 65535;
                break;
            case -1537298398:
                if (str.equals("last_name_native")) {
                    c = 5;
                    break;
                }
                c = 65535;
                break;
            case -1249512767:
                if (str.equals("gender")) {
                    c = 7;
                    break;
                }
                c = 65535;
                break;
            case -796150911:
                if (str.equals("street_line1")) {
                    c = '\f';
                    break;
                }
                c = 65535;
                break;
            case -796150910:
                if (str.equals("street_line2")) {
                    c = '\r';
                    break;
                }
                c = 65535;
                break;
            case -160985414:
                if (str.equals("first_name")) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            case 3053931:
                if (str.equals("city")) {
                    c = 15;
                    break;
                }
                c = 65535;
                break;
            case 109757585:
                if (str.equals(RemoteConfigConstants.ResponseFieldKey.STATE)) {
                    c = 16;
                    break;
                }
                c = 65535;
                break;
            case 421072629:
                if (str.equals("middle_name")) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case 451516732:
                if (str.equals("first_name_native")) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case 475919162:
                if (str.equals("expiry_date")) {
                    c = 11;
                    break;
                }
                c = 65535;
                break;
            case 506677093:
                if (str.equals("document_no")) {
                    c = '\n';
                    break;
                }
                c = 65535;
                break;
            case 1168724782:
                if (str.equals("birth_date")) {
                    c = 6;
                    break;
                }
                c = 65535;
                break;
            case 1181577377:
                if (str.equals("middle_name_native")) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case 1481071862:
                if (str.equals("country_code")) {
                    c = '\b';
                    break;
                }
                c = 65535;
                break;
            case 2002465324:
                if (str.equals("post_code")) {
                    c = 14;
                    break;
                }
                c = 65535;
                break;
            case 2013122196:
                if (str.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 '\t':
                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) {
        this.actionBar.setTitle(LocaleController.getString("PassportPhone", R.string.PassportPhone));
        FrameLayout frameLayout = new FrameLayout(context);
        this.scrollView.addView(frameLayout, LayoutHelper.createScroll(-1, -2, 51));
        for (int i = 0; i < 3; i++) {
            this.views[i] = new PhoneConfirmationView(context, i + 2);
            this.views[i].setVisibility(8);
            SlideView slideView = this.views[i];
            float f = 18.0f;
            float f2 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
            if (AndroidUtilities.isTablet()) {
                f = 26.0f;
            }
            frameLayout.addView(slideView, LayoutHelper.createFrame(-1.0f, -1.0f, 51, f2, 30.0f, f, 0.0f));
        }
        Bundle bundle = new Bundle();
        bundle.putString("phone", this.currentValues.get("phone"));
        fillNextCodeParams(bundle, this.currentPhoneVerification, false);
    }

    private void loadPasswordInfo() {
        ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$rTW4vUwj5l23oza_rxBH5lag1hE */

            @Override // im.guobwnxjuc.tgnet.RequestDelegate
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$loadPasswordInfo$4$PassportActivity(tLObject, tL_error);
            }
        }), this.classGuid);
    }

    public /* synthetic */ void lambda$loadPasswordInfo$4$PassportActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable(tLObject) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$wGX3JqnpakZshSSj7MqqwppYehk */
            private final /* synthetic */ TLObject f$1;

            {
                this.f$1 = r2;
            }

            public final void run() {
                PassportActivity.this.lambda$null$3$PassportActivity(this.f$1);
            }
        });
    }

    public /* synthetic */ void lambda$null$3$PassportActivity(TLObject tLObject) {
        if (tLObject != null) {
            TLRPC.TL_account_password tL_account_password = (TLRPC.TL_account_password) tLObject;
            this.currentPassword = tL_account_password;
            if (!TwoStepVerificationActivity.canHandleCurrentPassword(tL_account_password, false)) {
                AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), 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) {
        this.actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
        this.inputFields = new EditTextBoldCursor[1];
        for (int i = 0; i < 1; i++) {
            FrameLayout frameLayout = new FrameLayout(context);
            this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(-1, 50));
            frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            this.inputFields[i] = new EditTextBoldCursor(context);
            this.inputFields[i].setTag(Integer.valueOf(i));
            this.inputFields[i].setTextSize(1, 16.0f);
            this.inputFields[i].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.inputFields[i].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i].setBackgroundDrawable(null);
            this.inputFields[i].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[i].setCursorWidth(1.5f);
            int i2 = 3;
            this.inputFields[i].setInputType(3);
            this.inputFields[i].setImeOptions(268435462);
            this.inputFields[i].setHint(LocaleController.getString("PassportEmailCode", R.string.PassportEmailCode));
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[i].setSelection(editTextBoldCursorArr[i].length());
            this.inputFields[i].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            EditTextBoldCursor editTextBoldCursor = this.inputFields[i];
            if (LocaleController.isRTL) {
                i2 = 5;
            }
            editTextBoldCursor.setGravity(i2);
            frameLayout.addView(this.inputFields[i], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[i].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$WZLnEhT_u_kXBXFDuOQNkwzIrNc */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createEmailVerificationInterface$5$PassportActivity(textView, i, keyEvent);
                }
            });
            this.inputFields[i].addTextChangedListener(new TextWatcher() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass6 */

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void afterTextChanged(Editable editable) {
                    if (!PassportActivity.this.ignoreOnTextChange && PassportActivity.this.emailCodeLength != 0 && PassportActivity.this.inputFields[0].length() == PassportActivity.this.emailCodeLength) {
                        PassportActivity.this.doneItem.callOnClick();
                    }
                }
            });
        }
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, this.currentValues.get("email")));
        this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
    }

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

    private void createPasswordInterface(Context context) {
        TLRPC.User user;
        if (this.currentForm != null) {
            int i = 0;
            while (true) {
                if (i >= this.currentForm.users.size()) {
                    user = null;
                    break;
                }
                user = this.currentForm.users.get(i);
                if (user.id == this.currentBotId) {
                    break;
                }
                i++;
            }
        } else {
            user = UserConfig.getInstance(this.currentAccount).getCurrentUser();
        }
        this.actionBar.setTitle(LocaleController.getString("AppPassport", R.string.AppPassport));
        EmptyTextProgressView emptyTextProgressView = new EmptyTextProgressView(context);
        this.emptyView = emptyTextProgressView;
        emptyTextProgressView.showProgress();
        ((FrameLayout) this.fragmentView).addView(this.emptyView, LayoutHelper.createFrame(-1, -1.0f));
        FrameLayout frameLayout = new FrameLayout(context);
        this.passwordAvatarContainer = frameLayout;
        this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(-1, 100));
        BackupImageView backupImageView = new BackupImageView(context);
        backupImageView.setRoundRadius(AndroidUtilities.dp(32.0f));
        this.passwordAvatarContainer.addView(backupImageView, LayoutHelper.createFrame(64.0f, 64.0f, 17, 0.0f, 8.0f, 0.0f, 0.0f));
        backupImageView.setImage(ImageLocation.getForUser(user, false), "50_50", new AvatarDrawable(user), user);
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.passwordRequestTextView = textInfoPrivacyCell;
        textInfoPrivacyCell.getTextView().setGravity(1);
        if (this.currentBotId == 0) {
            this.passwordRequestTextView.setText(LocaleController.getString("PassportSelfRequest", R.string.PassportSelfRequest));
        } else {
            this.passwordRequestTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(user))));
        }
        ((FrameLayout.LayoutParams) this.passwordRequestTextView.getTextView().getLayoutParams()).gravity = 1;
        int i2 = 5;
        this.linearLayout2.addView(this.passwordRequestTextView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 0.0f, 21.0f, 0.0f));
        ImageView imageView = new ImageView(context);
        this.noPasswordImageView = imageView;
        imageView.setImageResource(R.drawable.no_password);
        this.noPasswordImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_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(Theme.key_windowBackgroundWhiteGrayText4));
        this.noPasswordTextView.setText(LocaleController.getString("AppPassportCreatePasswordInfo", R.string.AppPassportCreatePasswordInfo));
        this.linearLayout2.addView(this.noPasswordTextView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 10.0f, 21.0f, 0.0f));
        TextView textView2 = new TextView(context);
        this.noPasswordSetTextView = textView2;
        textView2.setTextColor(Theme.getColor(Theme.key_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", R.string.AppPassportCreatePassword));
        this.linearLayout2.addView(this.noPasswordSetTextView, LayoutHelper.createFrame(-1.0f, 24.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 9.0f, 21.0f, 0.0f));
        this.noPasswordSetTextView.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$hR9hpiWwsB1b4JsZCeAnKBSbvSA */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createPasswordInterface$6$PassportActivity(view);
            }
        });
        this.inputFields = new EditTextBoldCursor[1];
        this.inputFieldContainers = new ViewGroup[1];
        for (int i3 = 0; i3 < 1; i3++) {
            this.inputFieldContainers[i3] = new FrameLayout(context);
            this.linearLayout2.addView(this.inputFieldContainers[i3], LayoutHelper.createLinear(-1, 50));
            this.inputFieldContainers[i3].setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            this.inputFields[i3] = new EditTextBoldCursor(context);
            this.inputFields[i3].setTag(Integer.valueOf(i3));
            this.inputFields[i3].setTextSize(1, 16.0f);
            this.inputFields[i3].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.inputFields[i3].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i3].setBackgroundDrawable(null);
            this.inputFields[i3].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i3].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[i3].setCursorWidth(1.5f);
            this.inputFields[i3].setInputType(TsExtractor.TS_STREAM_TYPE_AC3);
            this.inputFields[i3].setMaxLines(1);
            this.inputFields[i3].setLines(1);
            this.inputFields[i3].setSingleLine(true);
            this.inputFields[i3].setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.inputFields[i3].setTypeface(Typeface.DEFAULT);
            this.inputFields[i3].setImeOptions(268435462);
            this.inputFields[i3].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            this.inputFields[i3].setGravity(LocaleController.isRTL ? 5 : 3);
            this.inputFieldContainers[i3].addView(this.inputFields[i3], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$hba8VGEhoc1_gk_alGQWLWuq_HU */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createPasswordInterface$7$PassportActivity(textView, i, keyEvent);
                }
            });
            this.inputFields[i3].setCustomSelectionActionModeCallback(new ActionMode.Callback() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass7 */

                public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
                    return false;
                }

                public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
                    return false;
                }

                public void onDestroyActionMode(ActionMode actionMode) {
                }

                public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
                    return false;
                }
            });
        }
        TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
        this.passwordInfoRequestTextView = textInfoPrivacyCell2;
        textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.passwordInfoRequestTextView.setText(LocaleController.formatString("PassportRequestPasswordInfo", R.string.PassportRequestPasswordInfo, new Object[0]));
        this.linearLayout2.addView(this.passwordInfoRequestTextView, LayoutHelper.createLinear(-1, -2));
        TextView textView3 = new TextView(context);
        this.passwordForgotButton = textView3;
        textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
        this.passwordForgotButton.setTextSize(1, 14.0f);
        this.passwordForgotButton.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
        this.passwordForgotButton.setPadding(0, 0, 0, 0);
        LinearLayout linearLayout = this.linearLayout2;
        TextView textView4 = this.passwordForgotButton;
        if (!LocaleController.isRTL) {
            i2 = 3;
        }
        linearLayout.addView(textView4, LayoutHelper.createLinear(-2, 30, i2 | 48, 21, 0, 21, 0));
        this.passwordForgotButton.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$evWCi7_gYokpTEclSOCkDVIGV3Q */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createPasswordInterface$12$PassportActivity(view);
            }
        });
        updatePasswordInterface();
    }

    public /* synthetic */ void lambda$createPasswordInterface$6$PassportActivity(View view) {
        TwoStepVerificationActivity twoStepVerificationActivity = new TwoStepVerificationActivity(this.currentAccount, 1);
        twoStepVerificationActivity.setCloseAfterSet(true);
        twoStepVerificationActivity.setCurrentPasswordInfo(new byte[0], this.currentPassword);
        presentFragment(twoStepVerificationActivity);
    }

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

    public /* synthetic */ void lambda$createPasswordInterface$12$PassportActivity(View view) {
        if (this.currentPassword.has_recovery) {
            needShowProgress();
            ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(new TLRPC.TL_auth_requestPasswordRecovery(), new RequestDelegate() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$F9PFpey7ToUY92rc13G_qt1owrc */

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    PassportActivity.this.lambda$null$10$PassportActivity(tLObject, tL_error);
                }
            }, 10), this.classGuid);
        } else if (getParentActivity() != null) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            builder.setNegativeButton(LocaleController.getString("RestorePasswordResetAccount", R.string.RestorePasswordResetAccount), new DialogInterface.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$qwGer_j3ulLjABiPx1o5mzoQw */

                public final void onClick(DialogInterface dialogInterface, int i) {
                    PassportActivity.this.lambda$null$11$PassportActivity(dialogInterface, i);
                }
            });
            builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
            builder.setMessage(LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
            showDialog(builder.create());
        }
    }

    public /* synthetic */ void lambda$null$10$PassportActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$FDDRAxNc_p25sNzl2dpA5uGj0Gc */
            private final /* synthetic */ TLRPC.TL_error f$1;
            private final /* synthetic */ TLObject f$2;

            {
                this.f$1 = r2;
                this.f$2 = r3;
            }

            public final void run() {
                PassportActivity.this.lambda$null$9$PassportActivity(this.f$1, this.f$2);
            }
        });
    }

    public /* synthetic */ void lambda$null$9$PassportActivity(TLRPC.TL_error tL_error, TLObject tLObject) {
        String str;
        needHideProgress();
        if (tL_error == null) {
            TLRPC.TL_auth_passwordRecovery tL_auth_passwordRecovery = (TLRPC.TL_auth_passwordRecovery) tLObject;
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setMessage(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, tL_auth_passwordRecovery.email_pattern));
            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(tL_auth_passwordRecovery) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$LsgslCeGlWu5ZqDrDm9yJhYPR8 */
                private final /* synthetic */ TLRPC.TL_auth_passwordRecovery f$1;

                {
                    this.f$1 = r2;
                }

                public final void onClick(DialogInterface dialogInterface, int i) {
                    PassportActivity.this.lambda$null$8$PassportActivity(this.f$1, dialogInterface, i);
                }
            });
            Dialog showDialog = showDialog(builder.create());
            if (showDialog != null) {
                showDialog.setCanceledOnTouchOutside(false);
                showDialog.setCancelable(false);
            }
        } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
            int intValue = Utilities.parseInt(tL_error.text).intValue();
            if (intValue < 60) {
                str = LocaleController.formatPluralString("Seconds", intValue);
            } else {
                str = LocaleController.formatPluralString("Minutes", intValue / 60);
            }
            showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
        } else {
            showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
        }
    }

    public /* synthetic */ void lambda$null$8$PassportActivity(TLRPC.TL_auth_passwordRecovery tL_auth_passwordRecovery, DialogInterface dialogInterface, int i) {
        TwoStepVerificationActivity twoStepVerificationActivity = new TwoStepVerificationActivity(this.currentAccount, 1);
        twoStepVerificationActivity.setRecoveryParams(this.currentPassword);
        this.currentPassword.email_unconfirmed_pattern = tL_auth_passwordRecovery.email_pattern;
        presentFragment(twoStepVerificationActivity);
    }

    public /* synthetic */ void lambda$null$11$PassportActivity(DialogInterface dialogInterface, int i) {
        FragmentActivity parentActivity = getParentActivity();
        Browser.openUrl(parentActivity, "https://m12345.cc/deactivate?phone=" + UserConfig.getInstance(this.currentAccount).getClientPhone());
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void onPasswordDone(boolean z) {
        String str;
        if (z) {
            str = null;
        } else {
            str = this.inputFields[0].getText().toString();
            if (TextUtils.isEmpty(str)) {
                onPasscodeError(false);
                return;
            }
            showEditDoneProgress(true, true);
        }
        Utilities.globalQueue.postRunnable(new Runnable(z, str) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$n7v32fB0f0utr26yz4oPOWUKbM */
            private final /* synthetic */ boolean f$1;
            private final /* synthetic */ String f$2;

            {
                this.f$1 = r2;
                this.f$2 = r3;
            }

            public final void run() {
                PassportActivity.this.lambda$onPasswordDone$13$PassportActivity(this.f$1, this.f$2);
            }
        });
    }

    /* JADX WARNING: Removed duplicated region for block: B:10:0x0037  */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x0074  */
    public /* synthetic */ void lambda$onPasswordDone$13$PassportActivity(final boolean z, final String str) {
        final byte[] bArr;
        byte[] x;
        final TLRPC.TL_account_getPasswordSettings tL_account_getPasswordSettings = new TLRPC.TL_account_getPasswordSettings();
        if (z) {
            x = this.savedPasswordHash;
        } else if (this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
            x = SRPHelper.getX(AndroidUtilities.getStringBytes(str), (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) this.currentPassword.current_algo);
        } else {
            bArr = null;
            AnonymousClass8 r9 = new RequestDelegate() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass8 */

                private void openRequestInterface() {
                    if (PassportActivity.this.inputFields != null) {
                        if (!z) {
                            UserConfig.getInstance(PassportActivity.this.currentAccount).savePassword(bArr, PassportActivity.this.saltedPassword);
                        }
                        AndroidUtilities.hideKeyboard(PassportActivity.this.inputFields[0]);
                        PassportActivity.this.ignoreOnFailure = true;
                        PassportActivity passportActivity = new PassportActivity(PassportActivity.this.currentBotId == 0 ? 8 : 0, PassportActivity.this.currentBotId, PassportActivity.this.currentScope, PassportActivity.this.currentPublicKey, PassportActivity.this.currentPayload, PassportActivity.this.currentNonce, PassportActivity.this.currentCallbackUrl, PassportActivity.this.currentForm, PassportActivity.this.currentPassword);
                        passportActivity.currentEmail = PassportActivity.this.currentEmail;
                        passportActivity.currentAccount = PassportActivity.this.currentAccount;
                        passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
                        passportActivity.secureSecret = PassportActivity.this.secureSecret;
                        passportActivity.secureSecretId = PassportActivity.this.secureSecretId;
                        passportActivity.needActivityResult = PassportActivity.this.needActivityResult;
                        if (PassportActivity.this.parentLayout == null || !PassportActivity.this.parentLayout.checkTransitionAnimation()) {
                            PassportActivity.this.presentFragment(passportActivity, true);
                        } else {
                            PassportActivity.this.presentAfterAnimation = passportActivity;
                        }
                    }
                }

                private void resetSecret() {
                    TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings = new TLRPC.TL_account_updatePasswordSettings();
                    if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                        tL_account_updatePasswordSettings.password = SRPHelper.startCheck(bArr, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) PassportActivity.this.currentPassword.current_algo);
                    }
                    tL_account_updatePasswordSettings.new_settings = new TLRPC.TL_account_passwordInputSettings();
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret = new byte[0];
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown();
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret_id = 0;
                    tL_account_updatePasswordSettings.new_settings.flags |= 4;
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_getPasswordSettings, new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$38zZm2pP54MCR3x6xWK6GTh4ALs */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$resetSecret$3$PassportActivity$8(tLObject, tL_error);
                        }
                    });
                }

                public /* synthetic */ void lambda$resetSecret$3$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$scwzPPm_EruwY8sJ9YCT6U6bn8 */
                        private final /* synthetic */ TLRPC.TL_error f$1;

                        {
                            this.f$1 = r2;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$2$PassportActivity$8(this.f$1);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$2$PassportActivity$8(TLRPC.TL_error tL_error) {
                    if (tL_error == null || !"SRP_ID_INVALID".equals(tL_error.text)) {
                        generateNewSecret();
                        return;
                    }
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$LbQ4IoFKZjzMyQAbbETldNDxYc */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$null$1$PassportActivity$8(tLObject, tL_error);
                        }
                    }, 8);
                }

                public /* synthetic */ void lambda$null$1$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$AWMVGXhT5T5IxifmyDh9KYzJXU */
                        private final /* synthetic */ TLRPC.TL_error f$1;
                        private final /* synthetic */ TLObject f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$0$PassportActivity$8(this.f$1, this.f$2);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$0$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject) {
                    if (tL_error == null) {
                        PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                        TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                        resetSecret();
                    }
                }

                private void generateNewSecret() {
                    Utilities.globalQueue.postRunnable(new Runnable(bArr, str) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$3eUUDQT4f6Jd43biWMN6Zvk74Jg */
                        private final /* synthetic */ byte[] f$1;
                        private final /* synthetic */ String f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$8$PassportActivity$8(this.f$1, this.f$2);
                        }
                    });
                }

                public /* synthetic */ void lambda$generateNewSecret$8$PassportActivity$8(byte[] bArr, String str) {
                    Utilities.random.setSeed(PassportActivity.this.currentPassword.secure_random);
                    TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings = new TLRPC.TL_account_updatePasswordSettings();
                    if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                        tL_account_updatePasswordSettings.password = SRPHelper.startCheck(bArr, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) PassportActivity.this.currentPassword.current_algo);
                    }
                    tL_account_updatePasswordSettings.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 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) PassportActivity.this.currentPassword.new_secure_algo;
                        PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
                        byte[] bArr2 = new byte[32];
                        System.arraycopy(PassportActivity.this.saltedPassword, 0, bArr2, 0, 32);
                        byte[] bArr3 = new byte[16];
                        System.arraycopy(PassportActivity.this.saltedPassword, 32, bArr3, 0, 16);
                        Utilities.aesCbcEncryptionByteArraySafe(PassportActivity.this.secureSecret, bArr2, bArr3, 0, PassportActivity.this.secureSecret.length, 0, 1);
                        tL_account_updatePasswordSettings.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                        tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_algo = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000;
                        tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret = PassportActivity.this.secureSecret;
                        tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret_id = PassportActivity.this.secureSecretId;
                        tL_account_updatePasswordSettings.new_settings.flags |= 4;
                    }
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_updatePasswordSettings, new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$GccIdeFLsLIIVp5ESXYCJUggCKE */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$null$7$PassportActivity$8(tLObject, tL_error);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$7$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$nuXHgIpWzIX7STzYBiWzDqWCM0 */
                        private final /* synthetic */ TLRPC.TL_error f$1;

                        {
                            this.f$1 = r2;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$6$PassportActivity$8(this.f$1);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$6$PassportActivity$8(TLRPC.TL_error tL_error) {
                    if (tL_error == null || !"SRP_ID_INVALID".equals(tL_error.text)) {
                        if (PassportActivity.this.currentForm == null) {
                            PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                        }
                        openRequestInterface();
                        return;
                    }
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$wntz5S2Lj0GCJ5UWyY0qLoql7Cc */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$null$5$PassportActivity$8(tLObject, tL_error);
                        }
                    }, 8);
                }

                public /* synthetic */ void lambda$null$5$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$NaicAjbIaDudAEUZjkt_FxHNO0 */
                        private final /* synthetic */ TLRPC.TL_error f$1;
                        private final /* synthetic */ TLObject f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$4$PassportActivity$8(this.f$1, this.f$2);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$4$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject) {
                    if (tL_error == null) {
                        PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                        TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                        generateNewSecret();
                    }
                }

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate(z) {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$1dafluYU2rbaLNRM0vyHM8SAm2g */
                            private final /* synthetic */ boolean f$1;

                            {
                                this.f$1 = r2;
                            }

                            @Override // im.guobwnxjuc.tgnet.RequestDelegate
                            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                PassportActivity.AnonymousClass8.this.lambda$run$10$PassportActivity$8(this.f$1, tLObject, tL_error);
                            }
                        }, 8);
                    } else if (tL_error == null) {
                        Utilities.globalQueue.postRunnable(new Runnable(tLObject, str, z) {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$y3Vo03qD9TriipbEiV8ptgpbm7Q */
                            private final /* synthetic */ TLObject f$1;
                            private final /* synthetic */ String f$2;
                            private final /* synthetic */ boolean f$3;

                            {
                                this.f$1 = r2;
                                this.f$2 = r3;
                                this.f$3 = r4;
                            }

                            public final void run() {
                                PassportActivity.AnonymousClass8.this.lambda$run$15$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                            }
                        });
                    } else {
                        AndroidUtilities.runOnUIThread(new Runnable(z, tL_error) {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$vJxCcsMbpuq9nCq8VZxCfoIwWEU */
                            private final /* synthetic */ boolean f$1;
                            private final /* synthetic */ TLRPC.TL_error f$2;

                            {
                                this.f$1 = r2;
                                this.f$2 = r3;
                            }

                            public final void run() {
                                PassportActivity.AnonymousClass8.this.lambda$run$16$PassportActivity$8(this.f$1, this.f$2);
                            }
                        });
                    }
                }

                public /* synthetic */ void lambda$run$10$PassportActivity$8(boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject, z) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$TlmTSEnWcZ2Q5rCi0nEo_9kAERU */
                        private final /* synthetic */ TLRPC.TL_error f$1;
                        private final /* synthetic */ TLObject f$2;
                        private final /* synthetic */ boolean f$3;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                            this.f$3 = r4;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$9$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$9$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject, boolean z) {
                    if (tL_error == null) {
                        PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                        TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                        PassportActivity.this.onPasswordDone(z);
                    }
                }

                public /* synthetic */ void lambda$run$15$PassportActivity$8(TLObject tLObject, String str, boolean z) {
                    byte[] bArr;
                    TLRPC.TL_account_passwordSettings tL_account_passwordSettings = (TLRPC.TL_account_passwordSettings) tLObject;
                    if (tL_account_passwordSettings.secure_settings != null) {
                        PassportActivity.this.secureSecret = tL_account_passwordSettings.secure_settings.secure_secret;
                        PassportActivity.this.secureSecretId = tL_account_passwordSettings.secure_settings.secure_secret_id;
                        if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoSHA512) {
                            bArr = ((TLRPC.TL_securePasswordKdfAlgoSHA512) tL_account_passwordSettings.secure_settings.secure_algo).salt;
                            PassportActivity.this.saltedPassword = Utilities.computeSHA512(bArr, AndroidUtilities.getStringBytes(str), bArr);
                        } else if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                            TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) tL_account_passwordSettings.secure_settings.secure_algo;
                            byte[] bArr2 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt;
                            PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
                            bArr = bArr2;
                        } else if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoUnknown) {
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$l7yJTt81aA52zhjbJxlecx9JpcM */

                                public final void run() {
                                    PassportActivity.AnonymousClass8.this.lambda$null$11$PassportActivity$8();
                                }
                            });
                            return;
                        } else {
                            bArr = new byte[0];
                        }
                    } else {
                        if (PassportActivity.this.currentPassword.new_secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                            TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) PassportActivity.this.currentPassword.new_secure_algo;
                            byte[] bArr3 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt;
                            PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt);
                            bArr = bArr3;
                        } else {
                            bArr = new byte[0];
                        }
                        PassportActivity.this.secureSecret = null;
                        PassportActivity.this.secureSecretId = 0;
                    }
                    AndroidUtilities.runOnUIThread(new Runnable(tL_account_passwordSettings, z, bArr) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$AmVZZjoUmpLRinvBsryZknPYvw */
                        private final /* synthetic */ TLRPC.TL_account_passwordSettings f$1;
                        private final /* synthetic */ boolean f$2;
                        private final /* synthetic */ byte[] f$3;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                            this.f$3 = r4;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$14$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$11$PassportActivity$8() {
                    AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                }

                public /* synthetic */ void lambda$null$14$PassportActivity$8(TLRPC.TL_account_passwordSettings tL_account_passwordSettings, boolean z, byte[] bArr) {
                    PassportActivity.this.currentEmail = tL_account_passwordSettings.email;
                    if (z) {
                        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.this.secureSecretId)) || bArr.length == 0 || PassportActivity.this.secureSecretId == 0) {
                        if (z) {
                            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();
                        }
                    } else if (PassportActivity.this.currentBotId == 0) {
                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getAllSecureValues(), new RequestDelegate() {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$tAbtTg9ejjTuqg7gKVjrQyEEh8U */

                            @Override // im.guobwnxjuc.tgnet.RequestDelegate
                            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                PassportActivity.AnonymousClass8.this.lambda$null$13$PassportActivity$8(tLObject, tL_error);
                            }
                        });
                    } else {
                        openRequestInterface();
                    }
                }

                public /* synthetic */ void lambda$null$13$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    AndroidUtilities.runOnUIThread(new Runnable(tLObject, tL_error) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$c92_vZ030VVtNrah96HuPYY7n0 */
                        private final /* synthetic */ TLObject f$1;
                        private final /* synthetic */ TLRPC.TL_error f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$null$12$PassportActivity$8(this.f$1, this.f$2);
                        }
                    });
                }

                public /* synthetic */ void lambda$null$12$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                    if (tLObject != null) {
                        PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                        TLRPC.Vector vector = (TLRPC.Vector) tLObject;
                        int size = vector.objects.size();
                        for (int i = 0; i < size; i++) {
                            PassportActivity.this.currentForm.values.add((TLRPC.TL_secureValue) vector.objects.get(i));
                        }
                        openRequestInterface();
                        return;
                    }
                    if ("APP_VERSION_OUTDATED".equals(tL_error.text)) {
                        AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                    } else {
                        PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                    }
                    PassportActivity.this.showEditDoneProgress(true, false);
                }

                public /* synthetic */ void lambda$run$16$PassportActivity$8(boolean z, TLRPC.TL_error tL_error) {
                    String str;
                    if (z) {
                        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 (tL_error.text.equals("PASSWORD_HASH_INVALID")) {
                        PassportActivity.this.onPasscodeError(true);
                    } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                        int intValue = Utilities.parseInt(tL_error.text).intValue();
                        if (intValue < 60) {
                            str = LocaleController.formatPluralString("Seconds", intValue);
                        } else {
                            str = LocaleController.formatPluralString("Minutes", intValue / 60);
                        }
                        PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
                    } else {
                        PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                    }
                }
            };
            if (!(this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
                tL_account_getPasswordSettings.password = SRPHelper.startCheck(bArr, this.currentPassword.srp_id, this.currentPassword.srp_B, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) this.currentPassword.current_algo);
                if (tL_account_getPasswordSettings.password == null) {
                    TLRPC.TL_error tL_error = new TLRPC.TL_error();
                    tL_error.text = "ALGO_INVALID";
                    r9.run(null, tL_error);
                    return;
                }
                ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_getPasswordSettings, r9, 10), this.classGuid);
                return;
            }
            TLRPC.TL_error tL_error2 = new TLRPC.TL_error();
            tL_error2.text = "PASSWORD_HASH_INVALID";
            r9.run(null, tL_error2);
            return;
        }
        bArr = x;
        AnonymousClass8 r92 = new RequestDelegate() {
            /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass8 */

            private void openRequestInterface() {
                if (PassportActivity.this.inputFields != null) {
                    if (!z) {
                        UserConfig.getInstance(PassportActivity.this.currentAccount).savePassword(bArr, PassportActivity.this.saltedPassword);
                    }
                    AndroidUtilities.hideKeyboard(PassportActivity.this.inputFields[0]);
                    PassportActivity.this.ignoreOnFailure = true;
                    PassportActivity passportActivity = new PassportActivity(PassportActivity.this.currentBotId == 0 ? 8 : 0, PassportActivity.this.currentBotId, PassportActivity.this.currentScope, PassportActivity.this.currentPublicKey, PassportActivity.this.currentPayload, PassportActivity.this.currentNonce, PassportActivity.this.currentCallbackUrl, PassportActivity.this.currentForm, PassportActivity.this.currentPassword);
                    passportActivity.currentEmail = PassportActivity.this.currentEmail;
                    passportActivity.currentAccount = PassportActivity.this.currentAccount;
                    passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
                    passportActivity.secureSecret = PassportActivity.this.secureSecret;
                    passportActivity.secureSecretId = PassportActivity.this.secureSecretId;
                    passportActivity.needActivityResult = PassportActivity.this.needActivityResult;
                    if (PassportActivity.this.parentLayout == null || !PassportActivity.this.parentLayout.checkTransitionAnimation()) {
                        PassportActivity.this.presentFragment(passportActivity, true);
                    } else {
                        PassportActivity.this.presentAfterAnimation = passportActivity;
                    }
                }
            }

            private void resetSecret() {
                TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings = new TLRPC.TL_account_updatePasswordSettings();
                if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                    tL_account_updatePasswordSettings.password = SRPHelper.startCheck(bArr, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) PassportActivity.this.currentPassword.current_algo);
                }
                tL_account_updatePasswordSettings.new_settings = new TLRPC.TL_account_passwordInputSettings();
                tL_account_updatePasswordSettings.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret = new byte[0];
                tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown();
                tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret_id = 0;
                tL_account_updatePasswordSettings.new_settings.flags |= 4;
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_getPasswordSettings, new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$38zZm2pP54MCR3x6xWK6GTh4ALs */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        PassportActivity.AnonymousClass8.this.lambda$resetSecret$3$PassportActivity$8(tLObject, tL_error);
                    }
                });
            }

            public /* synthetic */ void lambda$resetSecret$3$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$scwzPPm_EruwY8sJ9YCT6U6bn8 */
                    private final /* synthetic */ TLRPC.TL_error f$1;

                    {
                        this.f$1 = r2;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$2$PassportActivity$8(this.f$1);
                    }
                });
            }

            public /* synthetic */ void lambda$null$2$PassportActivity$8(TLRPC.TL_error tL_error) {
                if (tL_error == null || !"SRP_ID_INVALID".equals(tL_error.text)) {
                    generateNewSecret();
                    return;
                }
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$LbQ4IoFKZjzMyQAbbETldNDxYc */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        PassportActivity.AnonymousClass8.this.lambda$null$1$PassportActivity$8(tLObject, tL_error);
                    }
                }, 8);
            }

            public /* synthetic */ void lambda$null$1$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$AWMVGXhT5T5IxifmyDh9KYzJXU */
                    private final /* synthetic */ TLRPC.TL_error f$1;
                    private final /* synthetic */ TLObject f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$0$PassportActivity$8(this.f$1, this.f$2);
                    }
                });
            }

            public /* synthetic */ void lambda$null$0$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject) {
                if (tL_error == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    resetSecret();
                }
            }

            private void generateNewSecret() {
                Utilities.globalQueue.postRunnable(new Runnable(bArr, str) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$3eUUDQT4f6Jd43biWMN6Zvk74Jg */
                    private final /* synthetic */ byte[] f$1;
                    private final /* synthetic */ String f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$8$PassportActivity$8(this.f$1, this.f$2);
                    }
                });
            }

            public /* synthetic */ void lambda$generateNewSecret$8$PassportActivity$8(byte[] bArr, String str) {
                Utilities.random.setSeed(PassportActivity.this.currentPassword.secure_random);
                TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings = new TLRPC.TL_account_updatePasswordSettings();
                if (PassportActivity.this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                    tL_account_updatePasswordSettings.password = SRPHelper.startCheck(bArr, PassportActivity.this.currentPassword.srp_id, PassportActivity.this.currentPassword.srp_B, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) PassportActivity.this.currentPassword.current_algo);
                }
                tL_account_updatePasswordSettings.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 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) PassportActivity.this.currentPassword.new_secure_algo;
                    PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
                    byte[] bArr2 = new byte[32];
                    System.arraycopy(PassportActivity.this.saltedPassword, 0, bArr2, 0, 32);
                    byte[] bArr3 = new byte[16];
                    System.arraycopy(PassportActivity.this.saltedPassword, 32, bArr3, 0, 16);
                    Utilities.aesCbcEncryptionByteArraySafe(PassportActivity.this.secureSecret, bArr2, bArr3, 0, PassportActivity.this.secureSecret.length, 0, 1);
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_algo = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000;
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret = PassportActivity.this.secureSecret;
                    tL_account_updatePasswordSettings.new_settings.new_secure_settings.secure_secret_id = PassportActivity.this.secureSecretId;
                    tL_account_updatePasswordSettings.new_settings.flags |= 4;
                }
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_updatePasswordSettings, new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$GccIdeFLsLIIVp5ESXYCJUggCKE */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        PassportActivity.AnonymousClass8.this.lambda$null$7$PassportActivity$8(tLObject, tL_error);
                    }
                });
            }

            public /* synthetic */ void lambda$null$7$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$nuXHgIpWzIX7STzYBiWzDqWCM0 */
                    private final /* synthetic */ TLRPC.TL_error f$1;

                    {
                        this.f$1 = r2;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$6$PassportActivity$8(this.f$1);
                    }
                });
            }

            public /* synthetic */ void lambda$null$6$PassportActivity$8(TLRPC.TL_error tL_error) {
                if (tL_error == null || !"SRP_ID_INVALID".equals(tL_error.text)) {
                    if (PassportActivity.this.currentForm == null) {
                        PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                    }
                    openRequestInterface();
                    return;
                }
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$wntz5S2Lj0GCJ5UWyY0qLoql7Cc */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        PassportActivity.AnonymousClass8.this.lambda$null$5$PassportActivity$8(tLObject, tL_error);
                    }
                }, 8);
            }

            public /* synthetic */ void lambda$null$5$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$NaicAjbIaDudAEUZjkt_FxHNO0 */
                    private final /* synthetic */ TLRPC.TL_error f$1;
                    private final /* synthetic */ TLObject f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$4$PassportActivity$8(this.f$1, this.f$2);
                    }
                });
            }

            public /* synthetic */ void lambda$null$4$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject) {
                if (tL_error == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    generateNewSecret();
                }
            }

            @Override // im.guobwnxjuc.tgnet.RequestDelegate
            public void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate(z) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$1dafluYU2rbaLNRM0vyHM8SAm2g */
                        private final /* synthetic */ boolean f$1;

                        {
                            this.f$1 = r2;
                        }

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$run$10$PassportActivity$8(this.f$1, tLObject, tL_error);
                        }
                    }, 8);
                } else if (tL_error == null) {
                    Utilities.globalQueue.postRunnable(new Runnable(tLObject, str, z) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$y3Vo03qD9TriipbEiV8ptgpbm7Q */
                        private final /* synthetic */ TLObject f$1;
                        private final /* synthetic */ String f$2;
                        private final /* synthetic */ boolean f$3;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                            this.f$3 = r4;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$run$15$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                        }
                    });
                } else {
                    AndroidUtilities.runOnUIThread(new Runnable(z, tL_error) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$vJxCcsMbpuq9nCq8VZxCfoIwWEU */
                        private final /* synthetic */ boolean f$1;
                        private final /* synthetic */ TLRPC.TL_error f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        public final void run() {
                            PassportActivity.AnonymousClass8.this.lambda$run$16$PassportActivity$8(this.f$1, this.f$2);
                        }
                    });
                }
            }

            public /* synthetic */ void lambda$run$10$PassportActivity$8(boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject, z) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$TlmTSEnWcZ2Q5rCi0nEo_9kAERU */
                    private final /* synthetic */ TLRPC.TL_error f$1;
                    private final /* synthetic */ TLObject f$2;
                    private final /* synthetic */ boolean f$3;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                        this.f$3 = r4;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$9$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                    }
                });
            }

            public /* synthetic */ void lambda$null$9$PassportActivity$8(TLRPC.TL_error tL_error, TLObject tLObject, boolean z) {
                if (tL_error == null) {
                    PassportActivity.this.currentPassword = (TLRPC.TL_account_password) tLObject;
                    TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
                    PassportActivity.this.onPasswordDone(z);
                }
            }

            public /* synthetic */ void lambda$run$15$PassportActivity$8(TLObject tLObject, String str, boolean z) {
                byte[] bArr;
                TLRPC.TL_account_passwordSettings tL_account_passwordSettings = (TLRPC.TL_account_passwordSettings) tLObject;
                if (tL_account_passwordSettings.secure_settings != null) {
                    PassportActivity.this.secureSecret = tL_account_passwordSettings.secure_settings.secure_secret;
                    PassportActivity.this.secureSecretId = tL_account_passwordSettings.secure_settings.secure_secret_id;
                    if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoSHA512) {
                        bArr = ((TLRPC.TL_securePasswordKdfAlgoSHA512) tL_account_passwordSettings.secure_settings.secure_algo).salt;
                        PassportActivity.this.saltedPassword = Utilities.computeSHA512(bArr, AndroidUtilities.getStringBytes(str), bArr);
                    } else if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                        TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) tL_account_passwordSettings.secure_settings.secure_algo;
                        byte[] bArr2 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt;
                        PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
                        bArr = bArr2;
                    } else if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoUnknown) {
                        AndroidUtilities.runOnUIThread(new Runnable() {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$l7yJTt81aA52zhjbJxlecx9JpcM */

                            public final void run() {
                                PassportActivity.AnonymousClass8.this.lambda$null$11$PassportActivity$8();
                            }
                        });
                        return;
                    } else {
                        bArr = new byte[0];
                    }
                } else {
                    if (PassportActivity.this.currentPassword.new_secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
                        TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) PassportActivity.this.currentPassword.new_secure_algo;
                        byte[] bArr3 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt;
                        PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt);
                        bArr = bArr3;
                    } else {
                        bArr = new byte[0];
                    }
                    PassportActivity.this.secureSecret = null;
                    PassportActivity.this.secureSecretId = 0;
                }
                AndroidUtilities.runOnUIThread(new Runnable(tL_account_passwordSettings, z, bArr) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$AmVZZjoUmpLRinvBsryZknPYvw */
                    private final /* synthetic */ TLRPC.TL_account_passwordSettings f$1;
                    private final /* synthetic */ boolean f$2;
                    private final /* synthetic */ byte[] f$3;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                        this.f$3 = r4;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$14$PassportActivity$8(this.f$1, this.f$2, this.f$3);
                    }
                });
            }

            public /* synthetic */ void lambda$null$11$PassportActivity$8() {
                AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
            }

            public /* synthetic */ void lambda$null$14$PassportActivity$8(TLRPC.TL_account_passwordSettings tL_account_passwordSettings, boolean z, byte[] bArr) {
                PassportActivity.this.currentEmail = tL_account_passwordSettings.email;
                if (z) {
                    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.this.secureSecretId)) || bArr.length == 0 || PassportActivity.this.secureSecretId == 0) {
                    if (z) {
                        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();
                    }
                } else if (PassportActivity.this.currentBotId == 0) {
                    ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getAllSecureValues(), new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$tAbtTg9ejjTuqg7gKVjrQyEEh8U */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            PassportActivity.AnonymousClass8.this.lambda$null$13$PassportActivity$8(tLObject, tL_error);
                        }
                    });
                } else {
                    openRequestInterface();
                }
            }

            public /* synthetic */ void lambda$null$13$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                AndroidUtilities.runOnUIThread(new Runnable(tLObject, tL_error) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$8$c92_vZ030VVtNrah96HuPYY7n0 */
                    private final /* synthetic */ TLObject f$1;
                    private final /* synthetic */ TLRPC.TL_error f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void run() {
                        PassportActivity.AnonymousClass8.this.lambda$null$12$PassportActivity$8(this.f$1, this.f$2);
                    }
                });
            }

            public /* synthetic */ void lambda$null$12$PassportActivity$8(TLObject tLObject, TLRPC.TL_error tL_error) {
                if (tLObject != null) {
                    PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
                    TLRPC.Vector vector = (TLRPC.Vector) tLObject;
                    int size = vector.objects.size();
                    for (int i = 0; i < size; i++) {
                        PassportActivity.this.currentForm.values.add((TLRPC.TL_secureValue) vector.objects.get(i));
                    }
                    openRequestInterface();
                    return;
                }
                if ("APP_VERSION_OUTDATED".equals(tL_error.text)) {
                    AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                } else {
                    PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                }
                PassportActivity.this.showEditDoneProgress(true, false);
            }

            public /* synthetic */ void lambda$run$16$PassportActivity$8(boolean z, TLRPC.TL_error tL_error) {
                String str;
                if (z) {
                    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 (tL_error.text.equals("PASSWORD_HASH_INVALID")) {
                    PassportActivity.this.onPasscodeError(true);
                } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                    int intValue = Utilities.parseInt(tL_error.text).intValue();
                    if (intValue < 60) {
                        str = LocaleController.formatPluralString("Seconds", intValue);
                    } else {
                        str = LocaleController.formatPluralString("Minutes", intValue / 60);
                    }
                    PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
                } else {
                    PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                }
            }
        };
        if (!(this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
        }
    }

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

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

    private void createRequestInterface(Context context) {
        TLRPC.User user;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList;
        int i;
        boolean z;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList2;
        TLRPC.TL_secureRequiredType tL_secureRequiredType;
        TLRPC.TL_secureRequiredType tL_secureRequiredType2;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList3;
        TLRPC.TL_secureRequiredType tL_secureRequiredType3;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList4;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList5;
        int i2 = 0;
        if (this.currentForm != null) {
            int i3 = 0;
            while (true) {
                if (i3 >= this.currentForm.users.size()) {
                    break;
                }
                TLRPC.User user2 = this.currentForm.users.get(i3);
                if (user2.id == this.currentBotId) {
                    user = user2;
                    break;
                }
                i3++;
            }
        }
        user = null;
        FrameLayout frameLayout = (FrameLayout) this.fragmentView;
        this.actionBar.setTitle(LocaleController.getString("AppPassport", R.string.AppPassport));
        this.actionBar.createMenu().addItem(1, R.drawable.profile_info);
        if (user != null) {
            FrameLayout frameLayout2 = new FrameLayout(context);
            this.linearLayout2.addView(frameLayout2, LayoutHelper.createLinear(-1, 100));
            BackupImageView backupImageView = new BackupImageView(context);
            backupImageView.setRoundRadius(AndroidUtilities.dp(32.0f));
            frameLayout2.addView(backupImageView, LayoutHelper.createFrame(64.0f, 64.0f, 17, 0.0f, 8.0f, 0.0f, 0.0f));
            backupImageView.setImage(ImageLocation.getForUser(user, false), "50_50", new AvatarDrawable(user), user);
            TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell;
            textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow));
            this.bottomCell.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(user))));
            this.bottomCell.getTextView().setGravity(1);
            ((FrameLayout.LayoutParams) this.bottomCell.getTextView().getLayoutParams()).gravity = 1;
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
        }
        HeaderCell headerCell2 = new HeaderCell(context);
        this.headerCell = headerCell2;
        headerCell2.setText(LocaleController.getString("PassportRequestedInformation", R.string.PassportRequestedInformation));
        this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
        TLRPC.TL_account_authorizationForm tL_account_authorizationForm = this.currentForm;
        if (tL_account_authorizationForm != null) {
            int size = tL_account_authorizationForm.required_types.size();
            ArrayList<TLRPC.TL_secureRequiredType> arrayList6 = new ArrayList<>();
            ArrayList<TLRPC.TL_secureRequiredType> arrayList7 = new ArrayList<>();
            int i4 = 0;
            boolean z2 = false;
            int i5 = 0;
            int i6 = 0;
            boolean z3 = false;
            while (i4 < size) {
                TLRPC.SecureRequiredType secureRequiredType = this.currentForm.required_types.get(i4);
                if (secureRequiredType instanceof TLRPC.TL_secureRequiredType) {
                    TLRPC.TL_secureRequiredType tL_secureRequiredType4 = (TLRPC.TL_secureRequiredType) secureRequiredType;
                    if (isPersonalDocument(tL_secureRequiredType4.type)) {
                        arrayList6.add(tL_secureRequiredType4);
                        i5++;
                    } else if (isAddressDocument(tL_secureRequiredType4.type)) {
                        arrayList7.add(tL_secureRequiredType4);
                        i6++;
                    } else if (tL_secureRequiredType4.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                        z2 = true;
                    } else if (tL_secureRequiredType4.type instanceof TLRPC.TL_secureValueTypeAddress) {
                        z3 = true;
                    }
                } else if (secureRequiredType instanceof TLRPC.TL_secureRequiredTypeOneOf) {
                    TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf = (TLRPC.TL_secureRequiredTypeOneOf) secureRequiredType;
                    if (!tL_secureRequiredTypeOneOf.types.isEmpty()) {
                        TLRPC.SecureRequiredType secureRequiredType2 = tL_secureRequiredTypeOneOf.types.get(i2);
                        if (secureRequiredType2 instanceof TLRPC.TL_secureRequiredType) {
                            TLRPC.TL_secureRequiredType tL_secureRequiredType5 = (TLRPC.TL_secureRequiredType) secureRequiredType2;
                            if (isPersonalDocument(tL_secureRequiredType5.type)) {
                                int i7 = 0;
                                for (int size2 = tL_secureRequiredTypeOneOf.types.size(); i7 < size2; size2 = size2) {
                                    TLRPC.SecureRequiredType secureRequiredType3 = tL_secureRequiredTypeOneOf.types.get(i7);
                                    if (secureRequiredType3 instanceof TLRPC.TL_secureRequiredType) {
                                        arrayList6.add((TLRPC.TL_secureRequiredType) secureRequiredType3);
                                    }
                                    i7++;
                                }
                                i5++;
                            } else if (isAddressDocument(tL_secureRequiredType5.type)) {
                                int size3 = tL_secureRequiredTypeOneOf.types.size();
                                int i8 = 0;
                                while (i8 < size3) {
                                    TLRPC.SecureRequiredType secureRequiredType4 = tL_secureRequiredTypeOneOf.types.get(i8);
                                    if (secureRequiredType4 instanceof TLRPC.TL_secureRequiredType) {
                                        arrayList7.add((TLRPC.TL_secureRequiredType) secureRequiredType4);
                                    }
                                    i8++;
                                    arrayList6 = arrayList6;
                                }
                                arrayList5 = arrayList6;
                                i6++;
                                i4++;
                                arrayList6 = arrayList5;
                                i2 = 0;
                            }
                        }
                    }
                }
                arrayList5 = arrayList6;
                i4++;
                arrayList6 = arrayList5;
                i2 = 0;
            }
            boolean z4 = !z2 || i5 > 1;
            boolean z5 = !z3 || i6 > 1;
            int i9 = 0;
            while (i9 < size) {
                TLRPC.SecureRequiredType secureRequiredType5 = this.currentForm.required_types.get(i9);
                if (secureRequiredType5 instanceof TLRPC.TL_secureRequiredType) {
                    TLRPC.TL_secureRequiredType tL_secureRequiredType6 = (TLRPC.TL_secureRequiredType) secureRequiredType5;
                    if ((tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypePhone) || (tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypeEmail)) {
                        tL_secureRequiredType = tL_secureRequiredType6;
                        arrayList2 = null;
                    } else {
                        if (tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                            if (!z4) {
                                arrayList4 = arrayList6;
                                tL_secureRequiredType = tL_secureRequiredType6;
                                arrayList2 = arrayList4;
                            }
                        } else if (!(tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypeAddress)) {
                            if (!z4 || !isPersonalDocument(tL_secureRequiredType6.type)) {
                                if (z5 && isAddressDocument(tL_secureRequiredType6.type)) {
                                    arrayList3 = new ArrayList<>();
                                    arrayList3.add(tL_secureRequiredType6);
                                    tL_secureRequiredType3 = new TLRPC.TL_secureRequiredType();
                                    tL_secureRequiredType3.type = new TLRPC.TL_secureValueTypeAddress();
                                }
                                arrayList = arrayList7;
                                i = size;
                                i9++;
                                size = i;
                                arrayList7 = arrayList;
                            } else {
                                arrayList3 = new ArrayList<>();
                                arrayList3.add(tL_secureRequiredType6);
                                tL_secureRequiredType3 = new TLRPC.TL_secureRequiredType();
                                tL_secureRequiredType3.type = new TLRPC.TL_secureValueTypePersonalDetails();
                            }
                            tL_secureRequiredType = tL_secureRequiredType3;
                            arrayList2 = arrayList3;
                            z = true;
                        } else if (!z5) {
                            arrayList4 = arrayList7;
                            tL_secureRequiredType = tL_secureRequiredType6;
                            arrayList2 = arrayList4;
                        }
                        arrayList4 = null;
                        tL_secureRequiredType = tL_secureRequiredType6;
                        arrayList2 = arrayList4;
                    }
                    z = false;
                } else {
                    if (secureRequiredType5 instanceof TLRPC.TL_secureRequiredTypeOneOf) {
                        TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf2 = (TLRPC.TL_secureRequiredTypeOneOf) secureRequiredType5;
                        if (!tL_secureRequiredTypeOneOf2.types.isEmpty()) {
                            TLRPC.SecureRequiredType secureRequiredType6 = tL_secureRequiredTypeOneOf2.types.get(0);
                            if (secureRequiredType6 instanceof TLRPC.TL_secureRequiredType) {
                                TLRPC.TL_secureRequiredType tL_secureRequiredType7 = (TLRPC.TL_secureRequiredType) secureRequiredType6;
                                if ((z4 && isPersonalDocument(tL_secureRequiredType7.type)) || (z5 && isAddressDocument(tL_secureRequiredType7.type))) {
                                    ArrayList<TLRPC.TL_secureRequiredType> arrayList8 = new ArrayList<>();
                                    int size4 = tL_secureRequiredTypeOneOf2.types.size();
                                    int i10 = 0;
                                    while (i10 < size4) {
                                        TLRPC.SecureRequiredType secureRequiredType7 = tL_secureRequiredTypeOneOf2.types.get(i10);
                                        if (secureRequiredType7 instanceof TLRPC.TL_secureRequiredType) {
                                            arrayList8.add((TLRPC.TL_secureRequiredType) secureRequiredType7);
                                        }
                                        i10++;
                                        tL_secureRequiredTypeOneOf2 = tL_secureRequiredTypeOneOf2;
                                    }
                                    if (isPersonalDocument(tL_secureRequiredType7.type)) {
                                        tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
                                        tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypePersonalDetails();
                                    } else {
                                        tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
                                        tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypeAddress();
                                    }
                                    arrayList2 = arrayList8;
                                    z = true;
                                    tL_secureRequiredType = tL_secureRequiredType2;
                                }
                            }
                        }
                    }
                    arrayList = arrayList7;
                    i = size;
                    i9++;
                    size = i;
                    arrayList7 = arrayList;
                }
                arrayList = arrayList7;
                i = size;
                addField(context, tL_secureRequiredType, arrayList2, z, i9 == size + -1);
                i9++;
                size = i;
                arrayList7 = arrayList;
            }
        }
        if (user != null) {
            TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell2;
            textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
            this.bottomCell.setLinkTextColorKey(Theme.key_windowBackgroundWhiteGrayText4);
            if (!TextUtils.isEmpty(this.currentForm.privacy_policy_url)) {
                String formatString = LocaleController.formatString("PassportPolicy", R.string.PassportPolicy, UserObject.getFirstName(user), user.username);
                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(formatString);
                int indexOf = formatString.indexOf(42);
                int lastIndexOf = formatString.lastIndexOf(42);
                if (!(indexOf == -1 || lastIndexOf == -1)) {
                    this.bottomCell.getTextView().setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
                    spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) "");
                    spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) "");
                    spannableStringBuilder.setSpan(new LinkSpan(), indexOf, lastIndexOf - 1, 33);
                }
                this.bottomCell.setText(spannableStringBuilder);
            } else {
                this.bottomCell.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportNoPolicy", R.string.PassportNoPolicy, UserObject.getFirstName(user), user.username)));
            }
            this.bottomCell.getTextView().setHighlightColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
            this.bottomCell.getTextView().setGravity(1);
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
        }
        FrameLayout frameLayout3 = new FrameLayout(context);
        this.bottomLayout = frameLayout3;
        frameLayout3.setBackgroundDrawable(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_passport_authorizeBackground), Theme.getColor(Theme.key_passport_authorizeBackgroundSelected)));
        frameLayout.addView(this.bottomLayout, LayoutHelper.createFrame(-1, 48, 80));
        this.bottomLayout.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$Bbv2w3SpvnoOsxrpj6p99DdjbFw */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createRequestInterface$16$PassportActivity(view);
            }
        });
        TextView textView = new TextView(context);
        this.acceptTextView = textView;
        textView.setCompoundDrawablePadding(AndroidUtilities.dp(8.0f));
        this.acceptTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.authorize, 0, 0, 0);
        this.acceptTextView.setTextColor(Theme.getColor(Theme.key_passport_authorizeText));
        this.acceptTextView.setText(LocaleController.getString("PassportAuthorize", R.string.PassportAuthorize));
        this.acceptTextView.setTextSize(1, 14.0f);
        this.acceptTextView.setGravity(17);
        this.acceptTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.bottomLayout.addView(this.acceptTextView, LayoutHelper.createFrame(-2, -1, 17));
        ContextProgressView contextProgressView = new ContextProgressView(context, 0);
        this.progressViewButton = contextProgressView;
        contextProgressView.setVisibility(4);
        this.bottomLayout.addView(this.progressViewButton, LayoutHelper.createFrame(-1, -1.0f));
        View view = new View(context);
        view.setBackgroundResource(R.drawable.header_shadow_reverse);
        frameLayout.addView(view, LayoutHelper.createFrame(-1.0f, 3.0f, 83, 0.0f, 0.0f, 0.0f, 48.0f));
    }

    public /* synthetic */ void lambda$createRequestInterface$16$PassportActivity(View view) {
        int i;
        ArrayList arrayList;
        TLRPC.TL_secureRequiredType tL_secureRequiredType;
        ArrayList arrayList2 = new ArrayList();
        int size = this.currentForm.required_types.size();
        for (int i2 = 0; i2 < size; i2++) {
            TLRPC.SecureRequiredType secureRequiredType = this.currentForm.required_types.get(i2);
            if (secureRequiredType instanceof TLRPC.TL_secureRequiredType) {
                tL_secureRequiredType = (TLRPC.TL_secureRequiredType) secureRequiredType;
            } else {
                if (secureRequiredType instanceof TLRPC.TL_secureRequiredTypeOneOf) {
                    TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf = (TLRPC.TL_secureRequiredTypeOneOf) secureRequiredType;
                    if (!tL_secureRequiredTypeOneOf.types.isEmpty()) {
                        TLRPC.SecureRequiredType secureRequiredType2 = tL_secureRequiredTypeOneOf.types.get(0);
                        if (secureRequiredType2 instanceof TLRPC.TL_secureRequiredType) {
                            TLRPC.TL_secureRequiredType tL_secureRequiredType2 = (TLRPC.TL_secureRequiredType) secureRequiredType2;
                            int size2 = tL_secureRequiredTypeOneOf.types.size();
                            int i3 = 0;
                            while (true) {
                                if (i3 >= size2) {
                                    tL_secureRequiredType = tL_secureRequiredType2;
                                    break;
                                }
                                TLRPC.SecureRequiredType secureRequiredType3 = tL_secureRequiredTypeOneOf.types.get(i3);
                                if (secureRequiredType3 instanceof TLRPC.TL_secureRequiredType) {
                                    TLRPC.TL_secureRequiredType tL_secureRequiredType3 = (TLRPC.TL_secureRequiredType) secureRequiredType3;
                                    if (getValueByType(tL_secureRequiredType3, true) != null) {
                                        tL_secureRequiredType = tL_secureRequiredType3;
                                        break;
                                    }
                                }
                                i3++;
                            }
                        } else {
                            continue;
                        }
                    } else {
                        continue;
                    }
                } else {
                    continue;
                }
            }
            TLRPC.TL_secureValue valueByType = getValueByType(tL_secureRequiredType, true);
            if (valueByType == null) {
                Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
                if (vibrator != null) {
                    vibrator.vibrate(200);
                }
                AndroidUtilities.shakeView(getViewByType(tL_secureRequiredType), 2.0f, 0);
                return;
            }
            HashMap<String, String> hashMap = this.errorsMap.get(getNameForType(tL_secureRequiredType.type));
            if (hashMap == null || hashMap.isEmpty()) {
                arrayList2.add(new Object(valueByType, tL_secureRequiredType.selfie_required, tL_secureRequiredType.translation_required) {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass1ValueToSend */
                    boolean selfie_required;
                    boolean translation_required;
                    TLRPC.TL_secureValue value;

                    {
                        this.value = r2;
                        this.selfie_required = r3;
                        this.translation_required = r4;
                    }
                });
            } else {
                Vibrator vibrator2 = (Vibrator) getParentActivity().getSystemService("vibrator");
                if (vibrator2 != null) {
                    vibrator2.vibrate(200);
                }
                AndroidUtilities.shakeView(getViewByType(tL_secureRequiredType), 2.0f, 0);
                return;
            }
        }
        showEditDoneProgress(false, true);
        TLRPC.TL_account_acceptAuthorization tL_account_acceptAuthorization = new TLRPC.TL_account_acceptAuthorization();
        tL_account_acceptAuthorization.bot_id = this.currentBotId;
        tL_account_acceptAuthorization.scope = this.currentScope;
        tL_account_acceptAuthorization.public_key = this.currentPublicKey;
        JSONObject jSONObject = new JSONObject();
        int size3 = arrayList2.size();
        int i4 = 0;
        while (i4 < size3) {
            AnonymousClass1ValueToSend r9 = (AnonymousClass1ValueToSend) arrayList2.get(i4);
            TLRPC.TL_secureValue tL_secureValue = r9.value;
            JSONObject jSONObject2 = new JSONObject();
            if (tL_secureValue.plain_data == null) {
                try {
                    JSONObject jSONObject3 = new JSONObject();
                    if (tL_secureValue.data != null) {
                        byte[] decryptValueSecret = decryptValueSecret(tL_secureValue.data.secret, tL_secureValue.data.data_hash);
                        jSONObject2.put("data_hash", Base64.encodeToString(tL_secureValue.data.data_hash, 2));
                        jSONObject2.put("secret", Base64.encodeToString(decryptValueSecret, 2));
                        jSONObject3.put("data", jSONObject2);
                    }
                    if (!tL_secureValue.files.isEmpty()) {
                        JSONArray jSONArray = new JSONArray();
                        int i5 = 0;
                        for (int size4 = tL_secureValue.files.size(); i5 < size4; size4 = size4) {
                            TLRPC.TL_secureFile tL_secureFile = (TLRPC.TL_secureFile) tL_secureValue.files.get(i5);
                            arrayList = arrayList2;
                            try {
                                i = size3;
                                try {
                                    byte[] decryptValueSecret2 = decryptValueSecret(tL_secureFile.secret, tL_secureFile.file_hash);
                                    JSONObject jSONObject4 = new JSONObject();
                                    jSONObject4.put("file_hash", Base64.encodeToString(tL_secureFile.file_hash, 2));
                                    jSONObject4.put("secret", Base64.encodeToString(decryptValueSecret2, 2));
                                    jSONArray.put(jSONObject4);
                                    i5++;
                                    arrayList2 = arrayList;
                                    size3 = i;
                                } catch (Exception unused) {
                                }
                            } catch (Exception unused2) {
                            }
                        }
                        arrayList = arrayList2;
                        i = size3;
                        jSONObject3.put("files", jSONArray);
                    } else {
                        arrayList = arrayList2;
                        i = size3;
                    }
                    if (tL_secureValue.front_side instanceof TLRPC.TL_secureFile) {
                        TLRPC.TL_secureFile tL_secureFile2 = (TLRPC.TL_secureFile) tL_secureValue.front_side;
                        byte[] decryptValueSecret3 = decryptValueSecret(tL_secureFile2.secret, tL_secureFile2.file_hash);
                        JSONObject jSONObject5 = new JSONObject();
                        jSONObject5.put("file_hash", Base64.encodeToString(tL_secureFile2.file_hash, 2));
                        jSONObject5.put("secret", Base64.encodeToString(decryptValueSecret3, 2));
                        jSONObject3.put("front_side", jSONObject5);
                    }
                    if (tL_secureValue.reverse_side instanceof TLRPC.TL_secureFile) {
                        TLRPC.TL_secureFile tL_secureFile3 = (TLRPC.TL_secureFile) tL_secureValue.reverse_side;
                        byte[] decryptValueSecret4 = decryptValueSecret(tL_secureFile3.secret, tL_secureFile3.file_hash);
                        JSONObject jSONObject6 = new JSONObject();
                        jSONObject6.put("file_hash", Base64.encodeToString(tL_secureFile3.file_hash, 2));
                        jSONObject6.put("secret", Base64.encodeToString(decryptValueSecret4, 2));
                        jSONObject3.put("reverse_side", jSONObject6);
                    }
                    if (r9.selfie_required && (tL_secureValue.selfie instanceof TLRPC.TL_secureFile)) {
                        TLRPC.TL_secureFile tL_secureFile4 = (TLRPC.TL_secureFile) tL_secureValue.selfie;
                        byte[] decryptValueSecret5 = decryptValueSecret(tL_secureFile4.secret, tL_secureFile4.file_hash);
                        JSONObject jSONObject7 = new JSONObject();
                        jSONObject7.put("file_hash", Base64.encodeToString(tL_secureFile4.file_hash, 2));
                        jSONObject7.put("secret", Base64.encodeToString(decryptValueSecret5, 2));
                        jSONObject3.put("selfie", jSONObject7);
                    }
                    if (r9.translation_required && !tL_secureValue.translation.isEmpty()) {
                        JSONArray jSONArray2 = new JSONArray();
                        int size5 = tL_secureValue.translation.size();
                        for (int i6 = 0; i6 < size5; i6++) {
                            TLRPC.TL_secureFile tL_secureFile5 = (TLRPC.TL_secureFile) tL_secureValue.translation.get(i6);
                            byte[] decryptValueSecret6 = decryptValueSecret(tL_secureFile5.secret, tL_secureFile5.file_hash);
                            JSONObject jSONObject8 = new JSONObject();
                            jSONObject8.put("file_hash", Base64.encodeToString(tL_secureFile5.file_hash, 2));
                            jSONObject8.put("secret", Base64.encodeToString(decryptValueSecret6, 2));
                            jSONArray2.put(jSONObject8);
                        }
                        jSONObject3.put("translation", jSONArray2);
                    }
                    jSONObject.put(getNameForType(tL_secureValue.type), jSONObject3);
                } catch (Exception unused3) {
                }
                TLRPC.TL_secureValueHash tL_secureValueHash = new TLRPC.TL_secureValueHash();
                tL_secureValueHash.type = tL_secureValue.type;
                tL_secureValueHash.hash = tL_secureValue.hash;
                tL_account_acceptAuthorization.value_hashes.add(tL_secureValueHash);
                i4++;
                arrayList2 = arrayList;
                size3 = i;
            } else if (tL_secureValue.plain_data instanceof TLRPC.TL_securePlainEmail) {
                TLRPC.TL_securePlainEmail tL_securePlainEmail = (TLRPC.TL_securePlainEmail) tL_secureValue.plain_data;
            } else if (tL_secureValue.plain_data instanceof TLRPC.TL_securePlainPhone) {
                TLRPC.TL_securePlainPhone tL_securePlainPhone = (TLRPC.TL_securePlainPhone) tL_secureValue.plain_data;
            }
            arrayList = arrayList2;
            i = size3;
            TLRPC.TL_secureValueHash tL_secureValueHash2 = new TLRPC.TL_secureValueHash();
            tL_secureValueHash2.type = tL_secureValue.type;
            tL_secureValueHash2.hash = tL_secureValue.hash;
            tL_account_acceptAuthorization.value_hashes.add(tL_secureValueHash2);
            i4++;
            arrayList2 = arrayList;
            size3 = i;
        }
        JSONObject jSONObject9 = new JSONObject();
        try {
            jSONObject9.put("secure_data", jSONObject);
        } catch (Exception unused4) {
        }
        Object obj = this.currentPayload;
        if (obj != null) {
            try {
                jSONObject9.put("payload", obj);
            } catch (Exception unused5) {
            }
        }
        Object obj2 = this.currentNonce;
        if (obj2 != null) {
            try {
                jSONObject9.put("nonce", obj2);
            } catch (Exception unused6) {
            }
        }
        EncryptionResult encryptData = encryptData(AndroidUtilities.getStringBytes(jSONObject9.toString()));
        tL_account_acceptAuthorization.credentials = new TLRPC.TL_secureCredentialsEncrypted();
        tL_account_acceptAuthorization.credentials.hash = encryptData.fileHash;
        tL_account_acceptAuthorization.credentials.data = encryptData.encryptedData;
        try {
            String replace = this.currentPublicKey.replaceAll("\\n", "").replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "");
            Cipher instance = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding", "BC");
            instance.init(1, (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decode(replace, 0))));
            tL_account_acceptAuthorization.credentials.secret = instance.doFinal(encryptData.decrypyedFileSecret);
        } catch (Exception e) {
            FileLog.e(e);
        }
        ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_acceptAuthorization, new RequestDelegate() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$IevVFnC2jZqNGsAqCcgJgIn5qDE */

            @Override // im.guobwnxjuc.tgnet.RequestDelegate
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$null$15$PassportActivity(tLObject, tL_error);
            }
        }), this.classGuid);
    }

    public /* synthetic */ void lambda$null$15$PassportActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$JZKl2HinbfCyRK7iwxDrHyQAZ7U */
            private final /* synthetic */ TLRPC.TL_error f$1;

            {
                this.f$1 = r2;
            }

            public final void run() {
                PassportActivity.this.lambda$null$14$PassportActivity(this.f$1);
            }
        });
    }

    public /* synthetic */ void lambda$null$14$PassportActivity(TLRPC.TL_error tL_error) {
        if (tL_error == null) {
            this.ignoreOnFailure = true;
            callCallback(true);
            finishFragment();
            return;
        }
        showEditDoneProgress(false, false);
        if ("APP_VERSION_OUTDATED".equals(tL_error.text)) {
            AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
        } else {
            showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:16:0x02cc  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x02ce  */
    private void createManageInterface(Context context) {
        boolean z;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList;
        TLRPC.TL_secureRequiredType tL_secureRequiredType;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList2;
        TLRPC.TL_secureRequiredType tL_secureRequiredType2;
        FrameLayout frameLayout = (FrameLayout) this.fragmentView;
        this.actionBar.setTitle(LocaleController.getString("AppPassport", R.string.AppPassport));
        this.actionBar.createMenu().addItem(1, R.drawable.profile_info);
        HeaderCell headerCell2 = new HeaderCell(context);
        this.headerCell = headerCell2;
        headerCell2.setText(LocaleController.getString("PassportProvidedInformation", R.string.PassportProvidedInformation));
        this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
        ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context);
        this.sectionCell = shadowSectionCell;
        shadowSectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
        this.linearLayout2.addView(this.sectionCell, LayoutHelper.createLinear(-1, -2));
        TextSettingsCell textSettingsCell = new TextSettingsCell(context);
        this.addDocumentCell = textSettingsCell;
        textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        this.addDocumentCell.setText(LocaleController.getString("PassportNoDocumentsAdd", R.string.PassportNoDocumentsAdd), true);
        this.linearLayout2.addView(this.addDocumentCell, LayoutHelper.createLinear(-1, -2));
        this.addDocumentCell.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$BXJ1ds2s1IadmChoJf5UIXlNHE8 */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createManageInterface$17$PassportActivity(view);
            }
        });
        TextSettingsCell textSettingsCell2 = new TextSettingsCell(context);
        this.deletePassportCell = textSettingsCell2;
        textSettingsCell2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
        this.deletePassportCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        this.deletePassportCell.setText(LocaleController.getString("AppPassportDelete", R.string.AppPassportDelete), false);
        this.linearLayout2.addView(this.deletePassportCell, LayoutHelper.createLinear(-1, -2));
        this.deletePassportCell.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$l1kS1lukEuF10ZzTS6geGYLJ2w */

            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, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.linearLayout2.addView(this.addDocumentSectionCell, 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, (int) R.drawable.greydivider_bottom, Theme.key_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(R.drawable.no_passport);
        this.emptyImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_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(Theme.key_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", R.string.PassportNoDocuments));
        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(Theme.key_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", R.string.PassportNoDocumentsInfo));
        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(Theme.key_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", R.string.PassportNoDocumentsAdd).toUpperCase());
        this.emptyLayout.addView(this.emptyTextView3, LayoutHelper.createLinear(-2, 30, 17, 0, 16, 0, 0));
        this.emptyTextView3.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$oZdF9B8gUrN3JePqfVF9dgKRhGw */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createManageInterface$22$PassportActivity(view);
            }
        });
        int size = this.currentForm.values.size();
        int i = 0;
        while (i < size) {
            TLRPC.TL_secureValue tL_secureValue = this.currentForm.values.get(i);
            if (isPersonalDocument(tL_secureValue.type)) {
                arrayList2 = new ArrayList<>();
                TLRPC.TL_secureRequiredType tL_secureRequiredType3 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType3.type = tL_secureValue.type;
                tL_secureRequiredType3.selfie_required = true;
                tL_secureRequiredType3.translation_required = true;
                arrayList2.add(tL_secureRequiredType3);
                tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypePersonalDetails();
            } else if (isAddressDocument(tL_secureValue.type)) {
                arrayList2 = new ArrayList<>();
                TLRPC.TL_secureRequiredType tL_secureRequiredType4 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType4.type = tL_secureValue.type;
                tL_secureRequiredType4.translation_required = true;
                arrayList2.add(tL_secureRequiredType4);
                tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypeAddress();
            } else {
                TLRPC.TL_secureRequiredType tL_secureRequiredType5 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType5.type = tL_secureValue.type;
                arrayList = null;
                tL_secureRequiredType = tL_secureRequiredType5;
                z = false;
                addField(context, tL_secureRequiredType, arrayList, z, i != size + -1);
                i++;
            }
            tL_secureRequiredType = tL_secureRequiredType2;
            arrayList = arrayList2;
            z = true;
            addField(context, tL_secureRequiredType, arrayList, z, i != size + -1);
            i++;
        }
        updateManageVisibility();
    }

    public /* synthetic */ void lambda$createManageInterface$17$PassportActivity(View view) {
        openAddDocumentAlert();
    }

    public /* synthetic */ void lambda$createManageInterface$21$PassportActivity(View view) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$yjTaEv51jaDCGFJpAggqvMpeoM */

            public final void onClick(DialogInterface dialogInterface, int i) {
                PassportActivity.this.lambda$null$20$PassportActivity(dialogInterface, i);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setMessage(LocaleController.getString("AppPassportDeleteAlert", R.string.AppPassportDeleteAlert));
        showDialog(builder.create());
    }

    public /* synthetic */ void lambda$null$20$PassportActivity(DialogInterface dialogInterface, int i) {
        TLRPC.TL_account_deleteSecureValue tL_account_deleteSecureValue = new TLRPC.TL_account_deleteSecureValue();
        for (int i2 = 0; i2 < this.currentForm.values.size(); i2++) {
            tL_account_deleteSecureValue.types.add(this.currentForm.values.get(i2).type);
        }
        needShowProgress();
        ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_deleteSecureValue, new RequestDelegate() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$Uy8fQNIR96uwis3fGk5m6GZUvU */

            @Override // im.guobwnxjuc.tgnet.RequestDelegate
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$null$19$PassportActivity(tLObject, tL_error);
            }
        });
    }

    public /* synthetic */ void lambda$null$19$PassportActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$HRcCOGDtZ89XCXT7RBX9CuWq2s */

            public final void run() {
                PassportActivity.this.lambda$null$18$PassportActivity();
            }
        });
    }

    public /* synthetic */ void lambda$null$18$PassportActivity() {
        int i = 0;
        while (i < this.linearLayout2.getChildCount()) {
            View childAt = this.linearLayout2.getChildAt(i);
            if (childAt instanceof TextDetailSecureCell) {
                this.linearLayout2.removeView(childAt);
                i--;
            }
            i++;
        }
        needHideProgress();
        this.typesViews.clear();
        this.typesValues.clear();
        this.currentForm.values.clear();
        updateManageVisibility();
    }

    public /* synthetic */ void lambda$createManageInterface$22$PassportActivity(View view) {
        openAddDocumentAlert();
    }

    private boolean hasNotValueForType(Class<? extends TLRPC.SecureValueType> cls) {
        int size = this.currentForm.values.size();
        for (int i = 0; i < size; i++) {
            if (this.currentForm.values.get(i).type.getClass() == cls) {
                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() {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        if (hasNotValueForType(TLRPC.TL_secureValueTypePhone.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentPhone", R.string.ActionBotDocumentPhone));
            arrayList2.add(TLRPC.TL_secureValueTypePhone.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeEmail.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentEmail", R.string.ActionBotDocumentEmail));
            arrayList2.add(TLRPC.TL_secureValueTypeEmail.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePersonalDetails.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentIdentity", R.string.ActionBotDocumentIdentity));
            arrayList2.add(TLRPC.TL_secureValueTypePersonalDetails.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePassport.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentPassport", R.string.ActionBotDocumentPassport));
            arrayList2.add(TLRPC.TL_secureValueTypePassport.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeInternalPassport.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentInternalPassport", R.string.ActionBotDocumentInternalPassport));
            arrayList2.add(TLRPC.TL_secureValueTypeInternalPassport.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypePassportRegistration.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration));
            arrayList2.add(TLRPC.TL_secureValueTypePassportRegistration.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeTemporaryRegistration.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentTemporaryRegistration", R.string.ActionBotDocumentTemporaryRegistration));
            arrayList2.add(TLRPC.TL_secureValueTypeTemporaryRegistration.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeIdentityCard.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentIdentityCard", R.string.ActionBotDocumentIdentityCard));
            arrayList2.add(TLRPC.TL_secureValueTypeIdentityCard.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeDriverLicense.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentDriverLicence", R.string.ActionBotDocumentDriverLicence));
            arrayList2.add(TLRPC.TL_secureValueTypeDriverLicense.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeAddress.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentAddress", R.string.ActionBotDocumentAddress));
            arrayList2.add(TLRPC.TL_secureValueTypeAddress.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeUtilityBill.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill));
            arrayList2.add(TLRPC.TL_secureValueTypeUtilityBill.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeBankStatement.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement));
            arrayList2.add(TLRPC.TL_secureValueTypeBankStatement.class);
        }
        if (hasNotValueForType(TLRPC.TL_secureValueTypeRentalAgreement.class)) {
            arrayList.add(LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement));
            arrayList2.add(TLRPC.TL_secureValueTypeRentalAgreement.class);
        }
        if (getParentActivity() != null && !arrayList.isEmpty()) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("PassportNoDocumentsAdd", R.string.PassportNoDocumentsAdd));
            builder.setItems((CharSequence[]) arrayList.toArray(new CharSequence[0]), new DialogInterface.OnClickListener(arrayList2) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$lhv3JCeBK0HVzeDimSnlKDrnpQ */
                private final /* synthetic */ ArrayList f$1;

                {
                    this.f$1 = r2;
                }

                public final void onClick(DialogInterface dialogInterface, int i) {
                    PassportActivity.this.lambda$openAddDocumentAlert$23$PassportActivity(this.f$1, dialogInterface, i);
                }
            });
            showDialog(builder.create());
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x0051  */
    public /* synthetic */ void lambda$openAddDocumentAlert$23$PassportActivity(ArrayList arrayList, DialogInterface dialogInterface, int i) {
        TLRPC.TL_secureRequiredType tL_secureRequiredType;
        TLRPC.TL_secureRequiredType tL_secureRequiredType2;
        TLRPC.TL_secureRequiredType tL_secureRequiredType3 = null;
        try {
            tL_secureRequiredType = new TLRPC.TL_secureRequiredType();
            try {
                tL_secureRequiredType.type = (TLRPC.SecureValueType) ((Class) arrayList.get(i)).newInstance();
            } catch (Exception unused) {
            }
        } catch (Exception unused2) {
            tL_secureRequiredType = null;
        }
        boolean z = true;
        if (isPersonalDocument(tL_secureRequiredType.type)) {
            tL_secureRequiredType.selfie_required = true;
            tL_secureRequiredType.translation_required = true;
            tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
            tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypePersonalDetails();
        } else {
            if (isAddressDocument(tL_secureRequiredType.type)) {
                tL_secureRequiredType2 = new TLRPC.TL_secureRequiredType();
                tL_secureRequiredType2.type = new TLRPC.TL_secureValueTypeAddress();
            }
            ArrayList<TLRPC.TL_secureRequiredType> arrayList2 = new ArrayList<>();
            if (tL_secureRequiredType3 == null) {
                z = false;
            }
            openTypeActivity(tL_secureRequiredType, tL_secureRequiredType3, arrayList2, z);
        }
        tL_secureRequiredType3 = tL_secureRequiredType;
        tL_secureRequiredType = tL_secureRequiredType2;
        ArrayList<TLRPC.TL_secureRequiredType> arrayList22 = new ArrayList<>();
        if (tL_secureRequiredType3 == null) {
        }
        openTypeActivity(tL_secureRequiredType, tL_secureRequiredType3, arrayList22, z);
    }

    private void updateManageVisibility() {
        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);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void callCallback(boolean z) {
        int i;
        int i2;
        if (this.callbackCalled) {
            return;
        }
        if (!TextUtils.isEmpty(this.currentCallbackUrl)) {
            if (z) {
                FragmentActivity parentActivity = getParentActivity();
                Browser.openUrl(parentActivity, Uri.parse(this.currentCallbackUrl + "&tg_passport=success"));
            } else if (!this.ignoreOnFailure && ((i2 = this.currentActivityType) == 5 || i2 == 0)) {
                FragmentActivity parentActivity2 = getParentActivity();
                Browser.openUrl(parentActivity2, Uri.parse(this.currentCallbackUrl + "&tg_passport=cancel"));
            }
            this.callbackCalled = true;
        } else if (this.needActivityResult) {
            if (z || (!this.ignoreOnFailure && ((i = this.currentActivityType) == 5 || i == 0))) {
                getParentActivity().setResult(z ? -1 : 0);
            }
            this.callbackCalled = true;
        }
    }

    private void createEmailInterface(Context context) {
        this.actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
        if (!TextUtils.isEmpty(this.currentEmail)) {
            TextSettingsCell textSettingsCell = new TextSettingsCell(context);
            textSettingsCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            textSettingsCell.setText(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, this.currentEmail), false);
            this.linearLayout2.addView(textSettingsCell, LayoutHelper.createLinear(-1, -2));
            textSettingsCell.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$RMmgypsy2PnW8hmQ9kcW0Fx4Hiw */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createEmailInterface$24$PassportActivity(view);
                }
            });
            TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell;
            textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
            this.bottomCell.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", R.string.PassportPhoneUseSameEmailInfo));
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
        }
        this.inputFields = new EditTextBoldCursor[1];
        for (int i = 0; i < 1; i++) {
            FrameLayout frameLayout = new FrameLayout(context);
            this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(-1, 50));
            frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            this.inputFields[i] = new EditTextBoldCursor(context);
            this.inputFields[i].setTag(Integer.valueOf(i));
            this.inputFields[i].setTextSize(1, 16.0f);
            this.inputFields[i].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.inputFields[i].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i].setBackgroundDrawable(null);
            this.inputFields[i].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[i].setCursorWidth(1.5f);
            this.inputFields[i].setInputType(33);
            this.inputFields[i].setImeOptions(268435462);
            this.inputFields[i].setHint(LocaleController.getString("PaymentShippingEmailPlaceholder", R.string.PaymentShippingEmailPlaceholder));
            TLRPC.TL_secureValue tL_secureValue = this.currentTypeValue;
            if (tL_secureValue != null && (tL_secureValue.plain_data instanceof TLRPC.TL_securePlainEmail)) {
                TLRPC.TL_securePlainEmail tL_securePlainEmail = (TLRPC.TL_securePlainEmail) this.currentTypeValue.plain_data;
                if (!TextUtils.isEmpty(tL_securePlainEmail.email)) {
                    this.inputFields[i].setText(tL_securePlainEmail.email);
                }
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[i].setSelection(editTextBoldCursorArr[i].length());
            this.inputFields[i].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
            this.inputFields[i].setGravity(LocaleController.isRTL ? 5 : 3);
            frameLayout.addView(this.inputFields[i], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            this.inputFields[i].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$u8WNTdB1kCDUPo0ZVBAQpAFdcs */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createEmailInterface$25$PassportActivity(textView, i, keyEvent);
                }
            });
        }
        TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell2;
        textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.bottomCell.setText(LocaleController.getString("PassportEmailUploadInfo", R.string.PassportEmailUploadInfo));
        this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
    }

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

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

    private void createPhoneInterface(Context context) {
        String str;
        String str2;
        ViewGroup viewGroup;
        this.actionBar.setTitle(LocaleController.getString("PassportPhone", R.string.PassportPhone));
        this.languageMap = new HashMap<>();
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                String[] split = readLine.split(";");
                this.countriesArray.add(0, split[2]);
                this.countriesMap.put(split[2], split[0]);
                this.codesMap.put(split[0], split[2]);
                if (split.length > 3) {
                    this.phoneFormatMap.put(split[0], split[3]);
                }
                this.languageMap.put(split[1], split[2]);
            }
            bufferedReader.close();
        } catch (Exception e) {
            FileLog.e(e);
        }
        Collections.sort(this.countriesArray, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE);
        String str3 = UserConfig.getInstance(this.currentAccount).getCurrentUser().phone;
        TextSettingsCell textSettingsCell = new TextSettingsCell(context);
        textSettingsCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
        textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        textSettingsCell.setText(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, PhoneFormat.getInstance().format(Marker.ANY_NON_NULL_MARKER + str3)), false);
        int i = -1;
        this.linearLayout2.addView(textSettingsCell, LayoutHelper.createLinear(-1, -2));
        textSettingsCell.setOnClickListener(new View.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$_eFaCwFYT62tNCLAgr0xymm1_KY */

            public final void onClick(View view) {
                PassportActivity.this.lambda$createPhoneInterface$26$PassportActivity(view);
            }
        });
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.bottomCell.setText(LocaleController.getString("PassportPhoneUseSameInfo", R.string.PassportPhoneUseSameInfo));
        this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
        HeaderCell headerCell2 = new HeaderCell(context);
        this.headerCell = headerCell2;
        headerCell2.setText(LocaleController.getString("PassportPhoneUseOther", R.string.PassportPhoneUseOther));
        this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
        this.inputFields = new EditTextBoldCursor[3];
        int i2 = 0;
        while (i2 < 3) {
            if (i2 == 2) {
                this.inputFields[i2] = new HintEditText(context);
            } else {
                this.inputFields[i2] = new EditTextBoldCursor(context);
            }
            if (i2 == 1) {
                viewGroup = new LinearLayout(context);
                ((LinearLayout) viewGroup).setOrientation(0);
                this.linearLayout2.addView(viewGroup, LayoutHelper.createLinear(i, 50));
                viewGroup.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            } else if (i2 == 2) {
                viewGroup = (ViewGroup) this.inputFields[1].getParent();
            } else {
                viewGroup = new FrameLayout(context);
                this.linearLayout2.addView(viewGroup, LayoutHelper.createLinear(i, 50));
                viewGroup.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            }
            this.inputFields[i2].setTag(Integer.valueOf(i2));
            this.inputFields[i2].setTextSize(1, 16.0f);
            this.inputFields[i2].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.inputFields[i2].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i2].setBackgroundDrawable(null);
            this.inputFields[i2].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i2].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[i2].setCursorWidth(1.5f);
            if (i2 == 0) {
                this.inputFields[i2].setOnTouchListener(new View.OnTouchListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$yqJz0_Wx2vJP7O3xSfcBucXFnCg */

                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        return PassportActivity.this.lambda$createPhoneInterface$29$PassportActivity(view, motionEvent);
                    }
                });
                this.inputFields[i2].setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                this.inputFields[i2].setInputType(0);
                this.inputFields[i2].setFocusable(false);
            } else {
                this.inputFields[i2].setInputType(3);
                if (i2 == 2) {
                    this.inputFields[i2].setImeOptions(268435462);
                } else {
                    this.inputFields[i2].setImeOptions(268435461);
                }
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[i2].setSelection(editTextBoldCursorArr[i2].length());
            int i3 = 5;
            if (i2 == 1) {
                TextView textView = new TextView(context);
                this.plusTextView = textView;
                textView.setText(Marker.ANY_NON_NULL_MARKER);
                this.plusTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                this.plusTextView.setTextSize(1, 16.0f);
                viewGroup.addView(this.plusTextView, LayoutHelper.createLinear(-2, -2, 21.0f, 12.0f, 0.0f, 6.0f));
                this.inputFields[i2].setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
                this.inputFields[i2].setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)});
                this.inputFields[i2].setGravity(19);
                viewGroup.addView(this.inputFields[i2], LayoutHelper.createLinear(55, -2, 0.0f, 12.0f, 16.0f, 6.0f));
                this.inputFields[i2].addTextChangedListener(new TextWatcher() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass9 */

                    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void afterTextChanged(Editable editable) {
                        boolean z;
                        String str;
                        boolean z2;
                        int indexOf;
                        if (!PassportActivity.this.ignoreOnTextChange) {
                            PassportActivity.this.ignoreOnTextChange = true;
                            String stripExceptNumbers = PhoneFormat.stripExceptNumbers(PassportActivity.this.inputFields[1].getText().toString());
                            PassportActivity.this.inputFields[1].setText(stripExceptNumbers);
                            HintEditText hintEditText = (HintEditText) PassportActivity.this.inputFields[2];
                            if (stripExceptNumbers.length() == 0) {
                                hintEditText.setHintText((String) null);
                                hintEditText.setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
                                PassportActivity.this.inputFields[0].setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                            } else {
                                int i = 4;
                                if (stripExceptNumbers.length() > 4) {
                                    while (true) {
                                        if (i < 1) {
                                            str = null;
                                            z = false;
                                            break;
                                        }
                                        String substring = stripExceptNumbers.substring(0, i);
                                        if (((String) PassportActivity.this.codesMap.get(substring)) != null) {
                                            String str2 = stripExceptNumbers.substring(i) + PassportActivity.this.inputFields[2].getText().toString();
                                            PassportActivity.this.inputFields[1].setText(substring);
                                            z = true;
                                            str = str2;
                                            stripExceptNumbers = substring;
                                            break;
                                        }
                                        i--;
                                    }
                                    if (!z) {
                                        str = stripExceptNumbers.substring(1) + PassportActivity.this.inputFields[2].getText().toString();
                                        EditTextBoldCursor editTextBoldCursor = PassportActivity.this.inputFields[1];
                                        stripExceptNumbers = stripExceptNumbers.substring(0, 1);
                                        editTextBoldCursor.setText(stripExceptNumbers);
                                    }
                                } else {
                                    str = null;
                                    z = false;
                                }
                                String str3 = (String) PassportActivity.this.codesMap.get(stripExceptNumbers);
                                if (str3 == null || (indexOf = PassportActivity.this.countriesArray.indexOf(str3)) == -1) {
                                    z2 = false;
                                } else {
                                    PassportActivity.this.inputFields[0].setText((CharSequence) PassportActivity.this.countriesArray.get(indexOf));
                                    String str4 = (String) PassportActivity.this.phoneFormatMap.get(stripExceptNumbers);
                                    if (str4 != null) {
                                        hintEditText.setHintText(str4.replace('X', Typography.ndash));
                                        hintEditText.setHint((CharSequence) null);
                                    }
                                    z2 = true;
                                }
                                if (!z2) {
                                    hintEditText.setHintText((String) null);
                                    hintEditText.setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
                                    PassportActivity.this.inputFields[0].setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
                                }
                                if (!z) {
                                    PassportActivity.this.inputFields[1].setSelection(PassportActivity.this.inputFields[1].getText().length());
                                }
                                if (str != null) {
                                    hintEditText.requestFocus();
                                    hintEditText.setText(str);
                                    hintEditText.setSelection(hintEditText.length());
                                }
                            }
                            PassportActivity.this.ignoreOnTextChange = false;
                        }
                    }
                });
            } else if (i2 == 2) {
                this.inputFields[i2].setPadding(0, 0, 0, 0);
                this.inputFields[i2].setGravity(19);
                this.inputFields[i2].setHintText(null);
                this.inputFields[i2].setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
                viewGroup.addView(this.inputFields[i2], LayoutHelper.createLinear(-1, -2, 0.0f, 12.0f, 21.0f, 6.0f));
                this.inputFields[i2].addTextChangedListener(new TextWatcher() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass10 */
                    private int actionPosition;
                    private int characterAction = -1;

                    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                        if (i2 == 0 && i3 == 1) {
                            this.characterAction = 1;
                        } else if (i2 != 1 || i3 != 0) {
                            this.characterAction = -1;
                        } else if (charSequence.charAt(i) != ' ' || i <= 0) {
                            this.characterAction = 2;
                        } else {
                            this.characterAction = 3;
                            this.actionPosition = i - 1;
                        }
                    }

                    public void afterTextChanged(Editable editable) {
                        int i;
                        int i2;
                        if (!PassportActivity.this.ignoreOnPhoneChange) {
                            HintEditText hintEditText = (HintEditText) PassportActivity.this.inputFields[2];
                            int selectionStart = hintEditText.getSelectionStart();
                            String obj = hintEditText.getText().toString();
                            if (this.characterAction == 3) {
                                obj = obj.substring(0, this.actionPosition) + obj.substring(this.actionPosition + 1);
                                selectionStart--;
                            }
                            StringBuilder sb = new StringBuilder(obj.length());
                            int i3 = 0;
                            while (i3 < obj.length()) {
                                int i4 = i3 + 1;
                                String substring = obj.substring(i3, i4);
                                if ("0123456789".contains(substring)) {
                                    sb.append(substring);
                                }
                                i3 = i4;
                            }
                            PassportActivity.this.ignoreOnPhoneChange = true;
                            String hintText = hintEditText.getHintText();
                            if (hintText != null) {
                                int i5 = 0;
                                while (true) {
                                    if (i5 >= sb.length()) {
                                        break;
                                    } else if (i5 < hintText.length()) {
                                        if (hintText.charAt(i5) == ' ') {
                                            sb.insert(i5, ' ');
                                            i5++;
                                            if (!(selectionStart != i5 || (i2 = this.characterAction) == 2 || i2 == 3)) {
                                                selectionStart++;
                                            }
                                        }
                                        i5++;
                                    } else {
                                        sb.insert(i5, ' ');
                                        if (selectionStart == i5 + 1 && (i = this.characterAction) != 2 && i != 3) {
                                            selectionStart++;
                                        }
                                    }
                                }
                            }
                            hintEditText.setText(sb);
                            if (selectionStart >= 0) {
                                if (selectionStart > hintEditText.length()) {
                                    selectionStart = hintEditText.length();
                                }
                                hintEditText.setSelection(selectionStart);
                            }
                            hintEditText.onTextChange();
                            PassportActivity.this.ignoreOnPhoneChange = false;
                        }
                    }
                });
            } else {
                this.inputFields[i2].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
                EditTextBoldCursor editTextBoldCursor = this.inputFields[i2];
                if (!LocaleController.isRTL) {
                    i3 = 3;
                }
                editTextBoldCursor.setGravity(i3);
                viewGroup.addView(this.inputFields[i2], LayoutHelper.createFrame(-1.0f, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
            }
            this.inputFields[i2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3jjsikOCWW5Q3Gh3zECoHLgP7jU */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createPhoneInterface$30$PassportActivity(textView, i, keyEvent);
                }
            });
            if (i2 == 2) {
                this.inputFields[i2].setOnKeyListener(new View.OnKeyListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$1dxrfkHcdSqeJtpm8_8daGQsHng */

                    public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                        return PassportActivity.this.lambda$createPhoneInterface$31$PassportActivity(view, i, keyEvent);
                    }
                });
            }
            if (i2 == 0) {
                View view = new View(context);
                this.dividers.add(view);
                view.setBackgroundColor(Theme.getColor(Theme.key_divider));
                viewGroup.addView(view, new FrameLayout.LayoutParams(-1, 1, 83));
            }
            i2++;
            i = -1;
        }
        try {
            TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
            if (telephonyManager != null) {
                str = telephonyManager.getSimCountryIso().toUpperCase();
                if (!(str == null || (str2 = this.languageMap.get(str)) == null || this.countriesArray.indexOf(str2) == -1)) {
                    this.inputFields[1].setText(this.countriesMap.get(str2));
                }
                TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
                this.bottomCell = textInfoPrivacyCell2;
                textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
                this.bottomCell.setText(LocaleController.getString("PassportPhoneUploadInfo", R.string.PassportPhoneUploadInfo));
                this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        str = null;
        this.inputFields[1].setText(this.countriesMap.get(str2));
        TextInfoPrivacyCell textInfoPrivacyCell22 = new TextInfoPrivacyCell(context);
        this.bottomCell = textInfoPrivacyCell22;
        textInfoPrivacyCell22.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
        this.bottomCell.setText(LocaleController.getString("PassportPhoneUploadInfo", R.string.PassportPhoneUploadInfo));
        this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
    }

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

    public /* synthetic */ boolean lambda$createPhoneInterface$29$PassportActivity(View view, MotionEvent motionEvent) {
        if (getParentActivity() == null) {
            return false;
        }
        if (motionEvent.getAction() == 1) {
            CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
            countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$ttIbxoe49j_HWRfugOxJbxFZFU */

                @Override // im.guobwnxjuc.ui.CountrySelectActivity.CountrySelectActivityDelegate
                public final void didSelectCountry(CountrySelectActivity.Country country) {
                    PassportActivity.this.lambda$null$28$PassportActivity(country);
                }
            });
            presentFragment(countrySelectActivity);
        }
        return true;
    }

    public /* synthetic */ void lambda$null$28$PassportActivity(CountrySelectActivity.Country country) {
        if (country != null) {
            this.inputFields[0].setText(country.name);
            if (this.countriesArray.indexOf(country.name) != -1) {
                this.ignoreOnTextChange = true;
                String str = this.countriesMap.get(country.name);
                this.inputFields[1].setText(str);
                String str2 = this.phoneFormatMap.get(str);
                this.inputFields[2].setHintText(str2 != null ? str2.replace('X', Typography.ndash) : null);
                this.ignoreOnTextChange = false;
            }
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$cV2IX91nCEJRRwAli_w3k3AfQ4 */

                public final void run() {
                    PassportActivity.this.lambda$null$27$PassportActivity();
                }
            }, 300);
            this.inputFields[2].requestFocus();
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[2].setSelection(editTextBoldCursorArr[2].length());
        }
    }

    public /* synthetic */ void lambda$null$27$PassportActivity() {
        AndroidUtilities.showKeyboard(this.inputFields[2]);
    }

    public /* synthetic */ boolean lambda$createPhoneInterface$30$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i == 5) {
            this.inputFields[2].requestFocus();
            return true;
        } else if (i != 6) {
            return false;
        } else {
            this.doneItem.callOnClick();
            return true;
        }
    }

    public /* synthetic */ boolean lambda$createPhoneInterface$31$PassportActivity(View view, int i, KeyEvent keyEvent) {
        if (i != 67 || this.inputFields[2].length() != 0) {
            return false;
        }
        this.inputFields[1].requestFocus();
        EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
        editTextBoldCursorArr[1].setSelection(editTextBoldCursorArr[1].length());
        this.inputFields[1].dispatchKeyEvent(keyEvent);
        return true;
    }

    private void createAddressInterface(Context context) {
        final String str;
        this.languageMap = new HashMap<>();
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                String[] split = readLine.split(";");
                this.languageMap.put(split[1], split[2]);
            }
            bufferedReader.close();
        } catch (Exception e) {
            FileLog.e(e);
        }
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.topErrorCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow));
        this.topErrorCell.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
        int i = -2;
        this.linearLayout2.addView(this.topErrorCell, 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", R.string.ActionBotDocumentRentalAgreement));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration));
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                this.actionBar.setTitle(LocaleController.getString("ActionBotDocumentTemporaryRegistration", R.string.ActionBotDocumentTemporaryRegistration));
            }
            HeaderCell headerCell2 = new HeaderCell(context);
            this.headerCell = headerCell2;
            headerCell2.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
            this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            this.linearLayout2.addView(this.headerCell, 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(this.uploadDocumentCell, LayoutHelper.createLinear(-1, -2));
            this.uploadDocumentCell.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$6BU9XfRFy2oAZ2kov5VJ6eS6ag */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createAddressInterface$32$PassportActivity(view);
                }
            });
            TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell2;
            textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            if (this.currentBotId != 0) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAddressUploadInfo", R.string.PassportAddAddressUploadInfo);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAgreementInfo", R.string.PassportAddAgreementInfo);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddBillInfo", R.string.PassportAddBillInfo);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddPassportRegistrationInfo", R.string.PassportAddPassportRegistrationInfo);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddTemporaryRegistrationInfo", R.string.PassportAddTemporaryRegistrationInfo);
            } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                this.noAllDocumentsErrorText = LocaleController.getString("PassportAddBankInfo", R.string.PassportAddBankInfo);
            } else {
                this.noAllDocumentsErrorText = "";
            }
            CharSequence charSequence = this.noAllDocumentsErrorText;
            HashMap<String, String> hashMap = this.documentsErrors;
            SpannableStringBuilder spannableStringBuilder = charSequence;
            if (hashMap != null) {
                String str2 = hashMap.get("files_all");
                spannableStringBuilder = charSequence;
                if (str2 != null) {
                    SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(str2);
                    spannableStringBuilder2.append((CharSequence) "\n\n");
                    spannableStringBuilder2.append(this.noAllDocumentsErrorText);
                    spannableStringBuilder2.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)), 0, str2.length(), 33);
                    this.errorsValues.put("files_all", "");
                    spannableStringBuilder = spannableStringBuilder2;
                }
            }
            this.bottomCell.setText(spannableStringBuilder);
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
            if (this.currentDocumentsType.translation_required) {
                HeaderCell headerCell3 = new HeaderCell(context);
                this.headerCell = headerCell3;
                headerCell3.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
                this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
                LinearLayout linearLayout3 = new LinearLayout(context);
                this.translationLayout = linearLayout3;
                linearLayout3.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(this.uploadTranslationCell, LayoutHelper.createLinear(-1, -2));
                this.uploadTranslationCell.setOnClickListener(new View.OnClickListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$oAROmNktEmHIukucxGtrW5vSgE */

                    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, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
                if (this.currentBotId != 0) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationAgreementInfo", R.string.PassportAddTranslationAgreementInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBillInfo", R.string.PassportAddTranslationBillInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationPassportRegistrationInfo", R.string.PassportAddTranslationPassportRegistrationInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationTemporaryRegistrationInfo", R.string.PassportAddTranslationTemporaryRegistrationInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBankInfo", R.string.PassportAddTranslationBankInfo);
                } else {
                    this.noAllTranslationErrorText = "";
                }
                CharSequence charSequence2 = this.noAllTranslationErrorText;
                HashMap<String, String> hashMap2 = this.documentsErrors;
                SpannableStringBuilder spannableStringBuilder3 = charSequence2;
                if (hashMap2 != null) {
                    String str3 = hashMap2.get("translation_all");
                    spannableStringBuilder3 = charSequence2;
                    if (str3 != null) {
                        SpannableStringBuilder spannableStringBuilder4 = new SpannableStringBuilder(str3);
                        spannableStringBuilder4.append((CharSequence) "\n\n");
                        spannableStringBuilder4.append(this.noAllTranslationErrorText);
                        spannableStringBuilder4.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)), 0, str3.length(), 33);
                        this.errorsValues.put("translation_all", "");
                        spannableStringBuilder3 = spannableStringBuilder4;
                    }
                }
                this.bottomCellTranslation.setText(spannableStringBuilder3);
                this.linearLayout2.addView(this.bottomCellTranslation, LayoutHelper.createLinear(-1, -2));
            }
        } else {
            this.actionBar.setTitle(LocaleController.getString("PassportAddress", R.string.PassportAddress));
        }
        HeaderCell headerCell4 = new HeaderCell(context);
        this.headerCell = headerCell4;
        headerCell4.setText(LocaleController.getString("PassportAddressHeader", R.string.PassportAddressHeader));
        this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
        int i2 = 6;
        this.inputFields = new EditTextBoldCursor[6];
        int i3 = 0;
        while (i3 < i2) {
            final EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.inputFields[i3] = editTextBoldCursor;
            AnonymousClass11 r13 = new FrameLayout(context) {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass11 */
                private StaticLayout errorLayout;
                float offsetX;

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
                    StaticLayout errorLayout2 = editTextBoldCursor.getErrorLayout(size);
                    this.errorLayout = errorLayout2;
                    if (errorLayout2 != null) {
                        int lineCount = errorLayout2.getLineCount();
                        int i3 = 0;
                        if (lineCount > 1) {
                            i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.errorLayout.getLineBottom(lineCount - 1) - this.errorLayout.getLineBottom(0)), 1073741824);
                        }
                        if (LocaleController.isRTL) {
                            float f = 0.0f;
                            while (true) {
                                if (i3 >= lineCount) {
                                    break;
                                } else if (this.errorLayout.getLineLeft(i3) != 0.0f) {
                                    this.offsetX = 0.0f;
                                    break;
                                } else {
                                    f = Math.max(f, this.errorLayout.getLineWidth(i3));
                                    if (i3 == lineCount - 1) {
                                        this.offsetX = ((float) size) - f;
                                    }
                                    i3++;
                                }
                            }
                        }
                    }
                    super.onMeasure(i, i2);
                }

                /* access modifiers changed from: protected */
                public void onDraw(Canvas canvas) {
                    if (this.errorLayout != null) {
                        canvas.save();
                        canvas.translate(((float) AndroidUtilities.dp(21.0f)) + this.offsetX, editTextBoldCursor.getLineY() + ((float) AndroidUtilities.dp(3.0f)));
                        this.errorLayout.draw(canvas);
                        canvas.restore();
                    }
                }
            };
            r13.setWillNotDraw(false);
            this.linearLayout2.addView(r13, LayoutHelper.createLinear(-1, i));
            r13.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            int i4 = 5;
            if (i3 == 5) {
                View view = new View(context);
                this.extraBackgroundView = view;
                view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                this.linearLayout2.addView(this.extraBackgroundView, LayoutHelper.createLinear(-1, i2));
            }
            if (this.documentOnly && this.currentDocumentsType != null) {
                r13.setVisibility(8);
                View view2 = this.extraBackgroundView;
                if (view2 != null) {
                    view2.setVisibility(8);
                }
            }
            this.inputFields[i3].setTag(Integer.valueOf(i3));
            this.inputFields[i3].setSupportRtlHint(true);
            this.inputFields[i3].setTextSize(1, 16.0f);
            this.inputFields[i3].setHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.inputFields[i3].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
            this.inputFields[i3].setTransformHintToHeader(true);
            this.inputFields[i3].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i3].setBackgroundDrawable(null);
            this.inputFields[i3].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.inputFields[i3].setCursorSize(AndroidUtilities.dp(20.0f));
            this.inputFields[i3].setCursorWidth(1.5f);
            this.inputFields[i3].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
            if (i3 == 5) {
                this.inputFields[i3].setOnTouchListener(new View.OnTouchListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$NQTouPiOzKqIcu22ojfxH3MpDYE */

                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        return PassportActivity.this.lambda$createAddressInterface$35$PassportActivity(view, motionEvent);
                    }
                });
                this.inputFields[i3].setInputType(0);
                this.inputFields[i3].setFocusable(false);
            } else {
                this.inputFields[i3].setInputType(16385);
                this.inputFields[i3].setImeOptions(268435461);
            }
            if (i3 == 0) {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportStreet1", R.string.PassportStreet1));
                str = "street_line1";
            } else if (i3 == 1) {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportStreet2", R.string.PassportStreet2));
                str = "street_line2";
            } else if (i3 == 2) {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportPostcode", R.string.PassportPostcode));
                str = "post_code";
            } else if (i3 == 3) {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportCity", R.string.PassportCity));
                str = "city";
            } else if (i3 == 4) {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportState", R.string.PassportState));
                str = RemoteConfigConstants.ResponseFieldKey.STATE;
            } else if (i3 != 5) {
                i3++;
                i2 = 6;
                i = -2;
            } else {
                this.inputFields[i3].setHintText(LocaleController.getString("PassportCountry", R.string.PassportCountry));
                str = "country_code";
            }
            setFieldValues(this.currentValues, this.inputFields[i3], str);
            if (i3 == 2) {
                this.inputFields[i3].addTextChangedListener(new TextWatcher() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass12 */
                    private boolean ignore;

                    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void afterTextChanged(Editable editable) {
                        if (!this.ignore) {
                            boolean z = true;
                            this.ignore = true;
                            int i = 0;
                            while (true) {
                                if (i >= editable.length()) {
                                    z = false;
                                    break;
                                }
                                char charAt = editable.charAt(i);
                                if ((charAt < 'a' || charAt > 'z') && ((charAt < 'A' || charAt > 'Z') && !((charAt >= '0' && charAt <= '9') || charAt == '-' || charAt == ' '))) {
                                    break;
                                }
                                i++;
                            }
                            this.ignore = false;
                            if (z) {
                                editTextBoldCursor.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
                            } else {
                                PassportActivity.this.checkFieldForError(editTextBoldCursor, str, editable, false);
                            }
                        }
                    }
                });
                this.inputFields[i3].setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
            } else {
                this.inputFields[i3].addTextChangedListener(new TextWatcher() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass13 */

                    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    }

                    public void afterTextChanged(Editable editable) {
                        PassportActivity.this.checkFieldForError(editTextBoldCursor, str, editable, false);
                    }
                });
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length());
            this.inputFields[i3].setPadding(0, 0, 0, 0);
            EditTextBoldCursor editTextBoldCursor2 = this.inputFields[i3];
            if (!LocaleController.isRTL) {
                i4 = 3;
            }
            editTextBoldCursor2.setGravity(i4 | 16);
            r13.addView(this.inputFields[i3], LayoutHelper.createFrame(-1.0f, 64.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
            this.inputFields[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$CEyBSAI49QS83qo5OMaJT07hkA */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return PassportActivity.this.lambda$createAddressInterface$36$PassportActivity(textView, i, keyEvent);
                }
            });
            i3++;
            i2 = 6;
            i = -2;
        }
        ShadowSectionCell 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, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            TextSettingsCell textSettingsCell3 = new TextSettingsCell(context);
            textSettingsCell3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
            textSettingsCell3.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            if (this.currentDocumentsType == null) {
                textSettingsCell3.setText(LocaleController.getString("PassportDeleteInfo", R.string.PassportDeleteInfo), false);
            } else {
                textSettingsCell3.setText(LocaleController.getString("PassportDeleteDocument", R.string.PassportDeleteDocument), false);
            }
            this.linearLayout2.addView(textSettingsCell3, LayoutHelper.createLinear(-1, -2));
            textSettingsCell3.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$9wLXICC7Spa9CuzJ9SiL101uhwM */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createAddressInterface$37$PassportActivity(view);
                }
            });
            ShadowSectionCell shadowSectionCell2 = new ShadowSectionCell(context);
            this.sectionCell = shadowSectionCell2;
            shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
            this.linearLayout2.addView(this.sectionCell, LayoutHelper.createLinear(-1, -2));
        } else {
            this.sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
            if (this.documentOnly && this.currentDocumentsType != null) {
                this.bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
            }
        }
        updateUploadText(0);
        updateUploadText(4);
    }

    public /* synthetic */ void lambda$createAddressInterface$32$PassportActivity(View view) {
        this.uploadingFileType = 0;
        openAttachMenu();
    }

    public /* synthetic */ void lambda$createAddressInterface$33$PassportActivity(View view) {
        this.uploadingFileType = 4;
        openAttachMenu();
    }

    public /* synthetic */ boolean lambda$createAddressInterface$35$PassportActivity(View view, MotionEvent motionEvent) {
        if (getParentActivity() == null) {
            return false;
        }
        if (motionEvent.getAction() == 1) {
            CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
            countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$KI4aXlzo1DYXEqJ3iRWp5gjz7Q */

                @Override // im.guobwnxjuc.ui.CountrySelectActivity.CountrySelectActivityDelegate
                public final void didSelectCountry(CountrySelectActivity.Country country) {
                    PassportActivity.this.lambda$null$34$PassportActivity(country);
                }
            });
            presentFragment(countrySelectActivity);
        }
        return true;
    }

    public /* synthetic */ void lambda$null$34$PassportActivity(CountrySelectActivity.Country country) {
        if (country != null) {
            this.inputFields[5].setText(country.name);
            this.currentCitizeship = country.shortname;
        }
    }

    public /* synthetic */ boolean lambda$createAddressInterface$36$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i != 5) {
            return false;
        }
        int intValue = ((Integer) textView.getTag()).intValue() + 1;
        EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
        if (intValue < editTextBoldCursorArr.length) {
            if (editTextBoldCursorArr[intValue].isFocusable()) {
                this.inputFields[intValue].requestFocus();
            } else {
                this.inputFields[intValue].dispatchTouchEvent(MotionEvent.obtain(0, 0, 1, 0.0f, 0.0f, 0));
                textView.clearFocus();
                AndroidUtilities.hideKeyboard(textView);
            }
        }
        return true;
    }

    public /* synthetic */ void lambda$createAddressInterface$37$PassportActivity(View view) {
        createDocumentDeleteAlert();
    }

    private void createDocumentDeleteAlert() {
        boolean[] zArr = {true};
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(zArr) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$3xgFtvy8VEWC_e2UlhlUcLZnWgM */
            private final /* synthetic */ boolean[] f$1;

            {
                this.f$1 = r2;
            }

            public final void onClick(DialogInterface dialogInterface, int i) {
                PassportActivity.this.lambda$createDocumentDeleteAlert$38$PassportActivity(this.f$1, dialogInterface, i);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        if (this.documentOnly && this.currentDocumentsType == null && (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
            builder.setMessage(LocaleController.getString("PassportDeleteAddressAlert", R.string.PassportDeleteAddressAlert));
        } else if (!this.documentOnly || this.currentDocumentsType != null || !(this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
            builder.setMessage(LocaleController.getString("PassportDeleteDocumentAlert", R.string.PassportDeleteDocumentAlert));
        } else {
            builder.setMessage(LocaleController.getString("PassportDeletePersonalAlert", R.string.PassportDeletePersonalAlert));
        }
        if (!this.documentOnly && this.currentDocumentsType != null) {
            FrameLayout frameLayout = new FrameLayout(getParentActivity());
            CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity(), 1);
            checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
            if (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                checkBoxCell.setText(LocaleController.getString("PassportDeleteDocumentAddress", R.string.PassportDeleteDocumentAddress), "", true, false);
            } else if (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                checkBoxCell.setText(LocaleController.getString("PassportDeleteDocumentPersonal", R.string.PassportDeleteDocumentPersonal), "", true, false);
            }
            checkBoxCell.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(checkBoxCell, LayoutHelper.createFrame(-1, 48, 51));
            checkBoxCell.setOnClickListener(new View.OnClickListener(zArr) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$5YBbga0aA0bWy8mFW0dCiIq34tg */
                private final /* synthetic */ boolean[] f$0;

                {
                    this.f$0 = r1;
                }

                public final void onClick(View view) {
                    PassportActivity.lambda$createDocumentDeleteAlert$39(this.f$0, view);
                }
            });
            builder.setView(frameLayout);
        }
        showDialog(builder.create());
    }

    public /* synthetic */ void lambda$createDocumentDeleteAlert$38$PassportActivity(boolean[] zArr, DialogInterface dialogInterface, int i) {
        if (!this.documentOnly) {
            this.currentValues.clear();
        }
        this.currentDocumentValues.clear();
        this.delegate.deleteValue(this.currentType, this.currentDocumentsType, this.availableDocumentTypes, zArr[0], null, null);
        finishFragment();
    }

    static /* synthetic */ void lambda$createDocumentDeleteAlert$39(boolean[] zArr, View view) {
        if (view.isEnabled()) {
            zArr[0] = !zArr[0];
            ((CheckBoxCell) view).setChecked(zArr[0], true);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void onFieldError(View view) {
        if (view != null) {
            Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
            if (vibrator != null) {
                vibrator.vibrate(200);
            }
            AndroidUtilities.shakeView(view, 2.0f, 0);
            scrollToField(view);
        }
    }

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

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String getDocumentHash(SecureDocument secureDocument) {
        if (secureDocument == null) {
            return "";
        }
        if (secureDocument.secureFile == null || secureDocument.secureFile.file_hash == null) {
            return secureDocument.fileHash != null ? Base64.encodeToString(secureDocument.fileHash, 2) : "";
        }
        return Base64.encodeToString(secureDocument.secureFile.file_hash, 2);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void checkFieldForError(EditTextBoldCursor editTextBoldCursor, String str, Editable editable, boolean z) {
        String str2;
        String str3;
        String str4;
        HashMap<String, String> hashMap = this.errorsValues;
        if (hashMap == null || (str2 = hashMap.get(str)) == null) {
            editTextBoldCursor.setErrorText(null);
        } else if (TextUtils.equals(str2, editable)) {
            HashMap<String, String> hashMap2 = this.fieldsErrors;
            if (hashMap2 == null || (str4 = hashMap2.get(str)) == null) {
                HashMap<String, String> hashMap3 = this.documentsErrors;
                if (!(hashMap3 == null || (str3 = hashMap3.get(str)) == null)) {
                    editTextBoldCursor.setErrorText(str3);
                }
            } else {
                editTextBoldCursor.setErrorText(str4);
            }
        } else {
            editTextBoldCursor.setErrorText(null);
        }
        String str5 = z ? "error_document_all" : "error_all";
        HashMap<String, String> hashMap4 = this.errorsValues;
        if (hashMap4 != null && hashMap4.containsKey(str5)) {
            this.errorsValues.remove(str5);
            checkTopErrorCell(false);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Code restructure failed: missing block: B:126:0x021e, code lost:
        if (r6 != 5) goto L_0x0230;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:167:0x0294, code lost:
        if (r8 > 24) goto L_0x02a0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:171:0x029e, code lost:
        if (r8 < 2) goto L_0x02a0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:176:0x02ae, code lost:
        if (r8 < 2) goto L_0x02a0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:180:0x02b7, code lost:
        if (r8 > 10) goto L_0x02a0;
     */
    /* JADX WARNING: Removed duplicated region for block: B:134:0x0233  */
    private boolean checkFieldsForError() {
        View[] viewArr;
        boolean z;
        View view;
        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 i = 0; i < size; i++) {
                    SecureDocument secureDocument = this.documents.get(i);
                    String str = "files" + getDocumentHash(secureDocument);
                    if (str != null && this.errorsValues.containsKey(str)) {
                        onFieldError(this.documentsCells.get(secureDocument));
                        return true;
                    }
                }
            }
            if (this.errorsValues.containsKey("files_all") || this.errorsValues.containsKey("translation_all")) {
                onFieldError(this.bottomCell);
                return true;
            }
            View view2 = this.uploadFrontCell;
            if (view2 != null) {
                if (this.frontDocument == null) {
                    onFieldError(view2);
                    return true;
                }
                if (this.errorsValues.containsKey("front" + getDocumentHash(this.frontDocument))) {
                    onFieldError(this.documentsCells.get(this.frontDocument));
                    return true;
                }
            }
            if (((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) && (view = this.uploadReverseCell) != null) {
                if (this.reverseDocument == null) {
                    onFieldError(view);
                    return true;
                }
                if (this.errorsValues.containsKey("reverse" + getDocumentHash(this.reverseDocument))) {
                    onFieldError(this.documentsCells.get(this.reverseDocument));
                    return true;
                }
            }
            View view3 = this.uploadSelfieCell;
            if (!(view3 == null || this.currentBotId == 0)) {
                if (this.selfieDocument == null) {
                    onFieldError(view3);
                    return true;
                }
                if (this.errorsValues.containsKey("selfie" + getDocumentHash(this.selfieDocument))) {
                    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 i2 = 0; i2 < size2; i2++) {
                    SecureDocument secureDocument2 = this.translationDocuments.get(i2);
                    String str2 = "translation" + getDocumentHash(secureDocument2);
                    if (str2 != null && this.errorsValues.containsKey(str2)) {
                        onFieldError(this.documentsCells.get(secureDocument2));
                        return true;
                    }
                }
            }
        }
        for (int i3 = 0; i3 < 2; i3++) {
            if (i3 == 0) {
                viewArr = this.inputFields;
            } else {
                TextInfoPrivacyCell textInfoPrivacyCell = this.nativeInfoCell;
                viewArr = (textInfoPrivacyCell == null || textInfoPrivacyCell.getVisibility() != 0) ? null : this.inputExtraFields;
            }
            if (viewArr != null) {
                int i4 = 0;
                while (i4 < viewArr.length) {
                    boolean hasErrorText = viewArr[i4].hasErrorText();
                    if (!this.errorsValues.isEmpty()) {
                        String str3 = "country_code";
                        if (this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                            if (i3 == 0) {
                                switch (i4) {
                                    case 0:
                                        str3 = "first_name";
                                        break;
                                    case 1:
                                        str3 = "middle_name";
                                        break;
                                    case 2:
                                        str3 = "last_name";
                                        break;
                                    case 3:
                                        str3 = "birth_date";
                                        break;
                                    case 4:
                                        str3 = "gender";
                                        break;
                                    case 6:
                                        str3 = "residence_country_code";
                                        break;
                                    case 7:
                                        str3 = "document_no";
                                        break;
                                    case 8:
                                        str3 = "expiry_date";
                                        break;
                                }
                                if (str3 != null) {
                                    String str4 = this.errorsValues.get(str3);
                                    if (!TextUtils.isEmpty(str4) && str4.equals(viewArr[i4].getText().toString())) {
                                        hasErrorText = true;
                                    }
                                }
                            } else {
                                if (i4 == 0) {
                                    str3 = "first_name_native";
                                } else if (i4 == 1) {
                                    str3 = "middle_name_native";
                                } else if (i4 == 2) {
                                    str3 = "last_name_native";
                                }
                                if (str3 != null) {
                                }
                            }
                        } else if (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                            if (i4 == 0) {
                                str3 = "street_line1";
                            } else if (i4 == 1) {
                                str3 = "street_line2";
                            } else if (i4 == 2) {
                                str3 = "post_code";
                            } else if (i4 == 3) {
                                str3 = "city";
                            } else if (i4 == 4) {
                                str3 = RemoteConfigConstants.ResponseFieldKey.STATE;
                            }
                            if (str3 != null) {
                            }
                        }
                        str3 = null;
                        if (str3 != null) {
                        }
                    }
                    if (!this.documentOnly || this.currentDocumentsType == null || i4 >= 7) {
                        if (!hasErrorText) {
                            int length = viewArr[i4].length();
                            int i5 = this.currentActivityType;
                            if (i5 != 1) {
                                if (i5 == 2) {
                                    if (i4 == 1) {
                                        continue;
                                    } else if (i4 != 3) {
                                        if (i4 == 4) {
                                            if (!"US".equals(this.currentCitizeship)) {
                                                continue;
                                            }
                                        } else if (i4 == 2) {
                                            if (length >= 2) {
                                            }
                                        }
                                    }
                                }
                                z = false;
                                hasErrorText = true;
                            } else if (i4 == 8) {
                                continue;
                            } else if ((i3 == 0 && (i4 == 0 || i4 == 2 || i4 == 1)) || (i3 == 1 && (i4 == 0 || i4 == 1 || i4 == 2))) {
                                if (length > 255) {
                                    hasErrorText = true;
                                }
                                if ((i3 == 0 && i4 == 1) || (i3 == 1 && i4 == 1)) {
                                    z = true;
                                    hasErrorText = true;
                                }
                                z = false;
                                hasErrorText = true;
                            } else {
                                if (i4 == 7) {
                                }
                                z = false;
                                if (!hasErrorText && !z && length == 0) {
                                    hasErrorText = true;
                                }
                            }
                            hasErrorText = true;
                            z = false;
                            hasErrorText = true;
                        }
                        if (hasErrorText) {
                            onFieldError(viewArr[i4]);
                            return true;
                        }
                    }
                    i4++;
                }
                continue;
            }
        }
        return false;
    }

    private void createIdentityInterface(Context context) {
        final String str;
        HashMap<String, String> hashMap;
        final String str2;
        final HashMap<String, String> hashMap2;
        this.languageMap = new HashMap<>();
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                String[] split = readLine.split(";");
                this.languageMap.put(split[1], split[2]);
            }
            bufferedReader.close();
        } catch (Exception e) {
            FileLog.e(e);
        }
        TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
        this.topErrorCell = textInfoPrivacyCell;
        textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow));
        boolean z = false;
        this.topErrorCell.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
        int i = -1;
        this.linearLayout2.addView(this.topErrorCell, LayoutHelper.createLinear(-1, -2));
        checkTopErrorCell(true);
        if (this.currentDocumentsType != null) {
            HeaderCell headerCell2 = new HeaderCell(context);
            this.headerCell = headerCell2;
            if (this.documentOnly) {
                headerCell2.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
            } else {
                headerCell2.setText(LocaleController.getString("PassportRequiredDocuments", R.string.PassportRequiredDocuments));
            }
            this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
            LinearLayout linearLayout = new LinearLayout(context);
            this.frontLayout = linearLayout;
            linearLayout.setOrientation(1);
            this.linearLayout2.addView(this.frontLayout, LayoutHelper.createLinear(-1, -2));
            TextDetailSettingsCell textDetailSettingsCell = new TextDetailSettingsCell(context);
            this.uploadFrontCell = textDetailSettingsCell;
            textDetailSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            this.linearLayout2.addView(this.uploadFrontCell, LayoutHelper.createLinear(-1, -2));
            this.uploadFrontCell.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$nF6UVlMym_e4MOW8VBCQMsvps */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createIdentityInterface$40$PassportActivity(view);
                }
            });
            LinearLayout linearLayout3 = new LinearLayout(context);
            this.reverseLayout = linearLayout3;
            linearLayout3.setOrientation(1);
            this.linearLayout2.addView(this.reverseLayout, LayoutHelper.createLinear(-1, -2));
            boolean z2 = this.currentDocumentsType.selfie_required;
            TextDetailSettingsCell textDetailSettingsCell2 = new TextDetailSettingsCell(context);
            this.uploadReverseCell = textDetailSettingsCell2;
            textDetailSettingsCell2.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            this.uploadReverseCell.setTextAndValue(LocaleController.getString("PassportReverseSide", R.string.PassportReverseSide), LocaleController.getString("PassportReverseSideInfo", R.string.PassportReverseSideInfo), z2);
            this.linearLayout2.addView(this.uploadReverseCell, LayoutHelper.createLinear(-1, -2));
            this.uploadReverseCell.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$BUxTQ1slwZp59463OOBId6u5mI */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createIdentityInterface$41$PassportActivity(view);
                }
            });
            if (this.currentDocumentsType.selfie_required) {
                LinearLayout linearLayout4 = new LinearLayout(context);
                this.selfieLayout = linearLayout4;
                linearLayout4.setOrientation(1);
                this.linearLayout2.addView(this.selfieLayout, LayoutHelper.createLinear(-1, -2));
                TextDetailSettingsCell textDetailSettingsCell3 = new TextDetailSettingsCell(context);
                this.uploadSelfieCell = textDetailSettingsCell3;
                textDetailSettingsCell3.setBackgroundDrawable(Theme.getSelectorDrawable(true));
                this.uploadSelfieCell.setTextAndValue(LocaleController.getString("PassportSelfie", R.string.PassportSelfie), LocaleController.getString("PassportSelfieInfo", R.string.PassportSelfieInfo), this.currentType.translation_required);
                this.linearLayout2.addView(this.uploadSelfieCell, LayoutHelper.createLinear(-1, -2));
                this.uploadSelfieCell.setOnClickListener(new View.OnClickListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$MJbhbm89v6qh_LDXSgdLRVvRw */

                    public final void onClick(View view) {
                        PassportActivity.this.lambda$createIdentityInterface$42$PassportActivity(view);
                    }
                });
            }
            TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell2;
            textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            this.bottomCell.setText(LocaleController.getString("PassportPersonalUploadInfo", R.string.PassportPersonalUploadInfo));
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
            if (this.currentDocumentsType.translation_required) {
                HeaderCell headerCell3 = new HeaderCell(context);
                this.headerCell = headerCell3;
                headerCell3.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
                this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
                LinearLayout linearLayout5 = new LinearLayout(context);
                this.translationLayout = linearLayout5;
                linearLayout5.setOrientation(1);
                this.linearLayout2.addView(this.translationLayout, LayoutHelper.createLinear(-1, -2));
                TextSettingsCell textSettingsCell = new TextSettingsCell(context);
                this.uploadTranslationCell = textSettingsCell;
                textSettingsCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
                this.linearLayout2.addView(this.uploadTranslationCell, LayoutHelper.createLinear(-1, -2));
                this.uploadTranslationCell.setOnClickListener(new View.OnClickListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$5l9eVQAN70M890SLk1RB_EyhH0I */

                    public final void onClick(View view) {
                        PassportActivity.this.lambda$createIdentityInterface$43$PassportActivity(view);
                    }
                });
                TextInfoPrivacyCell textInfoPrivacyCell3 = new TextInfoPrivacyCell(context);
                this.bottomCellTranslation = textInfoPrivacyCell3;
                textInfoPrivacyCell3.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
                if (this.currentBotId != 0) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddPassportInfo", R.string.PassportAddPassportInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddInternalPassportInfo", R.string.PassportAddInternalPassportInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddIdentityCardInfo", R.string.PassportAddIdentityCardInfo);
                } else if (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                    this.noAllTranslationErrorText = LocaleController.getString("PassportAddDriverLicenceInfo", R.string.PassportAddDriverLicenceInfo);
                } else {
                    this.noAllTranslationErrorText = "";
                }
                CharSequence charSequence = this.noAllTranslationErrorText;
                HashMap<String, String> hashMap3 = this.documentsErrors;
                SpannableStringBuilder spannableStringBuilder = charSequence;
                if (hashMap3 != null) {
                    String str3 = hashMap3.get("translation_all");
                    spannableStringBuilder = charSequence;
                    if (str3 != null) {
                        SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(str3);
                        spannableStringBuilder2.append((CharSequence) "\n\n");
                        spannableStringBuilder2.append(this.noAllTranslationErrorText);
                        spannableStringBuilder2.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)), 0, str3.length(), 33);
                        this.errorsValues.put("translation_all", "");
                        spannableStringBuilder = spannableStringBuilder2;
                    }
                }
                this.bottomCellTranslation.setText(spannableStringBuilder);
                this.linearLayout2.addView(this.bottomCellTranslation, LayoutHelper.createLinear(-1, -2));
            }
        } else if (Build.VERSION.SDK_INT >= 18) {
            TextSettingsCell textSettingsCell2 = new TextSettingsCell(context);
            this.scanDocumentCell = textSettingsCell2;
            textSettingsCell2.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            this.scanDocumentCell.setText(LocaleController.getString("PassportScanPassport", R.string.PassportScanPassport), false);
            this.linearLayout2.addView(this.scanDocumentCell, LayoutHelper.createLinear(-1, -2));
            this.scanDocumentCell.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$yCOSnsfUuVVmBpbpi4r4nRPna4 */

                public final void onClick(View view) {
                    PassportActivity.this.lambda$createIdentityInterface$45$PassportActivity(view);
                }
            });
            TextInfoPrivacyCell textInfoPrivacyCell4 = new TextInfoPrivacyCell(context);
            this.bottomCell = textInfoPrivacyCell4;
            textInfoPrivacyCell4.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
            this.bottomCell.setText(LocaleController.getString("PassportScanPassportInfo", R.string.PassportScanPassportInfo));
            this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
        }
        HeaderCell headerCell4 = new HeaderCell(context);
        this.headerCell = headerCell4;
        if (this.documentOnly) {
            headerCell4.setText(LocaleController.getString("PassportDocument", R.string.PassportDocument));
        } else {
            headerCell4.setText(LocaleController.getString("PassportPersonal", R.string.PassportPersonal));
        }
        this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
        int i2 = this.currentDocumentsType != null ? 9 : 7;
        this.inputFields = new EditTextBoldCursor[i2];
        int i3 = 0;
        while (true) {
            int i4 = 64;
            if (i3 < i2) {
                final EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
                this.inputFields[i3] = editTextBoldCursor;
                AnonymousClass14 r4 = new FrameLayout(context) {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass14 */
                    private StaticLayout errorLayout;
                    private float offsetX;

                    /* access modifiers changed from: protected */
                    public void onMeasure(int i, int i2) {
                        int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
                        StaticLayout errorLayout2 = editTextBoldCursor.getErrorLayout(size);
                        this.errorLayout = errorLayout2;
                        if (errorLayout2 != null) {
                            int lineCount = errorLayout2.getLineCount();
                            int i3 = 0;
                            if (lineCount > 1) {
                                i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.errorLayout.getLineBottom(lineCount - 1) - this.errorLayout.getLineBottom(0)), 1073741824);
                            }
                            if (LocaleController.isRTL) {
                                float f = 0.0f;
                                while (true) {
                                    if (i3 >= lineCount) {
                                        break;
                                    } else if (this.errorLayout.getLineLeft(i3) != 0.0f) {
                                        this.offsetX = 0.0f;
                                        break;
                                    } else {
                                        f = Math.max(f, this.errorLayout.getLineWidth(i3));
                                        if (i3 == lineCount - 1) {
                                            this.offsetX = ((float) size) - f;
                                        }
                                        i3++;
                                    }
                                }
                            }
                        }
                        super.onMeasure(i, i2);
                    }

                    /* access modifiers changed from: protected */
                    public void onDraw(Canvas canvas) {
                        if (this.errorLayout != null) {
                            canvas.save();
                            canvas.translate(((float) AndroidUtilities.dp(21.0f)) + this.offsetX, editTextBoldCursor.getLineY() + ((float) AndroidUtilities.dp(3.0f)));
                            this.errorLayout.draw(canvas);
                            canvas.restore();
                        }
                    }
                };
                r4.setWillNotDraw(z);
                this.linearLayout2.addView(r4, LayoutHelper.createLinear(i, 64));
                r4.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                if (i3 == i2 - 1) {
                    View view = new View(context);
                    this.extraBackgroundView = view;
                    view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                    this.linearLayout2.addView(this.extraBackgroundView, LayoutHelper.createLinear(i, 6));
                }
                if (this.documentOnly && this.currentDocumentsType != null) {
                    if (i3 < 7) {
                        r4.setVisibility(8);
                        View view2 = this.extraBackgroundView;
                        if (view2 != null) {
                            view2.setVisibility(8);
                        }
                    }
                }
                this.inputFields[i3].setTag(Integer.valueOf(i3));
                this.inputFields[i3].setSupportRtlHint(true);
                this.inputFields[i3].setTextSize(1, 16.0f);
                this.inputFields[i3].setHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
                this.inputFields[i3].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                this.inputFields[i3].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
                this.inputFields[i3].setTransformHintToHeader(true);
                this.inputFields[i3].setBackgroundDrawable(null);
                this.inputFields[i3].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                this.inputFields[i3].setCursorSize(AndroidUtilities.dp(20.0f));
                this.inputFields[i3].setCursorWidth(1.5f);
                this.inputFields[i3].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
                if (i3 == 5 || i3 == 6) {
                    this.inputFields[i3].setOnTouchListener(new View.OnTouchListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$vvc4D3qBKjabyoQg9EDOI3JiPng */

                        public final boolean onTouch(View view, MotionEvent motionEvent) {
                            return PassportActivity.this.lambda$createIdentityInterface$47$PassportActivity(view, motionEvent);
                        }
                    });
                    this.inputFields[i3].setInputType(0);
                } else if (i3 == 3 || i3 == 8) {
                    this.inputFields[i3].setOnTouchListener(new View.OnTouchListener(context) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$RCMAt4T5vWqMuaUOUf5Vq4NDqcg */
                        private final /* synthetic */ Context f$1;

                        {
                            this.f$1 = r2;
                        }

                        public final boolean onTouch(View view, MotionEvent motionEvent) {
                            return PassportActivity.this.lambda$createIdentityInterface$50$PassportActivity(this.f$1, view, motionEvent);
                        }
                    });
                    this.inputFields[i3].setInputType(0);
                    this.inputFields[i3].setFocusable(false);
                } else if (i3 == 4) {
                    this.inputFields[i3].setOnTouchListener(new View.OnTouchListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$bL0GqV74jPgVZY3i1yzSKyAG4wA */

                        public final boolean onTouch(View view, MotionEvent motionEvent) {
                            return PassportActivity.this.lambda$createIdentityInterface$52$PassportActivity(view, motionEvent);
                        }
                    });
                    this.inputFields[i3].setInputType(0);
                    this.inputFields[i3].setFocusable(false);
                } else {
                    this.inputFields[i3].setInputType(16385);
                    this.inputFields[i3].setImeOptions(268435461);
                }
                switch (i3) {
                    case 0:
                        if (this.currentType.native_names) {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportNameLatin", R.string.PassportNameLatin));
                        } else {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportName", R.string.PassportName));
                        }
                        hashMap2 = this.currentValues;
                        str2 = "first_name";
                        break;
                    case 1:
                        if (this.currentType.native_names) {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportMidnameLatin", R.string.PassportMidnameLatin));
                        } else {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportMidname", R.string.PassportMidname));
                        }
                        hashMap2 = this.currentValues;
                        str2 = "middle_name";
                        break;
                    case 2:
                        if (this.currentType.native_names) {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportSurnameLatin", R.string.PassportSurnameLatin));
                        } else {
                            this.inputFields[i3].setHintText(LocaleController.getString("PassportSurname", R.string.PassportSurname));
                        }
                        hashMap2 = this.currentValues;
                        str2 = "last_name";
                        break;
                    case 3:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportBirthdate", R.string.PassportBirthdate));
                        hashMap2 = this.currentValues;
                        str2 = "birth_date";
                        break;
                    case 4:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportGender", R.string.PassportGender));
                        hashMap2 = this.currentValues;
                        str2 = "gender";
                        break;
                    case 5:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportCitizenship", R.string.PassportCitizenship));
                        hashMap2 = this.currentValues;
                        str2 = "country_code";
                        break;
                    case 6:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportResidence", R.string.PassportResidence));
                        hashMap2 = this.currentValues;
                        str2 = "residence_country_code";
                        break;
                    case 7:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportDocumentNumber", R.string.PassportDocumentNumber));
                        hashMap2 = this.currentDocumentValues;
                        str2 = "document_no";
                        break;
                    case 8:
                        this.inputFields[i3].setHintText(LocaleController.getString("PassportExpired", R.string.PassportExpired));
                        hashMap2 = this.currentDocumentValues;
                        str2 = "expiry_date";
                        break;
                    default:
                        i3++;
                        z = false;
                        i = -1;
                }
                setFieldValues(hashMap2, this.inputFields[i3], str2);
                EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length());
                if (i3 == 0 || i3 == 2 || i3 == 1) {
                    this.inputFields[i3].addTextChangedListener(new TextWatcher() {
                        /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass15 */
                        private boolean ignore;

                        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                        }

                        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                        }

                        public void afterTextChanged(Editable editable) {
                            boolean z;
                            if (!this.ignore) {
                                int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
                                int i = 0;
                                while (true) {
                                    if (i >= editable.length()) {
                                        z = false;
                                        break;
                                    }
                                    char charAt = editable.charAt(i);
                                    if ((charAt < '0' || charAt > '9') && ((charAt < 'a' || charAt > 'z') && !((charAt >= 'A' && charAt <= 'Z') || charAt == ' ' || charAt == '\'' || charAt == ',' || charAt == '.' || charAt == '&' || charAt == '-' || charAt == '/'))) {
                                        z = true;
                                        break;
                                    }
                                    i++;
                                }
                                if (!z || PassportActivity.this.allowNonLatinName) {
                                    PassportActivity.this.nonLatinNames[intValue] = z;
                                    PassportActivity.this.checkFieldForError(editTextBoldCursor, str2, editable, false);
                                    return;
                                }
                                editTextBoldCursor.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
                            }
                        }
                    });
                } else {
                    this.inputFields[i3].addTextChangedListener(new TextWatcher() {
                        /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass16 */

                        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                        }

                        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                        }

                        public void afterTextChanged(Editable editable) {
                            PassportActivity passportActivity = PassportActivity.this;
                            passportActivity.checkFieldForError(editTextBoldCursor, str2, editable, hashMap2 == passportActivity.currentDocumentValues);
                            int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
                            EditTextBoldCursor editTextBoldCursor = PassportActivity.this.inputFields[intValue];
                            if (intValue == 6) {
                                PassportActivity.this.checkNativeFields(true);
                            }
                        }
                    });
                }
                this.inputFields[i3].setPadding(0, 0, 0, 0);
                this.inputFields[i3].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
                r4.addView(this.inputFields[i3], LayoutHelper.createFrame(-1.0f, -1.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
                this.inputFields[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$Uu9HQQ8cDUwCJCB2hnJ2WFXREEA */

                    public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                        return PassportActivity.this.lambda$createIdentityInterface$53$PassportActivity(textView, i, keyEvent);
                    }
                });
                i3++;
                z = false;
                i = -1;
            } else {
                ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context);
                this.sectionCell2 = shadowSectionCell;
                this.linearLayout2.addView(shadowSectionCell, LayoutHelper.createLinear(-1, -2));
                HeaderCell headerCell5 = new HeaderCell(context);
                this.headerCell = headerCell5;
                headerCell5.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
                int i5 = 3;
                this.inputExtraFields = new EditTextBoldCursor[3];
                int i6 = 0;
                while (i6 < i5) {
                    final EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
                    this.inputExtraFields[i6] = editTextBoldCursor2;
                    AnonymousClass17 r7 = new FrameLayout(context) {
                        /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass17 */
                        private StaticLayout errorLayout;
                        private float offsetX;

                        /* access modifiers changed from: protected */
                        public void onMeasure(int i, int i2) {
                            int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
                            StaticLayout errorLayout2 = editTextBoldCursor2.getErrorLayout(size);
                            this.errorLayout = errorLayout2;
                            if (errorLayout2 != null) {
                                int lineCount = errorLayout2.getLineCount();
                                int i3 = 0;
                                if (lineCount > 1) {
                                    i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.errorLayout.getLineBottom(lineCount - 1) - this.errorLayout.getLineBottom(0)), 1073741824);
                                }
                                if (LocaleController.isRTL) {
                                    float f = 0.0f;
                                    while (true) {
                                        if (i3 >= lineCount) {
                                            break;
                                        } else if (this.errorLayout.getLineLeft(i3) != 0.0f) {
                                            this.offsetX = 0.0f;
                                            break;
                                        } else {
                                            f = Math.max(f, this.errorLayout.getLineWidth(i3));
                                            if (i3 == lineCount - 1) {
                                                this.offsetX = ((float) size) - f;
                                            }
                                            i3++;
                                        }
                                    }
                                }
                            }
                            super.onMeasure(i, i2);
                        }

                        /* access modifiers changed from: protected */
                        public void onDraw(Canvas canvas) {
                            if (this.errorLayout != null) {
                                canvas.save();
                                canvas.translate(((float) AndroidUtilities.dp(21.0f)) + this.offsetX, editTextBoldCursor2.getLineY() + ((float) AndroidUtilities.dp(3.0f)));
                                this.errorLayout.draw(canvas);
                                canvas.restore();
                            }
                        }
                    };
                    r7.setWillNotDraw(false);
                    this.linearLayout2.addView(r7, LayoutHelper.createLinear(-1, i4));
                    r7.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                    if (i6 == 2) {
                        View view3 = new View(context);
                        this.extraBackgroundView2 = view3;
                        view3.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                        this.linearLayout2.addView(this.extraBackgroundView2, LayoutHelper.createLinear(-1, 6));
                    }
                    this.inputExtraFields[i6].setTag(Integer.valueOf(i6));
                    this.inputExtraFields[i6].setSupportRtlHint(true);
                    this.inputExtraFields[i6].setTextSize(1, 16.0f);
                    this.inputExtraFields[i6].setHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
                    this.inputExtraFields[i6].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                    this.inputExtraFields[i6].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
                    this.inputExtraFields[i6].setTransformHintToHeader(true);
                    this.inputExtraFields[i6].setBackgroundDrawable(null);
                    this.inputExtraFields[i6].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                    this.inputExtraFields[i6].setCursorSize(AndroidUtilities.dp(20.0f));
                    this.inputExtraFields[i6].setCursorWidth(1.5f);
                    this.inputExtraFields[i6].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
                    this.inputExtraFields[i6].setInputType(16385);
                    this.inputExtraFields[i6].setImeOptions(268435461);
                    if (i6 == 0) {
                        hashMap = this.currentValues;
                        str = "first_name_native";
                    } else if (i6 == 1) {
                        hashMap = this.currentValues;
                        str = "middle_name_native";
                    } else if (i6 != 2) {
                        i6++;
                        i5 = 3;
                        i4 = 64;
                    } else {
                        hashMap = this.currentValues;
                        str = "last_name_native";
                    }
                    setFieldValues(hashMap, this.inputExtraFields[i6], str);
                    EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                    editTextBoldCursorArr2[i6].setSelection(editTextBoldCursorArr2[i6].length());
                    if (i6 == 0 || i6 == 2 || i6 == 1) {
                        this.inputExtraFields[i6].addTextChangedListener(new TextWatcher() {
                            /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass18 */
                            private boolean ignore;

                            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void afterTextChanged(Editable editable) {
                                if (!this.ignore) {
                                    PassportActivity.this.checkFieldForError(editTextBoldCursor2, str, editable, false);
                                }
                            }
                        });
                    }
                    this.inputExtraFields[i6].setPadding(0, 0, 0, 0);
                    this.inputExtraFields[i6].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
                    r7.addView(this.inputExtraFields[i6], LayoutHelper.createFrame(-1.0f, -1.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
                    this.inputExtraFields[i6].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$33sCD8ZaIu0lMht57oBzzpiNxw */

                        public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                            return PassportActivity.this.lambda$createIdentityInterface$54$PassportActivity(textView, i, keyEvent);
                        }
                    });
                    i6++;
                    i5 = 3;
                    i4 = 64;
                }
                TextInfoPrivacyCell textInfoPrivacyCell5 = new TextInfoPrivacyCell(context);
                this.nativeInfoCell = textInfoPrivacyCell5;
                this.linearLayout2.addView(textInfoPrivacyCell5, LayoutHelper.createLinear(-1, -2));
                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);
                        if (this.currentDocumentsTypeValue.front_side instanceof TLRPC.TL_secureFile) {
                            addDocumentViewInternal((TLRPC.TL_secureFile) this.currentDocumentsTypeValue.front_side, 2);
                        }
                        if (this.currentDocumentsTypeValue.reverse_side instanceof TLRPC.TL_secureFile) {
                            addDocumentViewInternal((TLRPC.TL_secureFile) this.currentDocumentsTypeValue.reverse_side, 3);
                        }
                        if (this.currentDocumentsTypeValue.selfie instanceof TLRPC.TL_secureFile) {
                            addDocumentViewInternal((TLRPC.TL_secureFile) this.currentDocumentsTypeValue.selfie, 1);
                        }
                        addTranslationDocumentViews(this.currentDocumentsTypeValue.translation);
                    }
                    TextSettingsCell textSettingsCell3 = new TextSettingsCell(context);
                    textSettingsCell3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
                    textSettingsCell3.setBackgroundDrawable(Theme.getSelectorDrawable(true));
                    if (this.currentDocumentsType == null) {
                        textSettingsCell3.setText(LocaleController.getString("PassportDeleteInfo", R.string.PassportDeleteInfo), false);
                    } else {
                        textSettingsCell3.setText(LocaleController.getString("PassportDeleteDocument", R.string.PassportDeleteDocument), false);
                    }
                    this.linearLayout2.addView(textSettingsCell3, LayoutHelper.createLinear(-1, -2));
                    textSettingsCell3.setOnClickListener(new View.OnClickListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$wsfos3FVu2KkbmYbzSHZBRMYvE */

                        public final void onClick(View view) {
                            PassportActivity.this.lambda$createIdentityInterface$55$PassportActivity(view);
                        }
                    });
                    this.nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
                    ShadowSectionCell shadowSectionCell2 = new ShadowSectionCell(context);
                    this.sectionCell = shadowSectionCell2;
                    shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
                    this.linearLayout2.addView(this.sectionCell, LayoutHelper.createLinear(-1, -2));
                } else {
                    this.nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
                }
                updateInterfaceStringsForDocumentType();
                checkNativeFields(false);
                return;
            }
        }
    }

    public /* synthetic */ void lambda$createIdentityInterface$40$PassportActivity(View view) {
        this.uploadingFileType = 2;
        openAttachMenu();
    }

    public /* synthetic */ void lambda$createIdentityInterface$41$PassportActivity(View view) {
        this.uploadingFileType = 3;
        openAttachMenu();
    }

    public /* synthetic */ void lambda$createIdentityInterface$42$PassportActivity(View view) {
        this.uploadingFileType = 1;
        openAttachMenu();
    }

    public /* synthetic */ void lambda$createIdentityInterface$43$PassportActivity(View view) {
        this.uploadingFileType = 4;
        openAttachMenu();
    }

    public /* synthetic */ void lambda$createIdentityInterface$45$PassportActivity(View view) {
        if (Build.VERSION.SDK_INT < 23 || getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) == 0) {
            MrzCameraActivity mrzCameraActivity = new MrzCameraActivity();
            mrzCameraActivity.setDelegate(new MrzCameraActivity.MrzCameraActivityDelegate() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$eaWSKv8XOI8OyFvsNVENbQRpQlw */

                @Override // im.guobwnxjuc.ui.MrzCameraActivity.MrzCameraActivityDelegate
                public final void didFindMrzInfo(MrzRecognizer.Result result) {
                    PassportActivity.this.lambda$null$44$PassportActivity(result);
                }
            });
            presentFragment(mrzCameraActivity);
            return;
        }
        getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 22);
    }

    public /* synthetic */ void lambda$null$44$PassportActivity(MrzRecognizer.Result result) {
        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", R.string.PassportMale));
            } else if (i == 2) {
                this.currentGender = "female";
                this.inputFields[4].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
            }
        }
        if (!TextUtils.isEmpty(result.nationality)) {
            String str = result.nationality;
            this.currentCitizeship = str;
            String str2 = this.languageMap.get(str);
            if (str2 != null) {
                this.inputFields[5].setText(str2);
            }
        }
        if (!TextUtils.isEmpty(result.issuingCountry)) {
            String str3 = result.issuingCountry;
            this.currentResidence = str3;
            String str4 = this.languageMap.get(str3);
            if (str4 != null) {
                this.inputFields[6].setText(str4);
            }
        }
        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 /* synthetic */ boolean lambda$createIdentityInterface$47$PassportActivity(View view, MotionEvent motionEvent) {
        if (getParentActivity() == null) {
            return false;
        }
        if (motionEvent.getAction() == 1) {
            CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
            countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate(view) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$tKuAvMcK4MiEEx7OiRTokpZmvA */
                private final /* synthetic */ View f$1;

                {
                    this.f$1 = r2;
                }

                @Override // im.guobwnxjuc.ui.CountrySelectActivity.CountrySelectActivityDelegate
                public final void didSelectCountry(CountrySelectActivity.Country country) {
                    PassportActivity.this.lambda$null$46$PassportActivity(this.f$1, country);
                }
            });
            presentFragment(countrySelectActivity);
        }
        return true;
    }

    public /* synthetic */ void lambda$null$46$PassportActivity(View view, CountrySelectActivity.Country country) {
        if (country != null) {
            int intValue = ((Integer) view.getTag()).intValue();
            EditTextBoldCursor editTextBoldCursor = this.inputFields[intValue];
            if (intValue == 5) {
                this.currentCitizeship = country.shortname;
            } else {
                this.currentResidence = country.shortname;
            }
            editTextBoldCursor.setText(country.name + "");
        }
    }

    public /* synthetic */ boolean lambda$createIdentityInterface$50$PassportActivity(Context context, View view, MotionEvent motionEvent) {
        String str;
        int i;
        int i2;
        int i3;
        int i4;
        int i5;
        int i6;
        if (getParentActivity() == null) {
            return false;
        }
        if (motionEvent.getAction() == 1) {
            Calendar instance = Calendar.getInstance();
            instance.get(1);
            instance.get(2);
            instance.get(5);
            try {
                EditTextBoldCursor editTextBoldCursor = (EditTextBoldCursor) view;
                int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
                if (intValue == 8) {
                    str = LocaleController.getString("PassportSelectExpiredDate", R.string.PassportSelectExpiredDate);
                    i3 = 0;
                    i2 = 20;
                    i = 0;
                } else {
                    str = LocaleController.getString("PassportSelectBithdayDate", R.string.PassportSelectBithdayDate);
                    i3 = -120;
                    i2 = 0;
                    i = -18;
                }
                String[] split = editTextBoldCursor.getText().toString().split("\\.");
                if (split.length == 3) {
                    int intValue2 = Utilities.parseInt(split[0]).intValue();
                    int intValue3 = Utilities.parseInt(split[1]).intValue();
                    i4 = Utilities.parseInt(split[2]).intValue();
                    i6 = intValue2;
                    i5 = intValue3;
                } else {
                    i6 = -1;
                    i5 = -1;
                    i4 = -1;
                }
                AlertDialog.Builder createDatePickerDialog = AlertsCreator.createDatePickerDialog(context, i3, i2, i, i6, i5, i4, str, intValue == 8, new AlertsCreator.DatePickerDelegate(intValue, editTextBoldCursor) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$1tgF0XItITbigYOQj_KUfRXQd8 */
                    private final /* synthetic */ int f$1;
                    private final /* synthetic */ EditTextBoldCursor f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    @Override // im.guobwnxjuc.ui.components.AlertsCreator.DatePickerDelegate
                    public final void didSelectDate(int i, int i2, int i3) {
                        PassportActivity.this.lambda$null$48$PassportActivity(this.f$1, this.f$2, i, i2, i3);
                    }
                });
                if (intValue == 8) {
                    createDatePickerDialog.setNegativeButton(LocaleController.getString("PassportSelectNotExpire", R.string.PassportSelectNotExpire), new DialogInterface.OnClickListener(editTextBoldCursor) {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$pRbvJ2D2bK66fX2STjYeFXUgiw */
                        private final /* synthetic */ EditTextBoldCursor f$1;

                        {
                            this.f$1 = r2;
                        }

                        public final void onClick(DialogInterface dialogInterface, int i) {
                            PassportActivity.this.lambda$null$49$PassportActivity(this.f$1, dialogInterface, i);
                        }
                    });
                }
                showDialog(createDatePickerDialog.create());
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
        return true;
    }

    public /* synthetic */ void lambda$null$48$PassportActivity(int i, EditTextBoldCursor editTextBoldCursor, int i2, int i3, int i4) {
        if (i == 8) {
            int[] iArr = this.currentExpireDate;
            iArr[0] = i2;
            iArr[1] = i3 + 1;
            iArr[2] = i4;
        }
        editTextBoldCursor.setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i4), Integer.valueOf(i3 + 1), Integer.valueOf(i2)));
    }

    public /* synthetic */ void lambda$null$49$PassportActivity(EditTextBoldCursor editTextBoldCursor, DialogInterface dialogInterface, int i) {
        int[] iArr = this.currentExpireDate;
        iArr[2] = 0;
        iArr[1] = 0;
        iArr[0] = 0;
        editTextBoldCursor.setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
    }

    public /* synthetic */ boolean lambda$createIdentityInterface$52$PassportActivity(View view, MotionEvent motionEvent) {
        if (getParentActivity() == null) {
            return false;
        }
        if (motionEvent.getAction() == 1) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("PassportSelectGender", R.string.PassportSelectGender));
            builder.setItems(new CharSequence[]{LocaleController.getString("PassportMale", R.string.PassportMale), LocaleController.getString("PassportFemale", R.string.PassportFemale)}, new DialogInterface.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$OO42yRVCz8m_oh7D3L4Lq7vzpXY */

                public final void onClick(DialogInterface dialogInterface, int i) {
                    PassportActivity.this.lambda$null$51$PassportActivity(dialogInterface, i);
                }
            });
            builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
        }
        return true;
    }

    public /* synthetic */ void lambda$null$51$PassportActivity(DialogInterface dialogInterface, int i) {
        if (i == 0) {
            this.currentGender = "male";
            this.inputFields[4].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
        } else if (i == 1) {
            this.currentGender = "female";
            this.inputFields[4].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
        }
    }

    public /* synthetic */ boolean lambda$createIdentityInterface$53$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
        if (i != 5) {
            return false;
        }
        int intValue = ((Integer) textView.getTag()).intValue() + 1;
        EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
        if (intValue < editTextBoldCursorArr.length) {
            if (editTextBoldCursorArr[intValue].isFocusable()) {
                this.inputFields[intValue].requestFocus();
            } else {
                this.inputFields[intValue].dispatchTouchEvent(MotionEvent.obtain(0, 0, 1, 0.0f, 0.0f, 0));
                textView.clearFocus();
                AndroidUtilities.hideKeyboard(textView);
            }
        }
        return true;
    }

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

    public /* synthetic */ void lambda$createIdentityInterface$55$PassportActivity(View view) {
        createDocumentDeleteAlert();
    }

    private void updateInterfaceStringsForDocumentType() {
        if (this.currentDocumentsType != null) {
            this.actionBar.setTitle(getTextForType(this.currentDocumentsType.type));
        } else {
            this.actionBar.setTitle(LocaleController.getString("PassportPersonal", R.string.PassportPersonal));
        }
        updateUploadText(2);
        updateUploadText(3);
        updateUploadText(1);
        updateUploadText(4);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void updateUploadText(int i) {
        boolean z = true;
        int i2 = 0;
        if (i == 0) {
            if (this.uploadDocumentCell != null) {
                if (this.documents.size() >= 1) {
                    this.uploadDocumentCell.setText(LocaleController.getString("PassportUploadAdditinalDocument", R.string.PassportUploadAdditinalDocument), false);
                } else {
                    this.uploadDocumentCell.setText(LocaleController.getString("PassportUploadDocument", R.string.PassportUploadDocument), false);
                }
            }
        } else if (i == 1) {
            TextDetailSettingsCell textDetailSettingsCell = this.uploadSelfieCell;
            if (textDetailSettingsCell != null) {
                if (this.selfieDocument != null) {
                    i2 = 8;
                }
                textDetailSettingsCell.setVisibility(i2);
            }
        } else if (i == 4) {
            if (this.uploadTranslationCell != null) {
                if (this.translationDocuments.size() >= 1) {
                    this.uploadTranslationCell.setText(LocaleController.getString("PassportUploadAdditinalDocument", R.string.PassportUploadAdditinalDocument), false);
                } else {
                    this.uploadTranslationCell.setText(LocaleController.getString("PassportUploadDocument", R.string.PassportUploadDocument), false);
                }
            }
        } else if (i == 2) {
            if (this.uploadFrontCell != null) {
                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;
                }
                if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                    this.uploadFrontCell.setTextAndValue(LocaleController.getString("PassportMainPage", R.string.PassportMainPage), LocaleController.getString("PassportMainPageInfo", R.string.PassportMainPageInfo), z);
                } else {
                    this.uploadFrontCell.setTextAndValue(LocaleController.getString("PassportFrontSide", R.string.PassportFrontSide), LocaleController.getString("PassportFrontSideInfo", R.string.PassportFrontSideInfo), z);
                }
                TextDetailSettingsCell textDetailSettingsCell2 = this.uploadFrontCell;
                if (this.frontDocument != null) {
                    i2 = 8;
                }
                textDetailSettingsCell2.setVisibility(i2);
            }
        } else if (i == 3 && this.uploadReverseCell != null) {
            if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
                this.reverseLayout.setVisibility(0);
                TextDetailSettingsCell textDetailSettingsCell3 = this.uploadReverseCell;
                if (this.reverseDocument != null) {
                    i2 = 8;
                }
                textDetailSettingsCell3.setVisibility(i2);
                return;
            }
            this.reverseLayout.setVisibility(8);
            this.uploadReverseCell.setVisibility(8);
        }
    }

    private void checkTopErrorCell(boolean z) {
        String str;
        String str2;
        if (this.topErrorCell != null) {
            SpannableStringBuilder spannableStringBuilder = null;
            if (this.fieldsErrors != null && ((z || this.errorsValues.containsKey("error_all")) && (str2 = this.fieldsErrors.get("error_all")) != null)) {
                spannableStringBuilder = new SpannableStringBuilder(str2);
                if (z) {
                    this.errorsValues.put("error_all", "");
                }
            }
            if (this.documentsErrors != null && ((z || this.errorsValues.containsKey("error_document_all")) && (str = this.documentsErrors.get("error_all")) != null)) {
                if (spannableStringBuilder == null) {
                    spannableStringBuilder = new SpannableStringBuilder(str);
                } else {
                    spannableStringBuilder.append((CharSequence) "\n\n").append((CharSequence) str);
                }
                if (z) {
                    this.errorsValues.put("error_document_all", "");
                }
            }
            if (spannableStringBuilder != null) {
                spannableStringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)), 0, spannableStringBuilder.length(), 33);
                this.topErrorCell.setText(spannableStringBuilder);
                this.topErrorCell.setVisibility(0);
            } else if (this.topErrorCell.getVisibility() != 8) {
                this.topErrorCell.setVisibility(8);
            }
        }
    }

    private void addDocumentViewInternal(TLRPC.TL_secureFile tL_secureFile, int i) {
        addDocumentView(new SecureDocument(getSecureDocumentKey(tL_secureFile.secret, tL_secureFile.file_hash), tL_secureFile, null, null, null), i);
    }

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

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

    /* JADX WARNING: Removed duplicated region for block: B:28:0x008a  */
    private void setFieldValues(HashMap<String, String> hashMap, EditTextBoldCursor editTextBoldCursor, String str) {
        CharSequence charSequence;
        CharSequence charSequence2;
        boolean z;
        String str2 = hashMap.get(str);
        if (str2 != null) {
            char c = 65535;
            switch (str.hashCode()) {
                case -2006252145:
                    if (str.equals("residence_country_code")) {
                        c = 1;
                        break;
                    }
                    break;
                case -1249512767:
                    if (str.equals("gender")) {
                        c = 2;
                        break;
                    }
                    break;
                case 475919162:
                    if (str.equals("expiry_date")) {
                        c = 3;
                        break;
                    }
                    break;
                case 1481071862:
                    if (str.equals("country_code")) {
                        c = 0;
                        break;
                    }
                    break;
            }
            if (c == 0) {
                this.currentCitizeship = str2;
                CharSequence charSequence3 = (String) this.languageMap.get(str2);
                if (charSequence3 != null) {
                    editTextBoldCursor.setText(charSequence3);
                }
            } else if (c == 1) {
                this.currentResidence = str2;
                CharSequence charSequence4 = (String) this.languageMap.get(str2);
                if (charSequence4 != null) {
                    editTextBoldCursor.setText(charSequence4);
                }
            } else if (c != 2) {
                if (c != 3) {
                    editTextBoldCursor.setText(str2);
                } else {
                    if (!TextUtils.isEmpty(str2)) {
                        String[] split = str2.split("\\.");
                        if (split.length == 3) {
                            this.currentExpireDate[0] = Utilities.parseInt(split[2]).intValue();
                            this.currentExpireDate[1] = Utilities.parseInt(split[1]).intValue();
                            this.currentExpireDate[2] = Utilities.parseInt(split[0]).intValue();
                            editTextBoldCursor.setText(str2);
                            z = true;
                            if (!z) {
                                int[] iArr = this.currentExpireDate;
                                iArr[2] = 0;
                                iArr[1] = 0;
                                iArr[0] = 0;
                                editTextBoldCursor.setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
                            }
                        }
                    }
                    z = false;
                    if (!z) {
                    }
                }
            } else if ("male".equals(str2)) {
                this.currentGender = str2;
                editTextBoldCursor.setText(LocaleController.getString("PassportMale", R.string.PassportMale));
            } else if ("female".equals(str2)) {
                this.currentGender = str2;
                editTextBoldCursor.setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
            }
        }
        HashMap<String, String> hashMap2 = this.fieldsErrors;
        if (hashMap2 == null || (charSequence2 = (String) hashMap2.get(str)) == null) {
            HashMap<String, String> hashMap3 = this.documentsErrors;
            if (hashMap3 != null && (charSequence = (String) hashMap3.get(str)) != null) {
                editTextBoldCursor.setErrorText(charSequence);
                this.errorsValues.put(str, editTextBoldCursor.getText().toString());
                return;
            }
            return;
        }
        editTextBoldCursor.setErrorText(charSequence2);
        this.errorsValues.put(str, editTextBoldCursor.getText().toString());
    }

    private void addDocumentView(SecureDocument secureDocument, int i) {
        String string;
        String str;
        String str2;
        HashMap<String, String> hashMap;
        if (i == 1) {
            this.selfieDocument = secureDocument;
            if (this.selfieLayout == null) {
                return;
            }
        } else if (i == 4) {
            this.translationDocuments.add(secureDocument);
            if (this.translationLayout == null) {
                return;
            }
        } else if (i == 2) {
            this.frontDocument = secureDocument;
            if (this.frontLayout == null) {
                return;
            }
        } else if (i == 3) {
            this.reverseDocument = secureDocument;
            if (this.reverseLayout == null) {
                return;
            }
        } else {
            this.documents.add(secureDocument);
            if (this.documentsLayout == null) {
                return;
            }
        }
        if (getParentActivity() != null) {
            SecureDocumentCell secureDocumentCell = new SecureDocumentCell(getParentActivity());
            secureDocumentCell.setTag(secureDocument);
            secureDocumentCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
            this.documentsCells.put(secureDocument, secureDocumentCell);
            String documentHash = getDocumentHash(secureDocument);
            if (i == 1) {
                string = LocaleController.getString("PassportSelfie", R.string.PassportSelfie);
                this.selfieLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
                str = "selfie" + documentHash;
            } else if (i == 4) {
                string = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
                this.translationLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
                str = "translation" + documentHash;
            } else if (i == 2) {
                if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                    string = LocaleController.getString("PassportMainPage", R.string.PassportMainPage);
                } else {
                    string = LocaleController.getString("PassportFrontSide", R.string.PassportFrontSide);
                }
                this.frontLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
                str = "front" + documentHash;
            } else if (i == 3) {
                string = LocaleController.getString("PassportReverseSide", R.string.PassportReverseSide);
                this.reverseLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
                str = "reverse" + documentHash;
            } else {
                string = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
                this.documentsLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
                str = "files" + documentHash;
            }
            if (str == null || (hashMap = this.documentsErrors) == null || (str2 = hashMap.get(str)) == null) {
                str2 = LocaleController.formatDateForBan((long) secureDocument.secureFile.date);
            } else {
                secureDocumentCell.valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
                this.errorsValues.put(str, "");
            }
            secureDocumentCell.setTextAndValueAndImage(string, str2, secureDocument);
            secureDocumentCell.setOnClickListener(new View.OnClickListener(i) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$ZcoD_QNhJQsHr2m48QybVnCKfeQ */
                private final /* synthetic */ int f$1;

                {
                    this.f$1 = r2;
                }

                public final void onClick(View view) {
                    PassportActivity.this.lambda$addDocumentView$56$PassportActivity(this.f$1, view);
                }
            });
            secureDocumentCell.setOnLongClickListener(new View.OnLongClickListener(i, secureDocument, secureDocumentCell, str) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$RUQ81i0h0w3ucreMpO0FU0Y6E9Q */
                private final /* synthetic */ int f$1;
                private final /* synthetic */ SecureDocument f$2;
                private final /* synthetic */ PassportActivity.SecureDocumentCell f$3;
                private final /* synthetic */ String f$4;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                    this.f$4 = r5;
                }

                public final boolean onLongClick(View view) {
                    return PassportActivity.this.lambda$addDocumentView$58$PassportActivity(this.f$1, this.f$2, this.f$3, this.f$4, view);
                }
            });
        }
    }

    public /* synthetic */ void lambda$addDocumentView$56$PassportActivity(int i, View view) {
        this.uploadingFileType = i;
        if (i == 1) {
            this.currentPhotoViewerLayout = this.selfieLayout;
        } else if (i == 4) {
            this.currentPhotoViewerLayout = this.translationLayout;
        } else if (i == 2) {
            this.currentPhotoViewerLayout = this.frontLayout;
        } else if (i == 3) {
            this.currentPhotoViewerLayout = this.reverseLayout;
        } else {
            this.currentPhotoViewerLayout = this.documentsLayout;
        }
        SecureDocument secureDocument = (SecureDocument) view.getTag();
        PhotoViewer.getInstance().setParentActivity(getParentActivity());
        if (i == 0) {
            PhotoViewer instance = PhotoViewer.getInstance();
            ArrayList<SecureDocument> arrayList = this.documents;
            instance.openPhoto(arrayList, arrayList.indexOf(secureDocument), this.provider);
            return;
        }
        PhotoViewer instance2 = PhotoViewer.getInstance();
        ArrayList<SecureDocument> arrayList2 = this.translationDocuments;
        instance2.openPhoto(arrayList2, arrayList2.indexOf(secureDocument), this.provider);
    }

    public /* synthetic */ boolean lambda$addDocumentView$58$PassportActivity(int i, SecureDocument secureDocument, SecureDocumentCell secureDocumentCell, String str, View view) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        if (i == 1) {
            builder.setMessage(LocaleController.getString("PassportDeleteSelfie", R.string.PassportDeleteSelfie));
        } else {
            builder.setMessage(LocaleController.getString("PassportDeleteScan", R.string.PassportDeleteScan));
        }
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(secureDocument, i, secureDocumentCell, str) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$DjWPocfZeFjxm0NHZfHIIKfM_7I */
            private final /* synthetic */ SecureDocument f$1;
            private final /* synthetic */ int f$2;
            private final /* synthetic */ PassportActivity.SecureDocumentCell f$3;
            private final /* synthetic */ String f$4;

            {
                this.f$1 = r2;
                this.f$2 = r3;
                this.f$3 = r4;
                this.f$4 = r5;
            }

            public final void onClick(DialogInterface dialogInterface, int i) {
                PassportActivity.this.lambda$null$57$PassportActivity(this.f$1, this.f$2, this.f$3, this.f$4, dialogInterface, i);
            }
        });
        showDialog(builder.create());
        return true;
    }

    public /* synthetic */ void lambda$null$57$PassportActivity(SecureDocument secureDocument, int i, SecureDocumentCell secureDocumentCell, String str, DialogInterface dialogInterface, int i2) {
        this.documentsCells.remove(secureDocument);
        if (i == 1) {
            this.selfieDocument = null;
            this.selfieLayout.removeView(secureDocumentCell);
        } else if (i == 4) {
            this.translationDocuments.remove(secureDocument);
            this.translationLayout.removeView(secureDocumentCell);
        } else if (i == 2) {
            this.frontDocument = null;
            this.frontLayout.removeView(secureDocumentCell);
        } else if (i == 3) {
            this.reverseDocument = null;
            this.reverseLayout.removeView(secureDocumentCell);
        } else {
            this.documents.remove(secureDocument);
            this.documentsLayout.removeView(secureDocumentCell);
        }
        if (str != null) {
            HashMap<String, String> hashMap = this.documentsErrors;
            if (hashMap != null) {
                hashMap.remove(str);
            }
            HashMap<String, String> hashMap2 = this.errorsValues;
            if (hashMap2 != null) {
                hashMap2.remove(str);
            }
        }
        updateUploadText(i);
        if (secureDocument.path != null && this.uploadingDocuments.remove(secureDocument.path) != null) {
            if (this.uploadingDocuments.isEmpty()) {
                this.doneItem.setEnabled(true);
                this.doneItem.setAlpha(1.0f);
            }
            FileLoader.getInstance(this.currentAccount).cancelUploadFile(secureDocument.path, false);
        }
    }

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

    private TextDetailSecureCell getViewByType(TLRPC.TL_secureRequiredType tL_secureRequiredType) {
        TLRPC.TL_secureRequiredType tL_secureRequiredType2;
        TextDetailSecureCell textDetailSecureCell = this.typesViews.get(tL_secureRequiredType);
        return (textDetailSecureCell != null || (tL_secureRequiredType2 = this.documentsToTypesLink.get(tL_secureRequiredType)) == null) ? textDetailSecureCell : this.typesViews.get(tL_secureRequiredType2);
    }

    private String getTextForType(TLRPC.SecureValueType secureValueType) {
        if (secureValueType instanceof TLRPC.TL_secureValueTypePassport) {
            return LocaleController.getString("ActionBotDocumentPassport", R.string.ActionBotDocumentPassport);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeDriverLicense) {
            return LocaleController.getString("ActionBotDocumentDriverLicence", R.string.ActionBotDocumentDriverLicence);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeIdentityCard) {
            return LocaleController.getString("ActionBotDocumentIdentityCard", R.string.ActionBotDocumentIdentityCard);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeUtilityBill) {
            return LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeBankStatement) {
            return LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
            return LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeInternalPassport) {
            return LocaleController.getString("ActionBotDocumentInternalPassport", R.string.ActionBotDocumentInternalPassport);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypePassportRegistration) {
            return LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
            return LocaleController.getString("ActionBotDocumentTemporaryRegistration", R.string.ActionBotDocumentTemporaryRegistration);
        }
        if (secureValueType instanceof TLRPC.TL_secureValueTypePhone) {
            return LocaleController.getString("ActionBotDocumentPhone", R.string.ActionBotDocumentPhone);
        }
        return secureValueType instanceof TLRPC.TL_secureValueTypeEmail ? LocaleController.getString("ActionBotDocumentEmail", R.string.ActionBotDocumentEmail) : "";
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Removed duplicated region for block: B:113:0x01fe A[Catch:{ all -> 0x021e }] */
    /* JADX WARNING: Removed duplicated region for block: B:123:0x0226  */
    /* JADX WARNING: Removed duplicated region for block: B:168:0x02df  */
    /* JADX WARNING: Removed duplicated region for block: B:181:0x031e  */
    /* JADX WARNING: Removed duplicated region for block: B:193:0x0360  */
    /* JADX WARNING: Removed duplicated region for block: B:194:0x036f  */
    /* JADX WARNING: Removed duplicated region for block: B:196:0x0372  */
    /* JADX WARNING: Removed duplicated region for block: B:197:0x0381  */
    /* JADX WARNING: Removed duplicated region for block: B:199:0x0384  */
    /* JADX WARNING: Removed duplicated region for block: B:213:0x03c3  */
    /* JADX WARNING: Removed duplicated region for block: B:237:0x0437  */
    /* JADX WARNING: Removed duplicated region for block: B:278:0x04f4  */
    /* JADX WARNING: Removed duplicated region for block: B:279:0x04f7  */
    /* JADX WARNING: Removed duplicated region for block: B:282:0x0502  */
    /* JADX WARNING: Removed duplicated region for block: B:308:0x032b A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x00e7  */
    /* JADX WARNING: Removed duplicated region for block: B:50:0x0111  */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x01bc  */
    private void setTypeValue(TLRPC.TL_secureRequiredType tL_secureRequiredType, String str, String str2, TLRPC.TL_secureRequiredType tL_secureRequiredType2, String str3, boolean z, int i) {
        String str4;
        boolean z2;
        TextDetailSecureCell textDetailSecureCell;
        TLRPC.TL_secureValue tL_secureValue;
        String str5;
        HashMap<String, String> hashMap;
        boolean z3;
        TextDetailSecureCell textDetailSecureCell2;
        StringBuilder sb;
        String[] strArr;
        String[] strArr2;
        int i2;
        int i3;
        String str6;
        HashMap<String, String> hashMap2;
        String[] strArr3;
        HashMap<String, String> hashMap3;
        JSONObject jSONObject;
        int i4;
        String str7;
        HashMap<String, String> hashMap4;
        JSONObject jSONObject2;
        HashMap<String, String> hashMap5;
        char c;
        String str8;
        Iterator<String> keys;
        Exception e;
        String str9 = str2;
        TextDetailSecureCell textDetailSecureCell3 = this.typesViews.get(tL_secureRequiredType);
        if (textDetailSecureCell3 != null) {
            str4 = "last_name_native";
            z2 = true;
        } else if (this.currentActivityType == 8) {
            ArrayList<TLRPC.TL_secureRequiredType> arrayList = new ArrayList<>();
            if (tL_secureRequiredType2 != null) {
                arrayList.add(tL_secureRequiredType2);
            }
            LinearLayout linearLayout = this.linearLayout2;
            View childAt = linearLayout.getChildAt(linearLayout.getChildCount() - 6);
            if (childAt instanceof TextDetailSecureCell) {
                ((TextDetailSecureCell) childAt).setNeedDivider(true);
            }
            str4 = "last_name_native";
            z2 = true;
            textDetailSecureCell3 = addField(getParentActivity(), tL_secureRequiredType, arrayList, true, true);
            updateManageVisibility();
        } else {
            return;
        }
        TextDetailSecureCell textDetailSecureCell4 = textDetailSecureCell3;
        HashMap<String, String> hashMap6 = this.typesValues.get(tL_secureRequiredType);
        HashMap<String, String> hashMap7 = tL_secureRequiredType2 != null ? this.typesValues.get(tL_secureRequiredType2) : null;
        TLRPC.TL_secureValue valueByType = getValueByType(tL_secureRequiredType, z2);
        TLRPC.TL_secureValue valueByType2 = getValueByType(tL_secureRequiredType2, z2);
        if (str9 == null || this.languageMap != null) {
            textDetailSecureCell = textDetailSecureCell4;
            tL_secureValue = valueByType;
            this.languageMap = null;
        } else {
            this.languageMap = new HashMap<>();
            try {
                tL_secureValue = valueByType;
                try {
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(ApplicationLoader.applicationContext.getResources().getAssets().open("countries.txt")));
                    while (true) {
                        String readLine = bufferedReader.readLine();
                        if (readLine == null) {
                            break;
                        }
                        String[] split = readLine.split(";");
                        textDetailSecureCell = textDetailSecureCell4;
                        try {
                            this.languageMap.put(split[1], split[2]);
                            textDetailSecureCell4 = textDetailSecureCell;
                        } catch (Exception e2) {
                            e = e2;
                            FileLog.e(e);
                            if (str == null) {
                            }
                            str5 = null;
                            if (z) {
                            }
                            if (tL_secureRequiredType2 == null) {
                            }
                            if (hashMap != null) {
                            }
                            if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
                            }
                            textDetailSecureCell2 = textDetailSecureCell;
                            z3 = false;
                            textDetailSecureCell2.setValue(str5);
                            textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
                            textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
                        }
                    }
                    textDetailSecureCell = textDetailSecureCell4;
                    bufferedReader.close();
                } catch (Exception e3) {
                    e = e3;
                    textDetailSecureCell = textDetailSecureCell4;
                    FileLog.e(e);
                    if (str == null) {
                    }
                    str5 = null;
                    if (z) {
                    }
                    if (tL_secureRequiredType2 == null) {
                    }
                    if (hashMap != null) {
                    }
                    if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
                    }
                    textDetailSecureCell2 = textDetailSecureCell;
                    z3 = false;
                    textDetailSecureCell2.setValue(str5);
                    textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
                    textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
                }
            } catch (Exception e4) {
                e = e4;
                textDetailSecureCell = textDetailSecureCell4;
                tL_secureValue = valueByType;
                FileLog.e(e);
                if (str == null) {
                }
                str5 = null;
                if (z) {
                }
                if (tL_secureRequiredType2 == null) {
                }
                if (hashMap != null) {
                }
                if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
                }
                textDetailSecureCell2 = textDetailSecureCell;
                z3 = false;
                textDetailSecureCell2.setValue(str5);
                textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
                textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
            }
        }
        if (str == null) {
            if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
                PhoneFormat instance = PhoneFormat.getInstance();
                str5 = instance.format(Marker.ANY_NON_NULL_MARKER + str);
            } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail) {
                str5 = str;
            }
            hashMap = z ? this.errorsMap.get(getNameForType(tL_secureRequiredType.type)) : null;
            HashMap<String, String> hashMap8 = tL_secureRequiredType2 == null ? this.errorsMap.get(getNameForType(tL_secureRequiredType2.type)) : null;
            if ((hashMap != null || hashMap.size() <= 0) && (hashMap8 == null || hashMap8.size() <= 0)) {
                if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
                    if (TextUtils.isEmpty(str5)) {
                        if (tL_secureRequiredType2 == null) {
                            str5 = LocaleController.getString("PassportPersonalDetailsInfo", R.string.PassportPersonalDetailsInfo);
                        } else if (this.currentActivityType == 8) {
                            str5 = LocaleController.getString("PassportDocuments", R.string.PassportDocuments);
                        } else if (i != 1) {
                            str5 = LocaleController.getString("PassportIdentityDocumentInfo", R.string.PassportIdentityDocumentInfo);
                        } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassport) {
                            str5 = LocaleController.getString("PassportIdentityPassport", R.string.PassportIdentityPassport);
                        } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                            str5 = LocaleController.getString("PassportIdentityInternalPassport", R.string.PassportIdentityInternalPassport);
                        } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                            str5 = LocaleController.getString("PassportIdentityDriverLicence", R.string.PassportIdentityDriverLicence);
                        } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                            str5 = LocaleController.getString("PassportIdentityID", R.string.PassportIdentityID);
                        }
                    }
                    textDetailSecureCell2 = textDetailSecureCell;
                    z3 = false;
                } else {
                    if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                        if (TextUtils.isEmpty(str5)) {
                            if (tL_secureRequiredType2 == null) {
                                str5 = LocaleController.getString("PassportAddressNoUploadInfo", R.string.PassportAddressNoUploadInfo);
                            } else if (this.currentActivityType == 8) {
                                str5 = LocaleController.getString("PassportDocuments", R.string.PassportDocuments);
                            } else if (i != 1) {
                                str5 = LocaleController.getString("PassportAddressInfo", R.string.PassportAddressInfo);
                            } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                                str5 = LocaleController.getString("PassportAddAgreementInfo", R.string.PassportAddAgreementInfo);
                            } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                                str5 = LocaleController.getString("PassportAddBillInfo", R.string.PassportAddBillInfo);
                            } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                                str5 = LocaleController.getString("PassportAddPassportRegistrationInfo", R.string.PassportAddPassportRegistrationInfo);
                            } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                                str5 = LocaleController.getString("PassportAddTemporaryRegistrationInfo", R.string.PassportAddTemporaryRegistrationInfo);
                            } else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                                str5 = LocaleController.getString("PassportAddBankInfo", R.string.PassportAddBankInfo);
                            }
                        }
                    } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
                        if (TextUtils.isEmpty(str5)) {
                            str5 = LocaleController.getString("PassportPhoneInfo", R.string.PassportPhoneInfo);
                        }
                    } else if ((tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail) && TextUtils.isEmpty(str5)) {
                        str5 = LocaleController.getString("PassportEmailInfo", R.string.PassportEmailInfo);
                    }
                    textDetailSecureCell2 = textDetailSecureCell;
                    z3 = false;
                }
                textDetailSecureCell2 = textDetailSecureCell;
                z3 = false;
            } else {
                String str10 = !z ? this.mainErrorsMap.get(getNameForType(tL_secureRequiredType.type)) : null;
                str5 = str10 == null ? this.mainErrorsMap.get(getNameForType(tL_secureRequiredType2.type)) : str10;
                textDetailSecureCell2 = textDetailSecureCell;
                z3 = true;
            }
            textDetailSecureCell2.setValue(str5);
            textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
            textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
        }
        if (this.currentActivityType == 8 || tL_secureRequiredType2 == null || (TextUtils.isEmpty(str3) && valueByType2 == null)) {
            sb = null;
        } else {
            sb = new StringBuilder();
            if (i > 1) {
                sb.append(getTextForType(tL_secureRequiredType2.type));
            } else if (TextUtils.isEmpty(str3)) {
                sb.append(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
            }
        }
        if (!(str9 == null && str3 == null)) {
            if (hashMap6 != null) {
                hashMap6.clear();
                if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                    if ((this.currentActivityType != 0 || z) && !(this.currentActivityType == 8 && tL_secureRequiredType2 == null)) {
                        strArr2 = null;
                    } else {
                        strArr2 = new String[]{"first_name", "middle_name", "last_name", "first_name_native", "middle_name_native", "last_name_native", "birth_date", "gender", "country_code", "residence_country_code"};
                    }
                    int i5 = this.currentActivityType;
                    if (i5 == 0 || (i5 == 8 && tL_secureRequiredType2 != null)) {
                        strArr = new String[]{"document_no", "expiry_date"};
                        if (!(strArr2 == null && strArr == null)) {
                            StringBuilder sb2 = sb;
                            JSONObject jSONObject3 = null;
                            i2 = 2;
                            i3 = 0;
                            String[] strArr4 = null;
                            while (i3 < i2) {
                                if (i3 == 0) {
                                    if (str9 != null) {
                                        try {
                                            jSONObject = new JSONObject(str9);
                                            strArr3 = strArr;
                                            strArr = strArr2;
                                            if (!(strArr == null || jSONObject == null)) {
                                                for (keys = jSONObject.keys(); keys.hasNext(); keys = keys) {
                                                    String next = keys.next();
                                                    if (i3 == 0) {
                                                        hashMap6.put(next, jSONObject.getString(next));
                                                    } else {
                                                        hashMap7.put(next, jSONObject.getString(next));
                                                    }
                                                }
                                                i4 = 0;
                                                while (i4 < strArr.length) {
                                                    if (jSONObject.has(strArr[i4])) {
                                                        if (sb2 == null) {
                                                            sb2 = new StringBuilder();
                                                        }
                                                        String string = jSONObject.getString(strArr[i4]);
                                                        if (string != null && !TextUtils.isEmpty(string)) {
                                                            jSONObject2 = jSONObject;
                                                            hashMap4 = hashMap6;
                                                            if (!"first_name_native".equals(strArr[i4]) && !"middle_name_native".equals(strArr[i4])) {
                                                                if (str4.equals(strArr[i4])) {
                                                                    str7 = str4;
                                                                    hashMap5 = hashMap7;
                                                                } else {
                                                                    if (sb2.length() > 0) {
                                                                        hashMap5 = hashMap7;
                                                                        if ("last_name".equals(strArr[i4]) || str4.equals(strArr[i4]) || "middle_name".equals(strArr[i4]) || "middle_name_native".equals(strArr[i4])) {
                                                                            sb2.append(" ");
                                                                        } else {
                                                                            sb2.append(", ");
                                                                        }
                                                                    } else {
                                                                        hashMap5 = hashMap7;
                                                                    }
                                                                    String str11 = strArr[i4];
                                                                    int hashCode = str11.hashCode();
                                                                    str7 = str4;
                                                                    if (hashCode != -2006252145) {
                                                                        if (hashCode != -1249512767) {
                                                                            if (hashCode == 1481071862 && str11.equals("country_code")) {
                                                                                c = 0;
                                                                                if (c != 0 || c == 1) {
                                                                                    str8 = this.languageMap.get(string);
                                                                                    if (str8 == null) {
                                                                                        sb2.append(str8);
                                                                                    }
                                                                                } else if (c != 2) {
                                                                                    sb2.append(string);
                                                                                } else if ("male".equals(string)) {
                                                                                    sb2.append(LocaleController.getString("PassportMale", R.string.PassportMale));
                                                                                } else if ("female".equals(string)) {
                                                                                    sb2.append(LocaleController.getString("PassportFemale", R.string.PassportFemale));
                                                                                }
                                                                            }
                                                                        } else if (str11.equals("gender")) {
                                                                            c = 2;
                                                                            if (c != 0) {
                                                                            }
                                                                            str8 = this.languageMap.get(string);
                                                                            if (str8 == null) {
                                                                            }
                                                                        }
                                                                    } else if (str11.equals("residence_country_code")) {
                                                                        c = 1;
                                                                        if (c != 0) {
                                                                        }
                                                                        str8 = this.languageMap.get(string);
                                                                        if (str8 == null) {
                                                                        }
                                                                    }
                                                                    c = 65535;
                                                                    if (c != 0) {
                                                                    }
                                                                    str8 = this.languageMap.get(string);
                                                                    if (str8 == null) {
                                                                    }
                                                                }
                                                                i4++;
                                                                hashMap7 = hashMap5;
                                                                jSONObject = jSONObject2;
                                                                hashMap6 = hashMap4;
                                                                str4 = str7;
                                                            }
                                                            str7 = str4;
                                                            hashMap5 = hashMap7;
                                                            i4++;
                                                            hashMap7 = hashMap5;
                                                            jSONObject = jSONObject2;
                                                            hashMap6 = hashMap4;
                                                            str4 = str7;
                                                        }
                                                    }
                                                    jSONObject2 = jSONObject;
                                                    hashMap4 = hashMap6;
                                                    str7 = str4;
                                                    hashMap5 = hashMap7;
                                                    i4++;
                                                    hashMap7 = hashMap5;
                                                    jSONObject = jSONObject2;
                                                    hashMap6 = hashMap4;
                                                    str4 = str7;
                                                }
                                            }
                                            hashMap2 = hashMap6;
                                            str6 = str4;
                                            hashMap3 = hashMap7;
                                            jSONObject3 = jSONObject;
                                            i3++;
                                            str9 = str2;
                                            hashMap7 = hashMap3;
                                            hashMap6 = hashMap2;
                                            str4 = str6;
                                            i2 = 2;
                                            strArr4 = strArr;
                                            strArr = strArr3;
                                        } catch (Exception unused) {
                                        }
                                    }
                                } else if (hashMap7 == null) {
                                    hashMap2 = hashMap6;
                                    str6 = str4;
                                    hashMap3 = hashMap7;
                                    strArr3 = strArr;
                                    strArr = strArr4;
                                    i3++;
                                    str9 = str2;
                                    hashMap7 = hashMap3;
                                    hashMap6 = hashMap2;
                                    str4 = str6;
                                    i2 = 2;
                                    strArr4 = strArr;
                                    strArr = strArr3;
                                } else if (str3 != null) {
                                    jSONObject = new JSONObject(str3);
                                    strArr3 = strArr;
                                    while (keys.hasNext()) {
                                    }
                                    i4 = 0;
                                    while (i4 < strArr.length) {
                                    }
                                    hashMap2 = hashMap6;
                                    str6 = str4;
                                    hashMap3 = hashMap7;
                                    jSONObject3 = jSONObject;
                                    i3++;
                                    str9 = str2;
                                    hashMap7 = hashMap3;
                                    hashMap6 = hashMap2;
                                    str4 = str6;
                                    i2 = 2;
                                    strArr4 = strArr;
                                    strArr = strArr3;
                                }
                                jSONObject = jSONObject3;
                                strArr3 = strArr;
                                strArr = strArr4;
                                try {
                                    while (keys.hasNext()) {
                                    }
                                } catch (Throwable th) {
                                    FileLog.e(th);
                                }
                                i4 = 0;
                                while (i4 < strArr.length) {
                                }
                                hashMap2 = hashMap6;
                                str6 = str4;
                                hashMap3 = hashMap7;
                                jSONObject3 = jSONObject;
                                i3++;
                                str9 = str2;
                                hashMap7 = hashMap3;
                                hashMap6 = hashMap2;
                                str4 = str6;
                                i2 = 2;
                                strArr4 = strArr;
                                strArr = strArr3;
                            }
                            sb = sb2;
                        }
                    }
                } else if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) || ((this.currentActivityType != 0 || z) && !(this.currentActivityType == 8 && tL_secureRequiredType2 == null))) {
                    strArr2 = null;
                } else {
                    strArr2 = new String[]{"street_line1", "street_line2", "post_code", "city", RemoteConfigConstants.ResponseFieldKey.STATE, "country_code"};
                }
                strArr = null;
                StringBuilder sb22 = sb;
                JSONObject jSONObject32 = null;
                i2 = 2;
                i3 = 0;
                String[] strArr42 = null;
                while (i3 < i2) {
                }
                sb = sb22;
            } else {
                return;
            }
        }
        if (sb != null) {
            str5 = sb.toString();
            if (z) {
            }
            if (tL_secureRequiredType2 == null) {
            }
            if (hashMap != null) {
            }
            if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
            }
            textDetailSecureCell2 = textDetailSecureCell;
            z3 = false;
            textDetailSecureCell2.setValue(str5);
            textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
            textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
        }
        str5 = null;
        if (z) {
        }
        if (tL_secureRequiredType2 == null) {
        }
        if (hashMap != null) {
        }
        if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
        }
        textDetailSecureCell2 = textDetailSecureCell;
        z3 = false;
        textDetailSecureCell2.setValue(str5);
        textDetailSecureCell2.valueTextView.setTextColor(Theme.getColor(!z3 ? Theme.key_windowBackgroundWhiteRedText3 : Theme.key_windowBackgroundWhiteGrayText2));
        textDetailSecureCell2.setChecked(z3 && this.currentActivityType != 8 && ((z && tL_secureRequiredType2 != null) || (!z && tL_secureValue != null)) && (tL_secureRequiredType2 == null || valueByType2 != null));
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void checkNativeFields(boolean z) {
        EditTextBoldCursor[] editTextBoldCursorArr;
        if (this.inputExtraFields != null) {
            String str = this.languageMap.get(this.currentResidence);
            String str2 = SharedConfig.getCountryLangs().get(this.currentResidence);
            int i = 0;
            if (this.currentType.native_names && !TextUtils.isEmpty(this.currentResidence) && !"EN".equals(str2)) {
                if (this.nativeInfoCell.getVisibility() != 0) {
                    this.nativeInfoCell.setVisibility(0);
                    this.headerCell.setVisibility(0);
                    this.extraBackgroundView2.setVisibility(0);
                    int i2 = 0;
                    while (true) {
                        editTextBoldCursorArr = this.inputExtraFields;
                        if (i2 >= editTextBoldCursorArr.length) {
                            break;
                        }
                        ((View) editTextBoldCursorArr[i2].getParent()).setVisibility(0);
                        i2++;
                    }
                    if (editTextBoldCursorArr[0].length() == 0 && this.inputExtraFields[1].length() == 0 && this.inputExtraFields[2].length() == 0) {
                        int i3 = 0;
                        while (true) {
                            boolean[] zArr = this.nonLatinNames;
                            if (i3 >= zArr.length) {
                                break;
                            } else if (zArr[i3]) {
                                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;
                            } else {
                                i3++;
                            }
                        }
                    }
                    this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
                }
                this.nativeInfoCell.setText(LocaleController.formatString("PassportNativeInfo", R.string.PassportNativeInfo, str));
                String serverString = str2 != null ? LocaleController.getServerString("PassportLanguage_" + str2) : null;
                if (serverString != null) {
                    this.headerCell.setText(LocaleController.formatString("PassportNativeHeaderLang", R.string.PassportNativeHeaderLang, serverString));
                } else {
                    this.headerCell.setText(LocaleController.getString("PassportNativeHeader", R.string.PassportNativeHeader));
                }
                for (int i4 = 0; i4 < 3; i4++) {
                    if (i4 != 0) {
                        if (i4 != 1) {
                            if (i4 == 2) {
                                if (serverString != null) {
                                    this.inputExtraFields[i4].setHintText(LocaleController.getString("PassportSurname", R.string.PassportSurname));
                                } else {
                                    this.inputExtraFields[i4].setHintText(LocaleController.formatString("PassportSurnameCountry", R.string.PassportSurnameCountry, str));
                                }
                            }
                        } else if (serverString != null) {
                            this.inputExtraFields[i4].setHintText(LocaleController.getString("PassportMidname", R.string.PassportMidname));
                        } else {
                            this.inputExtraFields[i4].setHintText(LocaleController.formatString("PassportMidnameCountry", R.string.PassportMidnameCountry, str));
                        }
                    } else if (serverString != null) {
                        this.inputExtraFields[i4].setHintText(LocaleController.getString("PassportName", R.string.PassportName));
                    } else {
                        this.inputExtraFields[i4].setHintText(LocaleController.formatString("PassportNameCountry", R.string.PassportNameCountry, str));
                    }
                }
                if (z) {
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$GV0TQonqIglSj0z5TB0_Y6eBTk */

                        public final void run() {
                            PassportActivity.this.lambda$checkNativeFields$59$PassportActivity();
                        }
                    });
                }
            } else if (this.nativeInfoCell.getVisibility() != 8) {
                this.nativeInfoCell.setVisibility(8);
                this.headerCell.setVisibility(8);
                this.extraBackgroundView2.setVisibility(8);
                while (true) {
                    EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                    if (i >= editTextBoldCursorArr2.length) {
                        break;
                    }
                    ((View) editTextBoldCursorArr2[i].getParent()).setVisibility(8);
                    i++;
                }
                if (((this.currentBotId != 0 || this.currentDocumentsType == null) && this.currentTypeValue != null && !this.documentOnly) || this.currentDocumentsTypeValue != null) {
                    this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), (int) R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
                } else {
                    this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
                }
            }
        }
    }

    public /* synthetic */ void lambda$checkNativeFields$59$PassportActivity() {
        EditTextBoldCursor[] editTextBoldCursorArr = this.inputExtraFields;
        if (editTextBoldCursorArr != null) {
            scrollToField(editTextBoldCursorArr[0]);
        }
    }

    private String getErrorsString(HashMap<String, String> hashMap, HashMap<String, String> hashMap2) {
        StringBuilder sb = new StringBuilder();
        int i = 0;
        while (i < 2) {
            HashMap<String, String> hashMap3 = i == 0 ? hashMap : hashMap2;
            if (hashMap3 != null) {
                for (Map.Entry<String, String> entry : hashMap3.entrySet()) {
                    String value = entry.getValue();
                    if (sb.length() > 0) {
                        sb.append(", ");
                        value = value.toLowerCase();
                    }
                    if (value.endsWith(".")) {
                        value = value.substring(0, value.length() - 1);
                    }
                    sb.append(value);
                }
            }
            i++;
        }
        if (sb.length() > 0) {
            sb.append('.');
        }
        return sb.toString();
    }

    private TLRPC.TL_secureValue getValueByType(TLRPC.TL_secureRequiredType tL_secureRequiredType, boolean z) {
        String[] strArr;
        if (tL_secureRequiredType == null) {
            return null;
        }
        int size = this.currentForm.values.size();
        for (int i = 0; i < size; i++) {
            TLRPC.TL_secureValue tL_secureValue = this.currentForm.values.get(i);
            if (tL_secureRequiredType.type.getClass() == tL_secureValue.type.getClass()) {
                if (z) {
                    if (tL_secureRequiredType.selfie_required && !(tL_secureValue.selfie instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if (tL_secureRequiredType.translation_required && tL_secureValue.translation.isEmpty()) {
                        return null;
                    }
                    if (isAddressDocument(tL_secureRequiredType.type) && tL_secureValue.files.isEmpty()) {
                        return null;
                    }
                    if (isPersonalDocument(tL_secureRequiredType.type) && !(tL_secureValue.front_side instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if (((tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeDriverLicense) || (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) && !(tL_secureValue.reverse_side instanceof TLRPC.TL_secureFile)) {
                        return null;
                    }
                    if ((tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) || (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
                        if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails)) {
                            strArr = new String[]{"street_line1", "street_line2", "post_code", "city", RemoteConfigConstants.ResponseFieldKey.STATE, "country_code"};
                        } else if (tL_secureRequiredType.native_names) {
                            strArr = new String[]{"first_name_native", "last_name_native", "birth_date", "gender", "country_code", "residence_country_code"};
                        } else {
                            strArr = new String[]{"first_name", "last_name", "birth_date", "gender", "country_code", "residence_country_code"};
                        }
                        try {
                            JSONObject jSONObject = new JSONObject(decryptData(tL_secureValue.data.data, decryptValueSecret(tL_secureValue.data.secret, tL_secureValue.data.data_hash), tL_secureValue.data.data_hash));
                            for (int i2 = 0; i2 < strArr.length; i2++) {
                                if (jSONObject.has(strArr[i2]) && !TextUtils.isEmpty(jSONObject.getString(strArr[i2]))) {
                                }
                                return null;
                            }
                        } catch (Throwable unused) {
                        }
                    }
                }
                return tL_secureValue;
            }
        }
        return null;
    }

    private void openTypeActivity(TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, ArrayList<TLRPC.TL_secureRequiredType> arrayList, final boolean z) {
        int i;
        TLRPC.TL_account_password tL_account_password;
        HashMap<String, String> hashMap;
        final int size = arrayList != null ? arrayList.size() : 0;
        final TLRPC.SecureValueType secureValueType = tL_secureRequiredType.type;
        TLRPC.SecureValueType secureValueType2 = tL_secureRequiredType2 != null ? tL_secureRequiredType2.type : null;
        if (secureValueType instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            i = 1;
        } else if (secureValueType instanceof TLRPC.TL_secureValueTypeAddress) {
            i = 2;
        } else if (secureValueType instanceof TLRPC.TL_secureValueTypePhone) {
            i = 3;
        } else {
            i = secureValueType instanceof TLRPC.TL_secureValueTypeEmail ? 4 : -1;
        }
        if (i != -1) {
            HashMap<String, String> hashMap2 = !z ? this.errorsMap.get(getNameForType(secureValueType)) : null;
            HashMap<String, String> hashMap3 = this.errorsMap.get(getNameForType(secureValueType2));
            TLRPC.TL_secureValue valueByType = getValueByType(tL_secureRequiredType, false);
            TLRPC.TL_secureValue valueByType2 = getValueByType(tL_secureRequiredType2, false);
            TLRPC.TL_account_authorizationForm tL_account_authorizationForm = this.currentForm;
            TLRPC.TL_account_password tL_account_password2 = this.currentPassword;
            HashMap<String, String> hashMap4 = this.typesValues.get(tL_secureRequiredType);
            if (tL_secureRequiredType2 != null) {
                tL_account_password = tL_account_password2;
                hashMap = this.typesValues.get(tL_secureRequiredType2);
            } else {
                tL_account_password = tL_account_password2;
                hashMap = null;
            }
            PassportActivity passportActivity = new PassportActivity(i, tL_account_authorizationForm, tL_account_password, tL_secureRequiredType, valueByType, tL_secureRequiredType2, valueByType2, hashMap4, hashMap);
            passportActivity.delegate = new PassportActivityDelegate() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass19 */

                private TLRPC.InputSecureFile getInputSecureFile(SecureDocument secureDocument) {
                    if (secureDocument.inputFile != null) {
                        TLRPC.TL_inputSecureFileUploaded tL_inputSecureFileUploaded = new TLRPC.TL_inputSecureFileUploaded();
                        tL_inputSecureFileUploaded.id = secureDocument.inputFile.id;
                        tL_inputSecureFileUploaded.parts = secureDocument.inputFile.parts;
                        tL_inputSecureFileUploaded.md5_checksum = secureDocument.inputFile.md5_checksum;
                        tL_inputSecureFileUploaded.file_hash = secureDocument.fileHash;
                        tL_inputSecureFileUploaded.secret = secureDocument.fileSecret;
                        return tL_inputSecureFileUploaded;
                    }
                    TLRPC.TL_inputSecureFile tL_inputSecureFile = new TLRPC.TL_inputSecureFile();
                    tL_inputSecureFile.id = secureDocument.secureFile.id;
                    tL_inputSecureFile.access_hash = secureDocument.secureFile.access_hash;
                    return tL_inputSecureFile;
                }

                /* access modifiers changed from: private */
                /* access modifiers changed from: public */
                private void renameFile(SecureDocument secureDocument, TLRPC.TL_secureFile tL_secureFile) {
                    File pathToAttach = FileLoader.getPathToAttach(secureDocument);
                    File pathToAttach2 = FileLoader.getPathToAttach(tL_secureFile);
                    pathToAttach.renameTo(pathToAttach2);
                    ImageLoader.getInstance().replaceImageInCache(secureDocument.secureFile.dc_id + "_" + secureDocument.secureFile.id, tL_secureFile.dc_id + "_" + tL_secureFile.id, null, false);
                }

                /* JADX DEBUG: Multi-variable search result rejected for r0v18, resolved type: im.guobwnxjuc.tgnet.TLRPC$TL_securePlainEmail */
                /* JADX WARN: Multi-variable type inference failed */
                @Override // im.guobwnxjuc.ui.PassportActivity.PassportActivityDelegate
                public void saveValue(final TLRPC.TL_secureRequiredType tL_secureRequiredType, final String str, final String str2, final TLRPC.TL_secureRequiredType tL_secureRequiredType2, final String str3, final ArrayList<SecureDocument> arrayList, final SecureDocument secureDocument, final ArrayList<SecureDocument> arrayList2, final SecureDocument secureDocument2, final SecureDocument secureDocument3, final Runnable runnable, final ErrorRunnable errorRunnable) {
                    TLRPC.TL_inputSecureValue tL_inputSecureValue;
                    final TLRPC.TL_inputSecureValue tL_inputSecureValue2;
                    TLRPC.TL_securePlainPhone tL_securePlainPhone;
                    if (!TextUtils.isEmpty(str2)) {
                        tL_inputSecureValue = new TLRPC.TL_inputSecureValue();
                        tL_inputSecureValue.type = tL_secureRequiredType.type;
                        tL_inputSecureValue.flags |= 1;
                        EncryptionResult encryptData = PassportActivity.this.encryptData(AndroidUtilities.getStringBytes(str2));
                        tL_inputSecureValue.data = new TLRPC.TL_secureData();
                        tL_inputSecureValue.data.data = encryptData.encryptedData;
                        tL_inputSecureValue.data.data_hash = encryptData.fileHash;
                        tL_inputSecureValue.data.secret = encryptData.fileSecret;
                    } else if (!TextUtils.isEmpty(str)) {
                        TLRPC.SecureValueType secureValueType = secureValueType;
                        if (secureValueType instanceof TLRPC.TL_secureValueTypeEmail) {
                            TLRPC.TL_securePlainEmail tL_securePlainEmail = new TLRPC.TL_securePlainEmail();
                            tL_securePlainEmail.email = str;
                            tL_securePlainPhone = tL_securePlainEmail;
                        } else if (secureValueType instanceof TLRPC.TL_secureValueTypePhone) {
                            TLRPC.TL_securePlainPhone tL_securePlainPhone2 = new TLRPC.TL_securePlainPhone();
                            tL_securePlainPhone2.phone = str;
                            tL_securePlainPhone = tL_securePlainPhone2;
                        } else {
                            return;
                        }
                        TLRPC.TL_inputSecureValue tL_inputSecureValue3 = new TLRPC.TL_inputSecureValue();
                        tL_inputSecureValue3.type = tL_secureRequiredType.type;
                        tL_inputSecureValue3.flags |= 32;
                        tL_inputSecureValue3.plain_data = tL_securePlainPhone;
                        tL_inputSecureValue = tL_inputSecureValue3;
                    } else {
                        tL_inputSecureValue = null;
                    }
                    if (z || tL_inputSecureValue != null) {
                        if (tL_secureRequiredType2 != null) {
                            TLRPC.TL_inputSecureValue tL_inputSecureValue4 = new TLRPC.TL_inputSecureValue();
                            tL_inputSecureValue4.type = tL_secureRequiredType2.type;
                            if (!TextUtils.isEmpty(str3)) {
                                tL_inputSecureValue4.flags |= 1;
                                EncryptionResult encryptData2 = PassportActivity.this.encryptData(AndroidUtilities.getStringBytes(str3));
                                tL_inputSecureValue4.data = new TLRPC.TL_secureData();
                                tL_inputSecureValue4.data.data = encryptData2.encryptedData;
                                tL_inputSecureValue4.data.data_hash = encryptData2.fileHash;
                                tL_inputSecureValue4.data.secret = encryptData2.fileSecret;
                            }
                            if (secureDocument2 != null) {
                                tL_inputSecureValue4.front_side = getInputSecureFile(secureDocument2);
                                tL_inputSecureValue4.flags |= 2;
                            }
                            if (secureDocument3 != null) {
                                tL_inputSecureValue4.reverse_side = getInputSecureFile(secureDocument3);
                                tL_inputSecureValue4.flags |= 4;
                            }
                            if (secureDocument != null) {
                                tL_inputSecureValue4.selfie = getInputSecureFile(secureDocument);
                                tL_inputSecureValue4.flags |= 8;
                            }
                            if (arrayList2 != null && !arrayList2.isEmpty()) {
                                tL_inputSecureValue4.flags |= 64;
                                int size = arrayList2.size();
                                for (int i = 0; i < size; i++) {
                                    tL_inputSecureValue4.translation.add(getInputSecureFile(arrayList2.get(i)));
                                }
                            }
                            if (arrayList != null && !arrayList.isEmpty()) {
                                tL_inputSecureValue4.flags |= 16;
                                int size2 = arrayList.size();
                                for (int i2 = 0; i2 < size2; i2++) {
                                    tL_inputSecureValue4.files.add(getInputSecureFile(arrayList.get(i2)));
                                }
                            }
                            if (z) {
                                tL_inputSecureValue = tL_inputSecureValue4;
                            } else {
                                tL_inputSecureValue2 = tL_inputSecureValue4;
                                final TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = new TLRPC.TL_account_saveSecureValue();
                                tL_account_saveSecureValue.value = tL_inputSecureValue;
                                tL_account_saveSecureValue.secure_secret_id = PassportActivity.this.secureSecretId;
                                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_saveSecureValue, new RequestDelegate() {
                                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass19.AnonymousClass1 */

                                    /* access modifiers changed from: private */
                                    /* renamed from: onResult */
                                    public void lambda$run$4$PassportActivity$19$1(TLRPC.TL_error tL_error, TLRPC.TL_secureValue tL_secureValue, TLRPC.TL_secureValue tL_secureValue2) {
                                        AndroidUtilities.runOnUIThread(new Runnable(tL_error, errorRunnable, str, tL_account_saveSecureValue, z, tL_secureRequiredType2, tL_secureRequiredType, tL_secureValue, tL_secureValue2, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, size, runnable) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$FgfRcONUv1YytmKHQqkYLqC2jHQ */
                                            private final /* synthetic */ TLRPC.TL_error f$1;
                                            private final /* synthetic */ ArrayList f$10;
                                            private final /* synthetic */ SecureDocument f$11;
                                            private final /* synthetic */ SecureDocument f$12;
                                            private final /* synthetic */ SecureDocument f$13;
                                            private final /* synthetic */ ArrayList f$14;
                                            private final /* synthetic */ String f$15;
                                            private final /* synthetic */ String f$16;
                                            private final /* synthetic */ int f$17;
                                            private final /* synthetic */ Runnable f$18;
                                            private final /* synthetic */ PassportActivity.ErrorRunnable f$2;
                                            private final /* synthetic */ String f$3;
                                            private final /* synthetic */ TLRPC.TL_account_saveSecureValue f$4;
                                            private final /* synthetic */ boolean f$5;
                                            private final /* synthetic */ TLRPC.TL_secureRequiredType f$6;
                                            private final /* synthetic */ TLRPC.TL_secureRequiredType f$7;
                                            private final /* synthetic */ TLRPC.TL_secureValue f$8;
                                            private final /* synthetic */ TLRPC.TL_secureValue f$9;

                                            {
                                                this.f$1 = r4;
                                                this.f$2 = r5;
                                                this.f$3 = r6;
                                                this.f$4 = r7;
                                                this.f$5 = r8;
                                                this.f$6 = r9;
                                                this.f$7 = r10;
                                                this.f$8 = r11;
                                                this.f$9 = r12;
                                                this.f$10 = r13;
                                                this.f$11 = r14;
                                                this.f$12 = r15;
                                                this.f$13 = r16;
                                                this.f$14 = r17;
                                                this.f$15 = r18;
                                                this.f$16 = r19;
                                                this.f$17 = r20;
                                                this.f$18 = r21;
                                            }

                                            public final void run() {
                                                PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$onResult$0$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6, this.f$7, this.f$8, this.f$9, this.f$10, this.f$11, this.f$12, this.f$13, this.f$14, this.f$15, this.f$16, this.f$17, this.f$18);
                                            }
                                        });
                                    }

                                    public /* synthetic */ void lambda$onResult$0$PassportActivity$19$1(TLRPC.TL_error tL_error, ErrorRunnable errorRunnable, String str, TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue, boolean z, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, TLRPC.TL_secureValue tL_secureValue, TLRPC.TL_secureValue tL_secureValue2, ArrayList arrayList, SecureDocument secureDocument, SecureDocument secureDocument2, SecureDocument secureDocument3, ArrayList arrayList2, String str2, String str3, int i, Runnable runnable) {
                                        int i2;
                                        if (tL_error != null) {
                                            if (errorRunnable != null) {
                                                errorRunnable.onError(tL_error.text, str);
                                            }
                                            AlertsCreator.processError(PassportActivity.this.currentAccount, tL_error, PassportActivity.this, tL_account_saveSecureValue, str);
                                            return;
                                        }
                                        if (!z) {
                                            PassportActivity.this.removeValue(tL_secureRequiredType2);
                                            PassportActivity.this.removeValue(tL_secureRequiredType);
                                        } else if (tL_secureRequiredType != null) {
                                            PassportActivity.this.removeValue(tL_secureRequiredType);
                                        } else {
                                            PassportActivity.this.removeValue(tL_secureRequiredType2);
                                        }
                                        if (tL_secureValue != null) {
                                            PassportActivity.this.currentForm.values.add(tL_secureValue);
                                        }
                                        if (tL_secureValue2 != null) {
                                            PassportActivity.this.currentForm.values.add(tL_secureValue2);
                                        }
                                        if (arrayList != null && !arrayList.isEmpty()) {
                                            int size = arrayList.size();
                                            int i3 = 0;
                                            while (i3 < size) {
                                                SecureDocument secureDocument4 = (SecureDocument) arrayList.get(i3);
                                                if (secureDocument4.inputFile != null) {
                                                    int size2 = tL_secureValue.files.size();
                                                    int i4 = 0;
                                                    while (true) {
                                                        if (i4 >= size2) {
                                                            break;
                                                        }
                                                        TLRPC.SecureFile secureFile = tL_secureValue.files.get(i4);
                                                        i2 = size;
                                                        if (secureFile instanceof TLRPC.TL_secureFile) {
                                                            TLRPC.TL_secureFile tL_secureFile = (TLRPC.TL_secureFile) secureFile;
                                                            if (Utilities.arraysEquals(secureDocument4.fileSecret, 0, tL_secureFile.secret, 0)) {
                                                                AnonymousClass19.this.renameFile(secureDocument4, tL_secureFile);
                                                                break;
                                                            }
                                                        }
                                                        i4++;
                                                        size = i2;
                                                    }
                                                }
                                                i2 = size;
                                                i3++;
                                                size = i2;
                                            }
                                        }
                                        if (!(secureDocument == null || secureDocument.inputFile == null || !(tL_secureValue.selfie instanceof TLRPC.TL_secureFile))) {
                                            TLRPC.TL_secureFile tL_secureFile2 = (TLRPC.TL_secureFile) tL_secureValue.selfie;
                                            if (Utilities.arraysEquals(secureDocument.fileSecret, 0, tL_secureFile2.secret, 0)) {
                                                AnonymousClass19.this.renameFile(secureDocument, tL_secureFile2);
                                            }
                                        }
                                        if (!(secureDocument2 == null || secureDocument2.inputFile == null || !(tL_secureValue.front_side instanceof TLRPC.TL_secureFile))) {
                                            TLRPC.TL_secureFile tL_secureFile3 = (TLRPC.TL_secureFile) tL_secureValue.front_side;
                                            if (Utilities.arraysEquals(secureDocument2.fileSecret, 0, tL_secureFile3.secret, 0)) {
                                                AnonymousClass19.this.renameFile(secureDocument2, tL_secureFile3);
                                            }
                                        }
                                        if (!(secureDocument3 == null || secureDocument3.inputFile == null || !(tL_secureValue.reverse_side instanceof TLRPC.TL_secureFile))) {
                                            TLRPC.TL_secureFile tL_secureFile4 = (TLRPC.TL_secureFile) tL_secureValue.reverse_side;
                                            if (Utilities.arraysEquals(secureDocument3.fileSecret, 0, tL_secureFile4.secret, 0)) {
                                                AnonymousClass19.this.renameFile(secureDocument3, tL_secureFile4);
                                            }
                                        }
                                        if (arrayList2 != null && !arrayList2.isEmpty()) {
                                            int size3 = arrayList2.size();
                                            for (int i5 = 0; i5 < size3; i5++) {
                                                SecureDocument secureDocument5 = (SecureDocument) arrayList2.get(i5);
                                                if (secureDocument5.inputFile != null) {
                                                    int size4 = tL_secureValue.translation.size();
                                                    int i6 = 0;
                                                    while (true) {
                                                        if (i6 >= size4) {
                                                            break;
                                                        }
                                                        TLRPC.SecureFile secureFile2 = tL_secureValue.translation.get(i6);
                                                        if (secureFile2 instanceof TLRPC.TL_secureFile) {
                                                            TLRPC.TL_secureFile tL_secureFile5 = (TLRPC.TL_secureFile) secureFile2;
                                                            if (Utilities.arraysEquals(secureDocument5.fileSecret, 0, tL_secureFile5.secret, 0)) {
                                                                AnonymousClass19.this.renameFile(secureDocument5, tL_secureFile5);
                                                                break;
                                                            }
                                                        }
                                                        i6++;
                                                    }
                                                }
                                            }
                                        }
                                        PassportActivity.this.setTypeValue(tL_secureRequiredType2, str, str2, tL_secureRequiredType, str3, z, i);
                                        if (runnable != null) {
                                            runnable.run();
                                        }
                                    }

                                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                    public void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                        if (tL_error != null) {
                                            if (tL_error.text.equals("EMAIL_VERIFICATION_NEEDED")) {
                                                TLRPC.TL_account_sendVerifyEmailCode tL_account_sendVerifyEmailCode = new TLRPC.TL_account_sendVerifyEmailCode();
                                                tL_account_sendVerifyEmailCode.email = str;
                                                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_sendVerifyEmailCode, new RequestDelegate(str, tL_secureRequiredType, this, errorRunnable) {
                                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$dSlY5yKqJQOg9bZ6TLJ2Xol3gh8 */
                                                    private final /* synthetic */ String f$1;
                                                    private final /* synthetic */ TLRPC.TL_secureRequiredType f$2;
                                                    private final /* synthetic */ PassportActivity.PassportActivityDelegate f$3;
                                                    private final /* synthetic */ PassportActivity.ErrorRunnable f$4;

                                                    {
                                                        this.f$1 = r2;
                                                        this.f$2 = r3;
                                                        this.f$3 = r4;
                                                        this.f$4 = r5;
                                                    }

                                                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                                        PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$2$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, tLObject, tL_error);
                                                    }
                                                });
                                                return;
                                            } else if (tL_error.text.equals("PHONE_VERIFICATION_NEEDED")) {
                                                AndroidUtilities.runOnUIThread(new Runnable(tL_error, str) {
                                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$6YBtK6Bww762ERQe8714DIegnjw */
                                                    private final /* synthetic */ TLRPC.TL_error f$1;
                                                    private final /* synthetic */ String f$2;

                                                    {
                                                        this.f$1 = r2;
                                                        this.f$2 = r3;
                                                    }

                                                    public final void run() {
                                                        PassportActivity.ErrorRunnable.this.onError(this.f$1.text, this.f$2);
                                                    }
                                                });
                                                return;
                                            }
                                        }
                                        if (tL_error != null || tL_inputSecureValue2 == null) {
                                            lambda$run$4$PassportActivity$19$1(tL_error, (TLRPC.TL_secureValue) tLObject, null);
                                            return;
                                        }
                                        TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = new TLRPC.TL_account_saveSecureValue();
                                        tL_account_saveSecureValue.value = tL_inputSecureValue2;
                                        tL_account_saveSecureValue.secure_secret_id = PassportActivity.this.secureSecretId;
                                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_saveSecureValue, new RequestDelegate((TLRPC.TL_secureValue) tLObject) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$TQb2x2qALTCtMJ6jiMjXhrESfXQ */
                                            private final /* synthetic */ TLRPC.TL_secureValue f$1;

                                            {
                                                this.f$1 = r2;
                                            }

                                            @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                                PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$4$PassportActivity$19$1(this.f$1, tLObject, tL_error);
                                            }
                                        });
                                    }

                                    public /* synthetic */ void lambda$run$2$PassportActivity$19$1(String str, TLRPC.TL_secureRequiredType tL_secureRequiredType, PassportActivityDelegate passportActivityDelegate, ErrorRunnable errorRunnable, TLObject tLObject, TLRPC.TL_error tL_error) {
                                        AndroidUtilities.runOnUIThread(new Runnable(tLObject, str, tL_secureRequiredType, passportActivityDelegate, tL_error, errorRunnable) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$PSEnFeg3s52CAoLTOZDgrHrcu34 */
                                            private final /* synthetic */ TLObject f$1;
                                            private final /* synthetic */ String f$2;
                                            private final /* synthetic */ TLRPC.TL_secureRequiredType f$3;
                                            private final /* synthetic */ PassportActivity.PassportActivityDelegate f$4;
                                            private final /* synthetic */ TLRPC.TL_error f$5;
                                            private final /* synthetic */ PassportActivity.ErrorRunnable f$6;

                                            {
                                                this.f$1 = r2;
                                                this.f$2 = r3;
                                                this.f$3 = r4;
                                                this.f$4 = r5;
                                                this.f$5 = r6;
                                                this.f$6 = r7;
                                            }

                                            public final void run() {
                                                PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$null$1$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6);
                                            }
                                        });
                                    }

                                    public /* synthetic */ void lambda$null$1$PassportActivity$19$1(TLObject tLObject, String str, TLRPC.TL_secureRequiredType tL_secureRequiredType, PassportActivityDelegate passportActivityDelegate, TLRPC.TL_error tL_error, ErrorRunnable errorRunnable) {
                                        if (tLObject != null) {
                                            TLRPC.TL_account_sentEmailCode tL_account_sentEmailCode = (TLRPC.TL_account_sentEmailCode) tLObject;
                                            HashMap hashMap = new HashMap();
                                            hashMap.put("email", str);
                                            hashMap.put("pattern", tL_account_sentEmailCode.email_pattern);
                                            PassportActivity passportActivity = new PassportActivity(6, PassportActivity.this.currentForm, PassportActivity.this.currentPassword, tL_secureRequiredType, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, hashMap, (HashMap<String, String>) null);
                                            passportActivity.currentAccount = PassportActivity.this.currentAccount;
                                            passportActivity.emailCodeLength = tL_account_sentEmailCode.length;
                                            passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
                                            passportActivity.secureSecret = PassportActivity.this.secureSecret;
                                            passportActivity.delegate = passportActivityDelegate;
                                            PassportActivity.this.presentFragment(passportActivity, true);
                                            return;
                                        }
                                        PassportActivity.this.showAlertWithText(LocaleController.getString("PassportEmail", R.string.PassportEmail), tL_error.text);
                                        if (errorRunnable != null) {
                                            errorRunnable.onError(tL_error.text, str);
                                        }
                                    }
                                });
                            }
                        }
                        tL_inputSecureValue2 = null;
                        final TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue2 = new TLRPC.TL_account_saveSecureValue();
                        tL_account_saveSecureValue2.value = tL_inputSecureValue;
                        tL_account_saveSecureValue2.secure_secret_id = PassportActivity.this.secureSecretId;
                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_saveSecureValue2, new RequestDelegate() {
                            /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass19.AnonymousClass1 */

                            /* access modifiers changed from: private */
                            /* renamed from: onResult */
                            public void lambda$run$4$PassportActivity$19$1(TLRPC.TL_error tL_error, TLRPC.TL_secureValue tL_secureValue, TLRPC.TL_secureValue tL_secureValue2) {
                                AndroidUtilities.runOnUIThread(new Runnable(tL_error, errorRunnable, str, tL_account_saveSecureValue2, z, tL_secureRequiredType2, tL_secureRequiredType, tL_secureValue, tL_secureValue2, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, size, runnable) {
                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$FgfRcONUv1YytmKHQqkYLqC2jHQ */
                                    private final /* synthetic */ TLRPC.TL_error f$1;
                                    private final /* synthetic */ ArrayList f$10;
                                    private final /* synthetic */ SecureDocument f$11;
                                    private final /* synthetic */ SecureDocument f$12;
                                    private final /* synthetic */ SecureDocument f$13;
                                    private final /* synthetic */ ArrayList f$14;
                                    private final /* synthetic */ String f$15;
                                    private final /* synthetic */ String f$16;
                                    private final /* synthetic */ int f$17;
                                    private final /* synthetic */ Runnable f$18;
                                    private final /* synthetic */ PassportActivity.ErrorRunnable f$2;
                                    private final /* synthetic */ String f$3;
                                    private final /* synthetic */ TLRPC.TL_account_saveSecureValue f$4;
                                    private final /* synthetic */ boolean f$5;
                                    private final /* synthetic */ TLRPC.TL_secureRequiredType f$6;
                                    private final /* synthetic */ TLRPC.TL_secureRequiredType f$7;
                                    private final /* synthetic */ TLRPC.TL_secureValue f$8;
                                    private final /* synthetic */ TLRPC.TL_secureValue f$9;

                                    {
                                        this.f$1 = r4;
                                        this.f$2 = r5;
                                        this.f$3 = r6;
                                        this.f$4 = r7;
                                        this.f$5 = r8;
                                        this.f$6 = r9;
                                        this.f$7 = r10;
                                        this.f$8 = r11;
                                        this.f$9 = r12;
                                        this.f$10 = r13;
                                        this.f$11 = r14;
                                        this.f$12 = r15;
                                        this.f$13 = r16;
                                        this.f$14 = r17;
                                        this.f$15 = r18;
                                        this.f$16 = r19;
                                        this.f$17 = r20;
                                        this.f$18 = r21;
                                    }

                                    public final void run() {
                                        PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$onResult$0$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6, this.f$7, this.f$8, this.f$9, this.f$10, this.f$11, this.f$12, this.f$13, this.f$14, this.f$15, this.f$16, this.f$17, this.f$18);
                                    }
                                });
                            }

                            public /* synthetic */ void lambda$onResult$0$PassportActivity$19$1(TLRPC.TL_error tL_error, ErrorRunnable errorRunnable, String str, TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue, boolean z, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, TLRPC.TL_secureValue tL_secureValue, TLRPC.TL_secureValue tL_secureValue2, ArrayList arrayList, SecureDocument secureDocument, SecureDocument secureDocument2, SecureDocument secureDocument3, ArrayList arrayList2, String str2, String str3, int i, Runnable runnable) {
                                int i2;
                                if (tL_error != null) {
                                    if (errorRunnable != null) {
                                        errorRunnable.onError(tL_error.text, str);
                                    }
                                    AlertsCreator.processError(PassportActivity.this.currentAccount, tL_error, PassportActivity.this, tL_account_saveSecureValue, str);
                                    return;
                                }
                                if (!z) {
                                    PassportActivity.this.removeValue(tL_secureRequiredType2);
                                    PassportActivity.this.removeValue(tL_secureRequiredType);
                                } else if (tL_secureRequiredType != null) {
                                    PassportActivity.this.removeValue(tL_secureRequiredType);
                                } else {
                                    PassportActivity.this.removeValue(tL_secureRequiredType2);
                                }
                                if (tL_secureValue != null) {
                                    PassportActivity.this.currentForm.values.add(tL_secureValue);
                                }
                                if (tL_secureValue2 != null) {
                                    PassportActivity.this.currentForm.values.add(tL_secureValue2);
                                }
                                if (arrayList != null && !arrayList.isEmpty()) {
                                    int size = arrayList.size();
                                    int i3 = 0;
                                    while (i3 < size) {
                                        SecureDocument secureDocument4 = (SecureDocument) arrayList.get(i3);
                                        if (secureDocument4.inputFile != null) {
                                            int size2 = tL_secureValue.files.size();
                                            int i4 = 0;
                                            while (true) {
                                                if (i4 >= size2) {
                                                    break;
                                                }
                                                TLRPC.SecureFile secureFile = tL_secureValue.files.get(i4);
                                                i2 = size;
                                                if (secureFile instanceof TLRPC.TL_secureFile) {
                                                    TLRPC.TL_secureFile tL_secureFile = (TLRPC.TL_secureFile) secureFile;
                                                    if (Utilities.arraysEquals(secureDocument4.fileSecret, 0, tL_secureFile.secret, 0)) {
                                                        AnonymousClass19.this.renameFile(secureDocument4, tL_secureFile);
                                                        break;
                                                    }
                                                }
                                                i4++;
                                                size = i2;
                                            }
                                        }
                                        i2 = size;
                                        i3++;
                                        size = i2;
                                    }
                                }
                                if (!(secureDocument == null || secureDocument.inputFile == null || !(tL_secureValue.selfie instanceof TLRPC.TL_secureFile))) {
                                    TLRPC.TL_secureFile tL_secureFile2 = (TLRPC.TL_secureFile) tL_secureValue.selfie;
                                    if (Utilities.arraysEquals(secureDocument.fileSecret, 0, tL_secureFile2.secret, 0)) {
                                        AnonymousClass19.this.renameFile(secureDocument, tL_secureFile2);
                                    }
                                }
                                if (!(secureDocument2 == null || secureDocument2.inputFile == null || !(tL_secureValue.front_side instanceof TLRPC.TL_secureFile))) {
                                    TLRPC.TL_secureFile tL_secureFile3 = (TLRPC.TL_secureFile) tL_secureValue.front_side;
                                    if (Utilities.arraysEquals(secureDocument2.fileSecret, 0, tL_secureFile3.secret, 0)) {
                                        AnonymousClass19.this.renameFile(secureDocument2, tL_secureFile3);
                                    }
                                }
                                if (!(secureDocument3 == null || secureDocument3.inputFile == null || !(tL_secureValue.reverse_side instanceof TLRPC.TL_secureFile))) {
                                    TLRPC.TL_secureFile tL_secureFile4 = (TLRPC.TL_secureFile) tL_secureValue.reverse_side;
                                    if (Utilities.arraysEquals(secureDocument3.fileSecret, 0, tL_secureFile4.secret, 0)) {
                                        AnonymousClass19.this.renameFile(secureDocument3, tL_secureFile4);
                                    }
                                }
                                if (arrayList2 != null && !arrayList2.isEmpty()) {
                                    int size3 = arrayList2.size();
                                    for (int i5 = 0; i5 < size3; i5++) {
                                        SecureDocument secureDocument5 = (SecureDocument) arrayList2.get(i5);
                                        if (secureDocument5.inputFile != null) {
                                            int size4 = tL_secureValue.translation.size();
                                            int i6 = 0;
                                            while (true) {
                                                if (i6 >= size4) {
                                                    break;
                                                }
                                                TLRPC.SecureFile secureFile2 = tL_secureValue.translation.get(i6);
                                                if (secureFile2 instanceof TLRPC.TL_secureFile) {
                                                    TLRPC.TL_secureFile tL_secureFile5 = (TLRPC.TL_secureFile) secureFile2;
                                                    if (Utilities.arraysEquals(secureDocument5.fileSecret, 0, tL_secureFile5.secret, 0)) {
                                                        AnonymousClass19.this.renameFile(secureDocument5, tL_secureFile5);
                                                        break;
                                                    }
                                                }
                                                i6++;
                                            }
                                        }
                                    }
                                }
                                PassportActivity.this.setTypeValue(tL_secureRequiredType2, str, str2, tL_secureRequiredType, str3, z, i);
                                if (runnable != null) {
                                    runnable.run();
                                }
                            }

                            @Override // im.guobwnxjuc.tgnet.RequestDelegate
                            public void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                if (tL_error != null) {
                                    if (tL_error.text.equals("EMAIL_VERIFICATION_NEEDED")) {
                                        TLRPC.TL_account_sendVerifyEmailCode tL_account_sendVerifyEmailCode = new TLRPC.TL_account_sendVerifyEmailCode();
                                        tL_account_sendVerifyEmailCode.email = str;
                                        ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_sendVerifyEmailCode, new RequestDelegate(str, tL_secureRequiredType, this, errorRunnable) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$dSlY5yKqJQOg9bZ6TLJ2Xol3gh8 */
                                            private final /* synthetic */ String f$1;
                                            private final /* synthetic */ TLRPC.TL_secureRequiredType f$2;
                                            private final /* synthetic */ PassportActivity.PassportActivityDelegate f$3;
                                            private final /* synthetic */ PassportActivity.ErrorRunnable f$4;

                                            {
                                                this.f$1 = r2;
                                                this.f$2 = r3;
                                                this.f$3 = r4;
                                                this.f$4 = r5;
                                            }

                                            @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                                PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$2$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, tLObject, tL_error);
                                            }
                                        });
                                        return;
                                    } else if (tL_error.text.equals("PHONE_VERIFICATION_NEEDED")) {
                                        AndroidUtilities.runOnUIThread(new Runnable(tL_error, str) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$6YBtK6Bww762ERQe8714DIegnjw */
                                            private final /* synthetic */ TLRPC.TL_error f$1;
                                            private final /* synthetic */ String f$2;

                                            {
                                                this.f$1 = r2;
                                                this.f$2 = r3;
                                            }

                                            public final void run() {
                                                PassportActivity.ErrorRunnable.this.onError(this.f$1.text, this.f$2);
                                            }
                                        });
                                        return;
                                    }
                                }
                                if (tL_error != null || tL_inputSecureValue2 == null) {
                                    lambda$run$4$PassportActivity$19$1(tL_error, (TLRPC.TL_secureValue) tLObject, null);
                                    return;
                                }
                                TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = new TLRPC.TL_account_saveSecureValue();
                                tL_account_saveSecureValue.value = tL_inputSecureValue2;
                                tL_account_saveSecureValue.secure_secret_id = PassportActivity.this.secureSecretId;
                                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_saveSecureValue, new RequestDelegate((TLRPC.TL_secureValue) tLObject) {
                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$TQb2x2qALTCtMJ6jiMjXhrESfXQ */
                                    private final /* synthetic */ TLRPC.TL_secureValue f$1;

                                    {
                                        this.f$1 = r2;
                                    }

                                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                        PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$4$PassportActivity$19$1(this.f$1, tLObject, tL_error);
                                    }
                                });
                            }

                            public /* synthetic */ void lambda$run$2$PassportActivity$19$1(String str, TLRPC.TL_secureRequiredType tL_secureRequiredType, PassportActivityDelegate passportActivityDelegate, ErrorRunnable errorRunnable, TLObject tLObject, TLRPC.TL_error tL_error) {
                                AndroidUtilities.runOnUIThread(new Runnable(tLObject, str, tL_secureRequiredType, passportActivityDelegate, tL_error, errorRunnable) {
                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$19$1$PSEnFeg3s52CAoLTOZDgrHrcu34 */
                                    private final /* synthetic */ TLObject f$1;
                                    private final /* synthetic */ String f$2;
                                    private final /* synthetic */ TLRPC.TL_secureRequiredType f$3;
                                    private final /* synthetic */ PassportActivity.PassportActivityDelegate f$4;
                                    private final /* synthetic */ TLRPC.TL_error f$5;
                                    private final /* synthetic */ PassportActivity.ErrorRunnable f$6;

                                    {
                                        this.f$1 = r2;
                                        this.f$2 = r3;
                                        this.f$3 = r4;
                                        this.f$4 = r5;
                                        this.f$5 = r6;
                                        this.f$6 = r7;
                                    }

                                    public final void run() {
                                        PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$null$1$PassportActivity$19$1(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6);
                                    }
                                });
                            }

                            public /* synthetic */ void lambda$null$1$PassportActivity$19$1(TLObject tLObject, String str, TLRPC.TL_secureRequiredType tL_secureRequiredType, PassportActivityDelegate passportActivityDelegate, TLRPC.TL_error tL_error, ErrorRunnable errorRunnable) {
                                if (tLObject != null) {
                                    TLRPC.TL_account_sentEmailCode tL_account_sentEmailCode = (TLRPC.TL_account_sentEmailCode) tLObject;
                                    HashMap hashMap = new HashMap();
                                    hashMap.put("email", str);
                                    hashMap.put("pattern", tL_account_sentEmailCode.email_pattern);
                                    PassportActivity passportActivity = new PassportActivity(6, PassportActivity.this.currentForm, PassportActivity.this.currentPassword, tL_secureRequiredType, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, hashMap, (HashMap<String, String>) null);
                                    passportActivity.currentAccount = PassportActivity.this.currentAccount;
                                    passportActivity.emailCodeLength = tL_account_sentEmailCode.length;
                                    passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
                                    passportActivity.secureSecret = PassportActivity.this.secureSecret;
                                    passportActivity.delegate = passportActivityDelegate;
                                    PassportActivity.this.presentFragment(passportActivity, true);
                                    return;
                                }
                                PassportActivity.this.showAlertWithText(LocaleController.getString("PassportEmail", R.string.PassportEmail), tL_error.text);
                                if (errorRunnable != null) {
                                    errorRunnable.onError(tL_error.text, str);
                                }
                            }
                        });
                    } else if (errorRunnable != null) {
                        errorRunnable.onError(null, null);
                    }
                }

                @Override // im.guobwnxjuc.ui.PassportActivity.PassportActivityDelegate
                public SecureDocument saveFile(TLRPC.TL_secureFile tL_secureFile) {
                    String str = FileLoader.getDirectory(4) + "/" + tL_secureFile.dc_id + "_" + tL_secureFile.id + ".jpg";
                    EncryptionResult createSecureDocument = PassportActivity.this.createSecureDocument(str);
                    return new SecureDocument(createSecureDocument.secureDocumentKey, tL_secureFile, str, createSecureDocument.fileHash, createSecureDocument.fileSecret);
                }

                @Override // im.guobwnxjuc.ui.PassportActivity.PassportActivityDelegate
                public void deleteValue(TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, ArrayList<TLRPC.TL_secureRequiredType> arrayList, boolean z, Runnable runnable, ErrorRunnable errorRunnable) {
                    PassportActivity.this.deleteValueInternal(tL_secureRequiredType, tL_secureRequiredType2, arrayList, z, runnable, errorRunnable, z);
                }
            };
            passportActivity.currentAccount = this.currentAccount;
            passportActivity.saltedPassword = this.saltedPassword;
            passportActivity.secureSecret = this.secureSecret;
            passportActivity.currentBotId = this.currentBotId;
            passportActivity.fieldsErrors = hashMap2;
            passportActivity.documentOnly = z;
            passportActivity.documentsErrors = hashMap3;
            passportActivity.availableDocumentTypes = arrayList;
            if (i == 4) {
                passportActivity.currentEmail = this.currentEmail;
            }
            presentFragment(passportActivity);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private TLRPC.TL_secureValue removeValue(TLRPC.TL_secureRequiredType tL_secureRequiredType) {
        if (tL_secureRequiredType == null) {
            return null;
        }
        int size = this.currentForm.values.size();
        for (int i = 0; i < size; i++) {
            if (tL_secureRequiredType.type.getClass() == this.currentForm.values.get(i).type.getClass()) {
                return this.currentForm.values.remove(i);
            }
        }
        return null;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void deleteValueInternal(TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, ArrayList<TLRPC.TL_secureRequiredType> arrayList, boolean z, Runnable runnable, ErrorRunnable errorRunnable, boolean z2) {
        if (tL_secureRequiredType != null) {
            TLRPC.TL_account_deleteSecureValue tL_account_deleteSecureValue = new TLRPC.TL_account_deleteSecureValue();
            if (!z2 || tL_secureRequiredType2 == null) {
                if (z) {
                    tL_account_deleteSecureValue.types.add(tL_secureRequiredType.type);
                }
                if (tL_secureRequiredType2 != null) {
                    tL_account_deleteSecureValue.types.add(tL_secureRequiredType2.type);
                }
            } else {
                tL_account_deleteSecureValue.types.add(tL_secureRequiredType2.type);
            }
            ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_deleteSecureValue, new RequestDelegate(errorRunnable, z2, tL_secureRequiredType2, tL_secureRequiredType, z, arrayList, runnable) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$9H6O_tLyNqPuWFkycfouPudGPw */
                private final /* synthetic */ PassportActivity.ErrorRunnable f$1;
                private final /* synthetic */ boolean f$2;
                private final /* synthetic */ TLRPC.TL_secureRequiredType f$3;
                private final /* synthetic */ TLRPC.TL_secureRequiredType f$4;
                private final /* synthetic */ boolean f$5;
                private final /* synthetic */ ArrayList f$6;
                private final /* synthetic */ Runnable f$7;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                    this.f$4 = r5;
                    this.f$5 = r6;
                    this.f$6 = r7;
                    this.f$7 = r8;
                }

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    PassportActivity.this.lambda$deleteValueInternal$61$PassportActivity(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6, this.f$7, tLObject, tL_error);
                }
            });
        }
    }

    public /* synthetic */ void lambda$deleteValueInternal$61$PassportActivity(ErrorRunnable errorRunnable, boolean z, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, boolean z2, ArrayList arrayList, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable(tL_error, errorRunnable, z, tL_secureRequiredType, tL_secureRequiredType2, z2, arrayList, runnable) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$Qg4lTohVWSUthSCoIN_DNa2M8DM */
            private final /* synthetic */ TLRPC.TL_error f$1;
            private final /* synthetic */ PassportActivity.ErrorRunnable f$2;
            private final /* synthetic */ boolean f$3;
            private final /* synthetic */ TLRPC.TL_secureRequiredType f$4;
            private final /* synthetic */ TLRPC.TL_secureRequiredType f$5;
            private final /* synthetic */ boolean f$6;
            private final /* synthetic */ ArrayList f$7;
            private final /* synthetic */ Runnable f$8;

            {
                this.f$1 = r2;
                this.f$2 = r3;
                this.f$3 = r4;
                this.f$4 = r5;
                this.f$5 = r6;
                this.f$6 = r7;
                this.f$7 = r8;
                this.f$8 = r9;
            }

            public final void run() {
                PassportActivity.this.lambda$null$60$PassportActivity(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5, this.f$6, this.f$7, this.f$8);
            }
        });
    }

    public /* synthetic */ void lambda$null$60$PassportActivity(TLRPC.TL_error tL_error, ErrorRunnable errorRunnable, boolean z, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, boolean z2, ArrayList arrayList, Runnable runnable) {
        String str;
        TLRPC.TL_secureRequiredType tL_secureRequiredType3;
        String str2;
        String str3 = null;
        if (tL_error != null) {
            if (errorRunnable != null) {
                errorRunnable.onError(tL_error.text, null);
            }
            showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            return;
        }
        if (!z) {
            if (z2) {
                removeValue(tL_secureRequiredType2);
            }
            removeValue(tL_secureRequiredType);
        } else if (tL_secureRequiredType != null) {
            removeValue(tL_secureRequiredType);
        } else {
            removeValue(tL_secureRequiredType2);
        }
        if (this.currentActivityType == 8) {
            TextDetailSecureCell remove = this.typesViews.remove(tL_secureRequiredType2);
            if (remove != null) {
                this.linearLayout2.removeView(remove);
                LinearLayout linearLayout = this.linearLayout2;
                View childAt = linearLayout.getChildAt(linearLayout.getChildCount() - 6);
                if (childAt instanceof TextDetailSecureCell) {
                    ((TextDetailSecureCell) childAt).setNeedDivider(false);
                }
            }
            updateManageVisibility();
        } else {
            if (tL_secureRequiredType == null || arrayList == null || arrayList.size() <= 1) {
                tL_secureRequiredType3 = tL_secureRequiredType;
                str = null;
            } else {
                int size = arrayList.size();
                int i = 0;
                while (true) {
                    if (i >= size) {
                        tL_secureRequiredType3 = tL_secureRequiredType;
                        break;
                    }
                    tL_secureRequiredType3 = (TLRPC.TL_secureRequiredType) arrayList.get(i);
                    TLRPC.TL_secureValue valueByType = getValueByType(tL_secureRequiredType3, false);
                    if (valueByType == null) {
                        i++;
                    } else if (valueByType.data != null) {
                        str2 = decryptData(valueByType.data.data, decryptValueSecret(valueByType.data.secret, valueByType.data.data_hash), valueByType.data.data_hash);
                    }
                }
                str2 = null;
                if (tL_secureRequiredType3 == null) {
                    str = str2;
                    tL_secureRequiredType3 = (TLRPC.TL_secureRequiredType) arrayList.get(0);
                } else {
                    str = str2;
                }
            }
            if (z2) {
                setTypeValue(tL_secureRequiredType2, null, null, tL_secureRequiredType3, str, z, arrayList != null ? arrayList.size() : 0);
            } else {
                TLRPC.TL_secureValue valueByType2 = getValueByType(tL_secureRequiredType2, false);
                if (!(valueByType2 == null || valueByType2.data == null)) {
                    str3 = decryptData(valueByType2.data.data, decryptValueSecret(valueByType2.data.secret, valueByType2.data.data_hash), valueByType2.data.data_hash);
                }
                setTypeValue(tL_secureRequiredType2, null, str3, tL_secureRequiredType3, str, z, arrayList != null ? arrayList.size() : 0);
            }
        }
        if (runnable != null) {
            runnable.run();
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:60:0x01a0  */
    private TextDetailSecureCell addField(Context context, TLRPC.TL_secureRequiredType tL_secureRequiredType, ArrayList<TLRPC.TL_secureRequiredType> arrayList, boolean z, boolean z2) {
        String str;
        String str2;
        String str3;
        TLRPC.TL_secureValue valueByType;
        String str4;
        String str5;
        int size = arrayList != null ? arrayList.size() : 0;
        TextDetailSecureCell textDetailSecureCell = new TextDetailSecureCell(context);
        textDetailSecureCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
        if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
            if (arrayList == null || arrayList.isEmpty()) {
                str5 = LocaleController.getString("PassportPersonalDetails", R.string.PassportPersonalDetails);
            } else if (z && arrayList.size() == 1) {
                str5 = getTextForType(arrayList.get(0).type);
            } else if (!z || arrayList.size() != 2) {
                str5 = LocaleController.getString("PassportIdentityDocument", R.string.PassportIdentityDocument);
            } else {
                str5 = LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, getTextForType(arrayList.get(0).type), getTextForType(arrayList.get(1).type));
            }
            textDetailSecureCell.setTextAndValue(str5, "", !z2);
        } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
            if (arrayList == null || arrayList.isEmpty()) {
                str4 = LocaleController.getString("PassportAddress", R.string.PassportAddress);
            } else if (z && arrayList.size() == 1) {
                str4 = getTextForType(arrayList.get(0).type);
            } else if (!z || arrayList.size() != 2) {
                str4 = LocaleController.getString("PassportResidentialAddress", R.string.PassportResidentialAddress);
            } else {
                str4 = LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, getTextForType(arrayList.get(0).type), getTextForType(arrayList.get(1).type));
            }
            textDetailSecureCell.setTextAndValue(str4, "", !z2);
        } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
            textDetailSecureCell.setTextAndValue(LocaleController.getString("PassportPhone", R.string.PassportPhone), "", !z2);
        } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail) {
            textDetailSecureCell.setTextAndValue(LocaleController.getString("PassportEmail", R.string.PassportEmail), "", !z2);
        }
        if (this.currentActivityType == 8) {
            LinearLayout linearLayout = this.linearLayout2;
            linearLayout.addView(textDetailSecureCell, linearLayout.getChildCount() - 5, LayoutHelper.createLinear(-1, -2));
        } else {
            this.linearLayout2.addView(textDetailSecureCell, LayoutHelper.createLinear(-1, -2));
        }
        textDetailSecureCell.setOnClickListener(new View.OnClickListener(arrayList, tL_secureRequiredType, z) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$I30I4z0xXsWko4SAJTIYFSwgEXk */
            private final /* synthetic */ ArrayList f$1;
            private final /* synthetic */ TLRPC.TL_secureRequiredType f$2;
            private final /* synthetic */ boolean f$3;

            {
                this.f$1 = r2;
                this.f$2 = r3;
                this.f$3 = r4;
            }

            public final void onClick(View view) {
                PassportActivity.this.lambda$addField$65$PassportActivity(this.f$1, this.f$2, this.f$3, view);
            }
        });
        this.typesViews.put(tL_secureRequiredType, textDetailSecureCell);
        this.typesValues.put(tL_secureRequiredType, new HashMap<>());
        TLRPC.TL_secureValue valueByType2 = getValueByType(tL_secureRequiredType, false);
        TLRPC.TL_secureRequiredType tL_secureRequiredType2 = null;
        if (valueByType2 != null) {
            if (valueByType2.plain_data instanceof TLRPC.TL_securePlainEmail) {
                str2 = ((TLRPC.TL_securePlainEmail) valueByType2.plain_data).email;
            } else if (valueByType2.plain_data instanceof TLRPC.TL_securePlainPhone) {
                str2 = ((TLRPC.TL_securePlainPhone) valueByType2.plain_data).phone;
            } else if (valueByType2.data != null) {
                str = decryptData(valueByType2.data.data, decryptValueSecret(valueByType2.data.secret, valueByType2.data.data_hash), valueByType2.data.data_hash);
                str2 = null;
                if (arrayList != null || arrayList.isEmpty()) {
                    str3 = null;
                } else {
                    int size2 = arrayList.size();
                    str3 = null;
                    boolean z3 = false;
                    for (int i = 0; i < size2; i++) {
                        TLRPC.TL_secureRequiredType tL_secureRequiredType3 = arrayList.get(i);
                        this.typesValues.put(tL_secureRequiredType3, new HashMap<>());
                        this.documentsToTypesLink.put(tL_secureRequiredType3, tL_secureRequiredType);
                        if (!z3 && (valueByType = getValueByType(tL_secureRequiredType3, false)) != null) {
                            if (valueByType.data != null) {
                                str3 = decryptData(valueByType.data.data, decryptValueSecret(valueByType.data.secret, valueByType.data.data_hash), valueByType.data.data_hash);
                            }
                            tL_secureRequiredType2 = tL_secureRequiredType3;
                            z3 = true;
                        }
                    }
                    if (tL_secureRequiredType2 == null) {
                        tL_secureRequiredType2 = arrayList.get(0);
                    }
                }
                setTypeValue(tL_secureRequiredType, str2, str, tL_secureRequiredType2, str3, z, size);
                return textDetailSecureCell;
            }
            str = null;
            if (arrayList != null) {
            }
            str3 = null;
            setTypeValue(tL_secureRequiredType, str2, str, tL_secureRequiredType2, str3, z, size);
            return textDetailSecureCell;
        }
        str2 = null;
        str = null;
        if (arrayList != null) {
        }
        str3 = null;
        setTypeValue(tL_secureRequiredType, str2, str, tL_secureRequiredType2, str3, z, size);
        return textDetailSecureCell;
    }

    public /* synthetic */ void lambda$addField$65$PassportActivity(ArrayList arrayList, TLRPC.TL_secureRequiredType tL_secureRequiredType, boolean z, View view) {
        TLRPC.TL_secureRequiredType tL_secureRequiredType2;
        String str;
        int i;
        if (arrayList != null) {
            int size = arrayList.size();
            int i2 = 0;
            while (true) {
                if (i2 >= size) {
                    break;
                }
                tL_secureRequiredType2 = (TLRPC.TL_secureRequiredType) arrayList.get(i2);
                if (getValueByType(tL_secureRequiredType2, false) != null || size == 1) {
                    break;
                }
                i2++;
            }
        }
        tL_secureRequiredType2 = null;
        if (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) && !(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
            boolean z2 = tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone;
            if ((z2 || (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail)) && getValueByType(tL_secureRequiredType, false) != null) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(tL_secureRequiredType, z) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$7KquTcCybrawJjPvrs2inEj5Pg */
                    private final /* synthetic */ TLRPC.TL_secureRequiredType f$1;
                    private final /* synthetic */ boolean f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        PassportActivity.this.lambda$null$64$PassportActivity(this.f$1, this.f$2, dialogInterface, i);
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                if (z2) {
                    i = R.string.PassportDeletePhoneAlert;
                    str = "PassportDeletePhoneAlert";
                } else {
                    i = R.string.PassportDeleteEmailAlert;
                    str = "PassportDeleteEmailAlert";
                }
                builder.setMessage(LocaleController.getString(str, i));
                showDialog(builder.create());
                return;
            }
        } else if (tL_secureRequiredType2 == null && arrayList != null && !arrayList.isEmpty()) {
            AlertDialog.Builder builder2 = new AlertDialog.Builder(getParentActivity());
            builder2.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
                builder2.setTitle(LocaleController.getString("PassportIdentityDocument", R.string.PassportIdentityDocument));
            } else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
                builder2.setTitle(LocaleController.getString("PassportAddress", R.string.PassportAddress));
            }
            ArrayList arrayList2 = new ArrayList();
            int size2 = arrayList.size();
            for (int i3 = 0; i3 < size2; i3++) {
                TLRPC.TL_secureRequiredType tL_secureRequiredType3 = (TLRPC.TL_secureRequiredType) arrayList.get(i3);
                if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                    arrayList2.add(LocaleController.getString("PassportAddLicence", R.string.PassportAddLicence));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypePassport) {
                    arrayList2.add(LocaleController.getString("PassportAddPassport", R.string.PassportAddPassport));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                    arrayList2.add(LocaleController.getString("PassportAddInternalPassport", R.string.PassportAddInternalPassport));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                    arrayList2.add(LocaleController.getString("PassportAddCard", R.string.PassportAddCard));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
                    arrayList2.add(LocaleController.getString("PassportAddBill", R.string.PassportAddBill));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
                    arrayList2.add(LocaleController.getString("PassportAddBank", R.string.PassportAddBank));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
                    arrayList2.add(LocaleController.getString("PassportAddAgreement", R.string.PassportAddAgreement));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
                    arrayList2.add(LocaleController.getString("PassportAddTemporaryRegistration", R.string.PassportAddTemporaryRegistration));
                } else if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
                    arrayList2.add(LocaleController.getString("PassportAddPassportRegistration", R.string.PassportAddPassportRegistration));
                }
            }
            builder2.setItems((CharSequence[]) arrayList2.toArray(new CharSequence[0]), new DialogInterface.OnClickListener(tL_secureRequiredType, arrayList, z) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$uMKUBQ4c0Be8HFx8_YxudWUk3Xk */
                private final /* synthetic */ TLRPC.TL_secureRequiredType f$1;
                private final /* synthetic */ ArrayList f$2;
                private final /* synthetic */ boolean f$3;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                }

                public final void onClick(DialogInterface dialogInterface, int i) {
                    PassportActivity.this.lambda$null$62$PassportActivity(this.f$1, this.f$2, this.f$3, dialogInterface, i);
                }
            });
            showDialog(builder2.create());
            return;
        }
        openTypeActivity(tL_secureRequiredType, tL_secureRequiredType2, arrayList, z);
    }

    public /* synthetic */ void lambda$null$62$PassportActivity(TLRPC.TL_secureRequiredType tL_secureRequiredType, ArrayList arrayList, boolean z, DialogInterface dialogInterface, int i) {
        openTypeActivity(tL_secureRequiredType, (TLRPC.TL_secureRequiredType) arrayList.get(i), arrayList, z);
    }

    public /* synthetic */ void lambda$null$64$PassportActivity(TLRPC.TL_secureRequiredType tL_secureRequiredType, boolean z, DialogInterface dialogInterface, int i) {
        needShowProgress();
        deleteValueInternal(tL_secureRequiredType, null, null, true, new Runnable() {
            /* class im.guobwnxjuc.ui.$$Lambda$ZJfproSxs96sioR1ppjTrkhoCxM */

            public final void run() {
                PassportActivity.this.needHideProgress();
            }
        }, new ErrorRunnable() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$SWa3blDGd6esTisbtorpg0xaa0 */

            @Override // im.guobwnxjuc.ui.PassportActivity.ErrorRunnable
            public final void onError(String str, String str2) {
                PassportActivity.this.lambda$null$63$PassportActivity(str, str2);
            }
        }, z);
    }

    public /* synthetic */ void lambda$null$63$PassportActivity(String str, String str2) {
        needHideProgress();
    }

    /* access modifiers changed from: private */
    public class EncryptionResult {
        byte[] decrypyedFileSecret;
        byte[] encryptedData;
        byte[] fileHash;
        byte[] fileSecret;
        SecureDocumentKey secureDocumentKey;

        public EncryptionResult(byte[] bArr, byte[] bArr2, byte[] bArr3, byte[] bArr4, byte[] bArr5, byte[] bArr6) {
            this.encryptedData = bArr;
            this.fileSecret = bArr2;
            this.fileHash = bArr4;
            this.decrypyedFileSecret = bArr3;
            this.secureDocumentKey = new SecureDocumentKey(bArr5, bArr6);
        }
    }

    private SecureDocumentKey getSecureDocumentKey(byte[] bArr, byte[] bArr2) {
        byte[] computeSHA512 = Utilities.computeSHA512(decryptValueSecret(bArr, bArr2), bArr2);
        byte[] bArr3 = new byte[32];
        System.arraycopy(computeSHA512, 0, bArr3, 0, 32);
        byte[] bArr4 = new byte[16];
        System.arraycopy(computeSHA512, 32, bArr4, 0, 16);
        return new SecureDocumentKey(bArr3, bArr4);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private byte[] decryptSecret(byte[] bArr, byte[] bArr2) {
        if (bArr == null || bArr.length != 32) {
            return null;
        }
        byte[] bArr3 = new byte[32];
        System.arraycopy(bArr2, 0, bArr3, 0, 32);
        byte[] bArr4 = new byte[16];
        System.arraycopy(bArr2, 32, bArr4, 0, 16);
        byte[] bArr5 = new byte[32];
        System.arraycopy(bArr, 0, bArr5, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(bArr5, bArr3, bArr4, 0, 32, 0, 0);
        return bArr5;
    }

    private byte[] decryptValueSecret(byte[] bArr, byte[] bArr2) {
        if (bArr == null || bArr.length != 32 || bArr2 == null || bArr2.length != 32) {
            return null;
        }
        byte[] bArr3 = new byte[32];
        System.arraycopy(this.saltedPassword, 0, bArr3, 0, 32);
        byte[] bArr4 = new byte[16];
        System.arraycopy(this.saltedPassword, 32, bArr4, 0, 16);
        byte[] bArr5 = new byte[32];
        System.arraycopy(this.secureSecret, 0, bArr5, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(bArr5, bArr3, bArr4, 0, 32, 0, 0);
        if (!checkSecret(bArr5, null)) {
            return null;
        }
        byte[] computeSHA512 = Utilities.computeSHA512(bArr5, bArr2);
        byte[] bArr6 = new byte[32];
        System.arraycopy(computeSHA512, 0, bArr6, 0, 32);
        byte[] bArr7 = new byte[16];
        System.arraycopy(computeSHA512, 32, bArr7, 0, 16);
        byte[] bArr8 = new byte[32];
        System.arraycopy(bArr, 0, bArr8, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(bArr8, bArr6, bArr7, 0, 32, 0, 0);
        return bArr8;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private EncryptionResult createSecureDocument(String str) {
        RandomAccessFile randomAccessFile;
        byte[] bArr = new byte[((int) new File(str).length())];
        RandomAccessFile randomAccessFile2 = null;
        try {
            randomAccessFile = new RandomAccessFile(str, "rws");
            try {
                randomAccessFile.readFully(bArr);
            } catch (Exception unused) {
                randomAccessFile2 = randomAccessFile;
            }
        } catch (Exception unused2) {
            randomAccessFile = randomAccessFile2;
            EncryptionResult encryptData = encryptData(bArr);
            randomAccessFile.seek(0);
            randomAccessFile.write(encryptData.encryptedData);
            randomAccessFile.close();
            return encryptData;
        }
        EncryptionResult encryptData2 = encryptData(bArr);
        try {
            randomAccessFile.seek(0);
            randomAccessFile.write(encryptData2.encryptedData);
            randomAccessFile.close();
        } catch (Exception unused3) {
        }
        return encryptData2;
    }

    private String decryptData(byte[] bArr, byte[] bArr2, byte[] bArr3) {
        if (bArr == null || bArr2 == null || bArr2.length != 32 || bArr3 == null || bArr3.length != 32) {
            return null;
        }
        byte[] computeSHA512 = Utilities.computeSHA512(bArr2, bArr3);
        byte[] bArr4 = new byte[32];
        System.arraycopy(computeSHA512, 0, bArr4, 0, 32);
        byte[] bArr5 = new byte[16];
        System.arraycopy(computeSHA512, 32, bArr5, 0, 16);
        int length = bArr.length;
        byte[] bArr6 = new byte[length];
        System.arraycopy(bArr, 0, bArr6, 0, bArr.length);
        Utilities.aesCbcEncryptionByteArraySafe(bArr6, bArr4, bArr5, 0, length, 0, 0);
        if (!Arrays.equals(Utilities.computeSHA256(bArr6), bArr3)) {
            return null;
        }
        int i = bArr6[0] & UByte.MAX_VALUE;
        return new String(bArr6, i, length - i);
    }

    public static boolean checkSecret(byte[] bArr, Long l) {
        if (bArr == null || bArr.length != 32) {
            return false;
        }
        int i = 0;
        for (byte b : bArr) {
            i += b & UByte.MAX_VALUE;
        }
        if (i % 255 != 239) {
            return false;
        }
        if (l == null || Utilities.bytesToLong(Utilities.computeSHA256(bArr)) == l.longValue()) {
            return true;
        }
        return false;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private byte[] getRandomSecret() {
        byte[] bArr = new byte[32];
        Utilities.random.nextBytes(bArr);
        int i = 0;
        for (int i2 = 0; i2 < 32; i2++) {
            i += 255 & bArr[i2];
        }
        int i3 = i % 255;
        if (i3 != 239) {
            int nextInt = Utilities.random.nextInt(32);
            int i4 = (bArr[nextInt] & UByte.MAX_VALUE) + (239 - i3);
            if (i4 < 255) {
                i4 += 255;
            }
            bArr[nextInt] = (byte) (i4 % 255);
        }
        return bArr;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private EncryptionResult encryptData(byte[] bArr) {
        byte[] randomSecret = getRandomSecret();
        int nextInt = Utilities.random.nextInt(208) + 32;
        while ((bArr.length + nextInt) % 16 != 0) {
            nextInt++;
        }
        byte[] bArr2 = new byte[nextInt];
        Utilities.random.nextBytes(bArr2);
        bArr2[0] = (byte) nextInt;
        int length = nextInt + bArr.length;
        byte[] bArr3 = new byte[length];
        System.arraycopy(bArr2, 0, bArr3, 0, nextInt);
        System.arraycopy(bArr, 0, bArr3, nextInt, bArr.length);
        byte[] computeSHA256 = Utilities.computeSHA256(bArr3);
        byte[] computeSHA512 = Utilities.computeSHA512(randomSecret, computeSHA256);
        byte[] bArr4 = new byte[32];
        System.arraycopy(computeSHA512, 0, bArr4, 0, 32);
        byte[] bArr5 = new byte[16];
        System.arraycopy(computeSHA512, 32, bArr5, 0, 16);
        Utilities.aesCbcEncryptionByteArraySafe(bArr3, bArr4, bArr5, 0, length, 0, 1);
        byte[] bArr6 = new byte[32];
        System.arraycopy(this.saltedPassword, 0, bArr6, 0, 32);
        byte[] bArr7 = new byte[16];
        System.arraycopy(this.saltedPassword, 32, bArr7, 0, 16);
        byte[] bArr8 = new byte[32];
        System.arraycopy(this.secureSecret, 0, bArr8, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(bArr8, bArr6, bArr7, 0, 32, 0, 0);
        byte[] computeSHA5122 = Utilities.computeSHA512(bArr8, computeSHA256);
        byte[] bArr9 = new byte[32];
        System.arraycopy(computeSHA5122, 0, bArr9, 0, 32);
        byte[] bArr10 = new byte[16];
        System.arraycopy(computeSHA5122, 32, bArr10, 0, 16);
        byte[] bArr11 = new byte[32];
        System.arraycopy(randomSecret, 0, bArr11, 0, 32);
        Utilities.aesCbcEncryptionByteArraySafe(bArr11, bArr9, bArr10, 0, 32, 0, 1);
        return new EncryptionResult(bArr3, bArr11, randomSecret, computeSHA256, bArr4, bArr5);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void showAlertWithText(String str, String str2) {
        if (getParentActivity() != null) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            builder.setTitle(str);
            builder.setMessage(str2);
            showDialog(builder.create());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void onPasscodeError(boolean z) {
        if (getParentActivity() != null) {
            Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
            if (vibrator != null) {
                vibrator.vibrate(200);
            }
            if (z) {
                this.inputFields[0].setText("");
            }
            AndroidUtilities.shakeView(this.inputFields[0], 2.0f, 0);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void startPhoneVerification(boolean z, String str, Runnable runnable, ErrorRunnable errorRunnable, PassportActivityDelegate passportActivityDelegate) {
        TLRPC.TL_account_sendVerifyPhoneCode tL_account_sendVerifyPhoneCode = new TLRPC.TL_account_sendVerifyPhoneCode();
        tL_account_sendVerifyPhoneCode.phone_number = str;
        tL_account_sendVerifyPhoneCode.settings = new TLRPC.TL_codeSettings();
        tL_account_sendVerifyPhoneCode.settings.allow_flashcall = false;
        tL_account_sendVerifyPhoneCode.settings.allow_app_hash = ApplicationLoader.hasPlayServices;
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
        if (tL_account_sendVerifyPhoneCode.settings.allow_app_hash) {
            sharedPreferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit();
        } else {
            sharedPreferences.edit().remove("sms_hash").commit();
        }
        ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_sendVerifyPhoneCode, new RequestDelegate(str, passportActivityDelegate, tL_account_sendVerifyPhoneCode) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$ttc0x_brk31KINjIvTvcRnzcX0w */
            private final /* synthetic */ String f$1;
            private final /* synthetic */ PassportActivity.PassportActivityDelegate f$2;
            private final /* synthetic */ TLRPC.TL_account_sendVerifyPhoneCode f$3;

            {
                this.f$1 = r2;
                this.f$2 = r3;
                this.f$3 = r4;
            }

            @Override // im.guobwnxjuc.tgnet.RequestDelegate
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                PassportActivity.this.lambda$startPhoneVerification$67$PassportActivity(this.f$1, this.f$2, this.f$3, tLObject, tL_error);
            }
        }, 2);
    }

    public /* synthetic */ void lambda$startPhoneVerification$67$PassportActivity(String str, PassportActivityDelegate passportActivityDelegate, TLRPC.TL_account_sendVerifyPhoneCode tL_account_sendVerifyPhoneCode, TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable(tL_error, str, passportActivityDelegate, tLObject, tL_account_sendVerifyPhoneCode) {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$NmuVuPbTjGDLTc_OqMWRiQ_pMbA */
            private final /* synthetic */ TLRPC.TL_error f$1;
            private final /* synthetic */ String f$2;
            private final /* synthetic */ PassportActivity.PassportActivityDelegate f$3;
            private final /* synthetic */ TLObject f$4;
            private final /* synthetic */ TLRPC.TL_account_sendVerifyPhoneCode f$5;

            {
                this.f$1 = r2;
                this.f$2 = r3;
                this.f$3 = r4;
                this.f$4 = r5;
                this.f$5 = r6;
            }

            public final void run() {
                PassportActivity.this.lambda$null$66$PassportActivity(this.f$1, this.f$2, this.f$3, this.f$4, this.f$5);
            }
        });
    }

    public /* synthetic */ void lambda$null$66$PassportActivity(TLRPC.TL_error tL_error, String str, PassportActivityDelegate passportActivityDelegate, TLObject tLObject, TLRPC.TL_account_sendVerifyPhoneCode tL_account_sendVerifyPhoneCode) {
        if (tL_error == null) {
            HashMap hashMap = new HashMap();
            hashMap.put("phone", str);
            PassportActivity passportActivity = new PassportActivity(7, this.currentForm, this.currentPassword, this.currentType, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, hashMap, (HashMap<String, String>) null);
            passportActivity.currentAccount = this.currentAccount;
            passportActivity.saltedPassword = this.saltedPassword;
            passportActivity.secureSecret = this.secureSecret;
            passportActivity.delegate = passportActivityDelegate;
            passportActivity.currentPhoneVerification = (TLRPC.TL_auth_sentCode) tLObject;
            presentFragment(passportActivity, true);
            return;
        }
        AlertsCreator.processError(this.currentAccount, tL_error, this, tL_account_sendVerifyPhoneCode, str);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void updatePasswordInterface() {
        if (this.noPasswordImageView != null) {
            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);
            } else 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, 0.0f, 25.0f, 0.0f, 0.0f));
                this.emptyView.setVisibility(8);
            } else {
                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, 0.0f, 0.0f, 0.0f, 0.0f));
                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(LocaleController.getString("LoginPassword", R.string.LoginPassword));
                    } else {
                        this.inputFields[0].setHint(this.currentPassword.hint);
                    }
                }
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void showEditDoneProgress(boolean z, final boolean z2) {
        AnimatorSet animatorSet = this.doneItemAnimation;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        if (z && this.doneItem != null) {
            this.doneItemAnimation = new AnimatorSet();
            if (z2) {
                this.progressView.setVisibility(0);
                this.doneItem.setEnabled(false);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.progressView, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressView, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressView, View.ALPHA, 1.0f));
            } else {
                this.doneItem.getContentView().setVisibility(0);
                this.doneItem.setEnabled(true);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressView, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressView, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.ALPHA, 1.0f));
            }
            this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass20 */

                public void onAnimationEnd(Animator animator) {
                    if (PassportActivity.this.doneItemAnimation != null && PassportActivity.this.doneItemAnimation.equals(animator)) {
                        if (!z2) {
                            PassportActivity.this.progressView.setVisibility(4);
                        } else {
                            PassportActivity.this.doneItem.getContentView().setVisibility(4);
                        }
                    }
                }

                public void onAnimationCancel(Animator animator) {
                    if (PassportActivity.this.doneItemAnimation != null && PassportActivity.this.doneItemAnimation.equals(animator)) {
                        PassportActivity.this.doneItemAnimation = null;
                    }
                }
            });
            this.doneItemAnimation.setDuration(150L);
            this.doneItemAnimation.start();
        } else if (this.acceptTextView != null) {
            this.doneItemAnimation = new AnimatorSet();
            if (z2) {
                this.progressViewButton.setVisibility(0);
                this.bottomLayout.setEnabled(false);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.acceptTextView, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.progressViewButton, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, View.ALPHA, 1.0f));
            } else {
                this.acceptTextView.setVisibility(0);
                this.bottomLayout.setEnabled(true);
                this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressViewButton, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.acceptTextView, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, View.ALPHA, 1.0f));
            }
            this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass21 */

                public void onAnimationEnd(Animator animator) {
                    if (PassportActivity.this.doneItemAnimation != null && PassportActivity.this.doneItemAnimation.equals(animator)) {
                        if (!z2) {
                            PassportActivity.this.progressViewButton.setVisibility(4);
                        } else {
                            PassportActivity.this.acceptTextView.setVisibility(4);
                        }
                    }
                }

                public void onAnimationCancel(Animator animator) {
                    if (PassportActivity.this.doneItemAnimation != null && PassportActivity.this.doneItemAnimation.equals(animator)) {
                        PassportActivity.this.doneItemAnimation = null;
                    }
                }
            });
            this.doneItemAnimation.setDuration(150L);
            this.doneItemAnimation.start();
        }
    }

    @Override // im.guobwnxjuc.messenger.NotificationCenter.NotificationCenterDelegate
    public void didReceivedNotification(int i, int i2, Object... objArr) {
        SecureDocumentCell secureDocumentCell;
        ActionBarMenuItem actionBarMenuItem;
        if (i == NotificationCenter.FileDidUpload) {
            String str = (String) objArr[0];
            SecureDocument secureDocument = this.uploadingDocuments.get(str);
            if (secureDocument != null) {
                secureDocument.inputFile = (TLRPC.TL_inputFile) objArr[1];
                this.uploadingDocuments.remove(str);
                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 || (secureDocumentCell = hashMap.get(secureDocument)) == null)) {
                    secureDocumentCell.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 (secureDocument.type == 0) {
                    if (this.bottomCell != null && !TextUtils.isEmpty(this.noAllDocumentsErrorText)) {
                        this.bottomCell.setText(this.noAllDocumentsErrorText);
                    }
                    this.errorsValues.remove("files_all");
                } else if (secureDocument.type == 4) {
                    if (this.bottomCellTranslation != null && !TextUtils.isEmpty(this.noAllTranslationErrorText)) {
                        this.bottomCellTranslation.setText(this.noAllTranslationErrorText);
                    }
                    this.errorsValues.remove("translation_all");
                }
            }
        } else if (i != NotificationCenter.FileDidFailUpload) {
            if (i == NotificationCenter.didSetTwoStepPassword) {
                if (objArr == null || objArr.length <= 0) {
                    this.currentPassword = null;
                    loadPasswordInfo();
                } else {
                    if (objArr[7] != null) {
                        EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                        if (editTextBoldCursorArr[0] != null) {
                            editTextBoldCursorArr[0].setText((String) objArr[7]);
                        }
                    }
                    if (objArr[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) objArr[1];
                        this.currentPassword.new_secure_algo = (TLRPC.SecurePasswordKdfAlgo) objArr[2];
                        this.currentPassword.secure_random = (byte[]) objArr[3];
                        this.currentPassword.has_recovery = !TextUtils.isEmpty((String) objArr[4]);
                        this.currentPassword.hint = (String) objArr[5];
                        this.currentPassword.srp_id = -1;
                        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;
                        }
                    }
                }
                updatePasswordInterface();
                return;
            }
            int i3 = NotificationCenter.didRemoveTwoStepPassword;
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onTransitionAnimationEnd(boolean z, boolean z2) {
        if (this.presentAfterAnimation != null) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$LSqtYHvcVa0nCFFTd2WsKllmPz0 */

                public final void run() {
                    PassportActivity.this.lambda$onTransitionAnimationEnd$68$PassportActivity();
                }
            });
        }
        int i = this.currentActivityType;
        if (i == 5) {
            if (z) {
                if (this.inputFieldContainers[0].getVisibility() == 0) {
                    this.inputFields[0].requestFocus();
                    AndroidUtilities.showKeyboard(this.inputFields[0]);
                }
                if (this.usingSavedPassword == 2) {
                    onPasswordDone(false);
                }
            }
        } else if (i == 7) {
            if (z) {
                this.views[this.currentViewNum].onShow();
            }
        } else if (i == 4) {
            if (z) {
                this.inputFields[0].requestFocus();
                AndroidUtilities.showKeyboard(this.inputFields[0]);
            }
        } else if (i == 6) {
            if (z) {
                this.inputFields[0].requestFocus();
                AndroidUtilities.showKeyboard(this.inputFields[0]);
            }
        } else if ((i == 2 || i == 1) && Build.VERSION.SDK_INT >= 21) {
            createChatAttachView();
        }
    }

    public /* synthetic */ void lambda$onTransitionAnimationEnd$68$PassportActivity() {
        presentFragment(this.presentAfterAnimation, true);
        this.presentAfterAnimation = null;
    }

    private void showAttachmentError() {
        if (getParentActivity() != null) {
            ToastUtils.show((int) R.string.UnsupportedAttachment);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onActivityResultFragment(int i, int i2, Intent intent) {
        if (i2 != -1) {
            return;
        }
        if (i == 0 || i == 2) {
            createChatAttachView();
            ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
            if (chatAttachAlert2 != null) {
                chatAttachAlert2.onActivityResultFragment(i, intent, this.currentPicturePath);
            }
            this.currentPicturePath = null;
        } else if (i != 1) {
        } else {
            if (intent == null || intent.getData() == null) {
                showAttachmentError();
                return;
            }
            ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList = new ArrayList<>();
            SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
            sendingMediaInfo.uri = intent.getData();
            arrayList.add(sendingMediaInfo);
            processSelectedFiles(arrayList);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) {
        ChatAttachAlert chatAttachAlert2;
        TextSettingsCell textSettingsCell;
        int i2 = this.currentActivityType;
        if ((i2 == 1 || i2 == 2) && (chatAttachAlert2 = this.chatAttachAlert) != null) {
            if (i == 17 && chatAttachAlert2 != null) {
                chatAttachAlert2.checkCamera(false);
            } else if (i == 21) {
                if (getParentActivity() != null && iArr != null && iArr.length != 0 && iArr[0] != 0) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                    builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                    builder.setMessage(LocaleController.getString("PermissionNoAudioVideo", R.string.PermissionNoAudioVideo));
                    builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$4_Fku1x3EDRKDFQOaXRgKN2uUzg */

                        public final void onClick(DialogInterface dialogInterface, int i) {
                            PassportActivity.this.lambda$onRequestPermissionsResultFragment$69$PassportActivity(dialogInterface, i);
                        }
                    });
                    builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
                    builder.show();
                }
            } else if (i == 19 && iArr != null && iArr.length > 0 && iArr[0] == 0) {
                processSelectedAttach(0);
            } else if (i == 22 && iArr != null && iArr.length > 0 && iArr[0] == 0 && (textSettingsCell = this.scanDocumentCell) != null) {
                textSettingsCell.callOnClick();
            }
        } else if (this.currentActivityType == 3 && i == 6) {
            startPhoneVerification(false, this.pendingPhone, this.pendingFinishRunnable, this.pendingErrorRunnable, this.pendingDelegate);
        }
    }

    public /* synthetic */ void lambda$onRequestPermissionsResultFragment$69$PassportActivity(DialogInterface dialogInterface, int i) {
        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);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void saveSelfArgs(Bundle bundle) {
        String str = this.currentPicturePath;
        if (str != null) {
            bundle.putString("path", str);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void restoreSelfArgs(Bundle bundle) {
        this.currentPicturePath = bundle.getString("path");
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public boolean onBackPressed() {
        int i = this.currentActivityType;
        int i2 = 0;
        if (i == 7) {
            this.views[this.currentViewNum].onBackPressed(true);
            while (true) {
                SlideView[] slideViewArr = this.views;
                if (i2 >= slideViewArr.length) {
                    break;
                }
                if (slideViewArr[i2] != null) {
                    slideViewArr[i2].onDestroyActivity();
                }
                i2++;
            }
        } else if (i == 0 || i == 5) {
            callCallback(false);
        } else if (i == 1 || i == 2) {
            return !checkDiscard();
        }
        return true;
    }

    /* access modifiers changed from: protected */
    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onDialogDismiss(Dialog dialog) {
        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 (getParentActivity() != null && !getParentActivity().isFinishing() && this.progressDialog == null) {
            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) {
            try {
                alertDialog.dismiss();
            } catch (Exception e) {
                FileLog.e(e);
            }
            this.progressDialog = null;
        }
    }

    public void setPage(int i, boolean z, Bundle bundle) {
        if (i == 3) {
            this.doneItem.setVisibility(8);
        }
        SlideView[] slideViewArr = this.views;
        final SlideView slideView = slideViewArr[this.currentViewNum];
        final SlideView slideView2 = slideViewArr[i];
        this.currentViewNum = i;
        slideView2.setParams(bundle, false);
        slideView2.onShow();
        if (z) {
            slideView2.setTranslationX((float) AndroidUtilities.displaySize.x);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
            animatorSet.setDuration(300L);
            animatorSet.playTogether(ObjectAnimator.ofFloat(slideView, "translationX", (float) (-AndroidUtilities.displaySize.x)), ObjectAnimator.ofFloat(slideView2, "translationX", 0.0f));
            animatorSet.addListener(new AnimatorListenerAdapter() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass22 */

                public void onAnimationStart(Animator animator) {
                    slideView2.setVisibility(0);
                }

                public void onAnimationEnd(Animator animator) {
                    slideView.setVisibility(8);
                    slideView.setX(0.0f);
                }
            });
            animatorSet.start();
            return;
        }
        slideView2.setTranslationX(0.0f);
        slideView2.setVisibility(0);
        if (slideView != slideView2) {
            slideView.setVisibility(8);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void fillNextCodeParams(Bundle bundle, TLRPC.TL_auth_sentCode tL_auth_sentCode, boolean z) {
        bundle.putString("phoneHash", tL_auth_sentCode.phone_code_hash);
        if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeCall) {
            bundle.putInt("nextType", 4);
        } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) {
            bundle.putInt("nextType", 3);
        } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeSms) {
            bundle.putInt("nextType", 2);
        }
        if (tL_auth_sentCode.timeout == 0) {
            tL_auth_sentCode.timeout = 60;
        }
        bundle.putInt("timeout", tL_auth_sentCode.timeout * 1000);
        if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeCall) {
            bundle.putInt("type", 4);
            bundle.putInt("length", tL_auth_sentCode.type.length);
            setPage(2, z, bundle);
        } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
            bundle.putInt("type", 3);
            bundle.putString("pattern", tL_auth_sentCode.type.pattern);
            setPage(1, z, bundle);
        } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeSms) {
            bundle.putInt("type", 2);
            bundle.putInt("length", tL_auth_sentCode.type.length);
            setPage(0, z, bundle);
        }
    }

    private void openAttachMenu() {
        if (getParentActivity() != null) {
            boolean z = true;
            if (this.uploadingFileType != 0 || this.documents.size() < 20) {
                createChatAttachView();
                ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
                if (this.uploadingFileType != 1) {
                    z = false;
                }
                chatAttachAlert2.setOpenWithFrontFaceCamera(z);
                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);
                return;
            }
            showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("PassportUploadMaxReached", R.string.PassportUploadMaxReached, LocaleController.formatPluralString("Files", 20)));
        }
    }

    private void createChatAttachView() {
        if (getParentActivity() != null && this.chatAttachAlert == null) {
            ChatAttachAlert chatAttachAlert2 = new ChatAttachAlert(getParentActivity(), this);
            this.chatAttachAlert = chatAttachAlert2;
            chatAttachAlert2.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() {
                /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass23 */

                @Override // im.guobwnxjuc.ui.components.ChatAttachAlert.ChatAttachViewDelegate
                public void didSelectBot(TLRPC.User user) {
                }

                @Override // im.guobwnxjuc.ui.components.ChatAttachAlert.ChatAttachViewDelegate
                public View getRevealView() {
                    return null;
                }

                @Override // im.guobwnxjuc.ui.components.ChatAttachAlert.ChatAttachViewDelegate
                public void needEnterComment() {
                }

                @Override // im.guobwnxjuc.ui.components.ChatAttachAlert.ChatAttachViewDelegate
                public void didPressedButton(int i, boolean z, boolean z2, int i2) {
                    if (!(PassportActivity.this.getParentActivity() == null || PassportActivity.this.chatAttachAlert == null)) {
                        if (i == 8 || i == 7) {
                            if (i != 8) {
                                PassportActivity.this.chatAttachAlert.dismiss();
                            }
                            HashMap<Object, Object> selectedPhotos = PassportActivity.this.chatAttachAlert.getSelectedPhotos();
                            ArrayList<Object> selectedPhotosOrder = PassportActivity.this.chatAttachAlert.getSelectedPhotosOrder();
                            if (!selectedPhotos.isEmpty()) {
                                ArrayList arrayList = new ArrayList();
                                for (int i3 = 0; i3 < selectedPhotosOrder.size(); i3++) {
                                    MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) selectedPhotos.get(selectedPhotosOrder.get(i3));
                                    SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
                                    if (photoEntry.imagePath != null) {
                                        sendingMediaInfo.path = photoEntry.imagePath;
                                    } else if (photoEntry.path != null) {
                                        sendingMediaInfo.path = photoEntry.path;
                                    }
                                    arrayList.add(sendingMediaInfo);
                                    photoEntry.reset();
                                }
                                PassportActivity.this.processSelectedFiles(arrayList);
                                return;
                            }
                            return;
                        }
                        if (PassportActivity.this.chatAttachAlert != null) {
                            PassportActivity.this.chatAttachAlert.dismissWithButtonClick(i);
                        }
                        PassportActivity.this.processSelectedAttach(i);
                    }
                }

                @Override // im.guobwnxjuc.ui.components.ChatAttachAlert.ChatAttachViewDelegate
                public void onCameraOpened() {
                    AndroidUtilities.hideKeyboard(PassportActivity.this.fragmentView.findFocus());
                }
            });
        }
    }

    private int getMaxSelectedDocuments() {
        int size;
        int i = this.uploadingFileType;
        if (i == 0) {
            size = this.documents.size();
        } else if (i != 4) {
            return 1;
        } else {
            size = this.translationDocuments.size();
        }
        return 20 - size;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void processSelectedAttach(int i) {
        if (i == 0) {
            if (Build.VERSION.SDK_INT < 23 || getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) == 0) {
                try {
                    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
                    File generatePicturePath = AndroidUtilities.generatePicturePath();
                    if (generatePicturePath != null) {
                        if (Build.VERSION.SDK_INT >= 24) {
                            intent.putExtra("output", FileProvider.getUriForFile(getParentActivity(), "im.guobwnxjuc.messenger.provider", generatePicturePath));
                            intent.addFlags(2);
                            intent.addFlags(1);
                        } else {
                            intent.putExtra("output", Uri.fromFile(generatePicturePath));
                        }
                        this.currentPicturePath = generatePicturePath.getAbsolutePath();
                    }
                    startActivityForResult(intent, 0);
                } catch (Exception e) {
                    FileLog.e(e);
                }
            } else {
                getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 19);
            }
        } else if (i == 1) {
            if (Build.VERSION.SDK_INT < 23 || getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") == 0) {
                PhotoAlbumPickerActivity photoAlbumPickerActivity = new PhotoAlbumPickerActivity(0, false, false, null);
                photoAlbumPickerActivity.setCurrentAccount(this.currentAccount);
                photoAlbumPickerActivity.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
                photoAlbumPickerActivity.setAllowSearchImages(false);
                photoAlbumPickerActivity.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass24 */

                    @Override // im.guobwnxjuc.ui.PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate
                    public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList, boolean z, int i, boolean z2) {
                        PassportActivity.this.processSelectedFiles(arrayList);
                    }

                    @Override // im.guobwnxjuc.ui.PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate
                    public void startPhotoSelectActivity() {
                        try {
                            Intent intent = new Intent("android.intent.action.PICK");
                            intent.setType("image/*");
                            PassportActivity.this.startActivityForResult(intent, 1);
                        } catch (Exception e) {
                            FileLog.e(e);
                        }
                    }
                });
                presentFragment(photoAlbumPickerActivity);
                return;
            }
            getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
        } else if (i != 4) {
        } else {
            if (Build.VERSION.SDK_INT < 23 || getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") == 0) {
                DocumentSelectActivity documentSelectActivity = new DocumentSelectActivity(false);
                documentSelectActivity.setCurrentAccount(this.currentAccount);
                documentSelectActivity.setCanSelectOnlyImageFiles(true);
                documentSelectActivity.setMaxSelectedFiles(getMaxSelectedDocuments());
                documentSelectActivity.setDelegate(new DocumentSelectActivity.DocumentSelectActivityDelegate() {
                    /* class im.guobwnxjuc.ui.PassportActivity.AnonymousClass25 */

                    @Override // im.guobwnxjuc.ui.DocumentSelectActivity.DocumentSelectActivityDelegate
                    public /* synthetic */ void startMusicSelectActivity(BaseFragment baseFragment) {
                        DocumentSelectActivity.DocumentSelectActivityDelegate.CC.$default$startMusicSelectActivity(this, baseFragment);
                    }

                    @Override // im.guobwnxjuc.ui.DocumentSelectActivity.DocumentSelectActivityDelegate
                    public void didSelectFiles(DocumentSelectActivity documentSelectActivity, ArrayList<String> arrayList, boolean z, int i) {
                        documentSelectActivity.finishFragment();
                        ArrayList arrayList2 = new ArrayList();
                        int size = arrayList.size();
                        for (int i2 = 0; i2 < size; i2++) {
                            SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
                            sendingMediaInfo.path = arrayList.get(i2);
                            arrayList2.add(sendingMediaInfo);
                        }
                        PassportActivity.this.processSelectedFiles(arrayList2);
                    }

                    @Override // im.guobwnxjuc.ui.DocumentSelectActivity.DocumentSelectActivityDelegate
                    public void startDocumentSelectActivity() {
                        try {
                            Intent intent = new Intent("android.intent.action.GET_CONTENT");
                            if (Build.VERSION.SDK_INT >= 18) {
                                intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
                            }
                            intent.setType("*/*");
                            PassportActivity.this.startActivityForResult(intent, 21);
                        } catch (Exception e) {
                            FileLog.e(e);
                        }
                    }
                });
                presentFragment(documentSelectActivity);
                return;
            }
            getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
        }
    }

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

    private String getCurrentValues() {
        StringBuilder sb = new StringBuilder();
        int i = 0;
        while (true) {
            EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
            if (i >= editTextBoldCursorArr.length) {
                break;
            }
            sb.append((CharSequence) editTextBoldCursorArr[i].getText());
            sb.append(",");
            i++;
        }
        if (this.inputExtraFields != null) {
            int i2 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                if (i2 >= editTextBoldCursorArr2.length) {
                    break;
                }
                sb.append((CharSequence) editTextBoldCursorArr2[i2].getText());
                sb.append(",");
                i2++;
            }
        }
        int size = this.documents.size();
        for (int i3 = 0; i3 < size; i3++) {
            sb.append(this.documents.get(i3).secureFile.id);
        }
        SecureDocument secureDocument = this.frontDocument;
        if (secureDocument != null) {
            sb.append(secureDocument.secureFile.id);
        }
        SecureDocument secureDocument2 = this.reverseDocument;
        if (secureDocument2 != null) {
            sb.append(secureDocument2.secureFile.id);
        }
        SecureDocument secureDocument3 = this.selfieDocument;
        if (secureDocument3 != null) {
            sb.append(secureDocument3.secureFile.id);
        }
        int size2 = this.translationDocuments.size();
        for (int i4 = 0; i4 < size2; i4++) {
            sb.append(this.translationDocuments.get(i4).secureFile.id);
        }
        return sb.toString();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private boolean isHasNotAnyChanges() {
        String str = this.initialValues;
        return str == null || str.equals(getCurrentValues());
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private boolean checkDiscard() {
        if (isHasNotAnyChanges()) {
            return false;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setPositiveButton(LocaleController.getString("PassportDiscard", R.string.PassportDiscard), new DialogInterface.OnClickListener() {
            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$qba4e6H0KLvgqqeQbB_gvxeK9M */

            public final void onClick(DialogInterface dialogInterface, int i) {
                PassportActivity.this.lambda$checkDiscard$70$PassportActivity(dialogInterface, i);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        builder.setTitle(LocaleController.getString("DiscardChanges", R.string.DiscardChanges));
        builder.setMessage(LocaleController.getString("PassportDiscardChanges", R.string.PassportDiscardChanges));
        showDialog(builder.create());
        return true;
    }

    public /* synthetic */ void lambda$checkDiscard$70$PassportActivity(DialogInterface dialogInterface, int i) {
        finishFragment();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void processSelectedFiles(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList) {
        if (!arrayList.isEmpty()) {
            int i = this.uploadingFileType;
            boolean z = true;
            boolean z2 = false;
            if (!(i == 1 || i == 4 || !(this.currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails))) {
                int i2 = 0;
                while (true) {
                    EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                    if (i2 < editTextBoldCursorArr.length) {
                        if (i2 != 5 && i2 != 8 && i2 != 4 && i2 != 6 && editTextBoldCursorArr[i2].length() > 0) {
                            z = false;
                            break;
                        }
                        i2++;
                    } else {
                        break;
                    }
                }
                z2 = z;
            }
            Utilities.globalQueue.postRunnable(new Runnable(arrayList, this.uploadingFileType, z2) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$mk1BwzQirtjRtpETFLbAstBjHkA */
                private final /* synthetic */ ArrayList f$1;
                private final /* synthetic */ int f$2;
                private final /* synthetic */ boolean f$3;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                }

                public final void run() {
                    PassportActivity.this.lambda$processSelectedFiles$73$PassportActivity(this.f$1, this.f$2, this.f$3);
                }
            });
        }
    }

    public /* synthetic */ void lambda$processSelectedFiles$73$PassportActivity(ArrayList arrayList, int i, boolean z) {
        TLRPC.PhotoSize scaleAndSaveImage;
        Throwable th;
        int i2 = this.uploadingFileType;
        int min = Math.min((i2 == 0 || i2 == 4) ? 20 : 1, arrayList.size());
        boolean z2 = false;
        for (int i3 = 0; i3 < min; i3++) {
            SendMessagesHelper.SendingMediaInfo sendingMediaInfo = (SendMessagesHelper.SendingMediaInfo) arrayList.get(i3);
            Bitmap loadBitmap = ImageLoader.loadBitmap(sendingMediaInfo.path, sendingMediaInfo.uri, 2048.0f, 2048.0f, false);
            if (!(loadBitmap == null || (scaleAndSaveImage = ImageLoader.scaleAndSaveImage(loadBitmap, 2048.0f, 2048.0f, 89, false, 320, 320)) == null)) {
                TLRPC.TL_secureFile tL_secureFile = new TLRPC.TL_secureFile();
                tL_secureFile.dc_id = (int) scaleAndSaveImage.location.volume_id;
                tL_secureFile.id = (long) scaleAndSaveImage.location.local_id;
                tL_secureFile.date = (int) (System.currentTimeMillis() / 1000);
                SecureDocument saveFile = this.delegate.saveFile(tL_secureFile);
                saveFile.type = i;
                AndroidUtilities.runOnUIThread(new Runnable(saveFile, i) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$pYSGS5ItRZWe9UiUSmwWp98MpSM */
                    private final /* synthetic */ SecureDocument f$1;
                    private final /* synthetic */ int f$2;

                    {
                        this.f$1 = r2;
                        this.f$2 = r3;
                    }

                    public final void run() {
                        PassportActivity.this.lambda$null$71$PassportActivity(this.f$1, this.f$2);
                    }
                });
                if (z && !z2) {
                    try {
                        MrzRecognizer.Result recognize = MrzRecognizer.recognize(loadBitmap, this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense);
                        if (recognize != null) {
                            try {
                                AndroidUtilities.runOnUIThread(new Runnable(recognize) {
                                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$FZ7I1c5RWUkyYKotWoFMA5W9M */
                                    private final /* synthetic */ MrzRecognizer.Result f$1;

                                    {
                                        this.f$1 = r2;
                                    }

                                    public final void run() {
                                        PassportActivity.this.lambda$null$72$PassportActivity(this.f$1);
                                    }
                                });
                                z2 = true;
                            } catch (Throwable th2) {
                                th = th2;
                                z2 = true;
                                FileLog.e(th);
                            }
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        FileLog.e(th);
                    }
                }
            }
        }
        SharedConfig.saveConfig();
    }

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

    public /* synthetic */ void lambda$null$72$PassportActivity(MrzRecognizer.Result result) {
        if (result.type == 2) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) {
                int size = this.availableDocumentTypes.size();
                int i = 0;
                while (true) {
                    if (i >= size) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType tL_secureRequiredType = this.availableDocumentTypes.get(i);
                    if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
                        this.currentDocumentsType = tL_secureRequiredType;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                    i++;
                }
            }
        } else if (result.type == 1) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport)) {
                int size2 = this.availableDocumentTypes.size();
                int i2 = 0;
                while (true) {
                    if (i2 >= size2) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType tL_secureRequiredType2 = this.availableDocumentTypes.get(i2);
                    if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassport) {
                        this.currentDocumentsType = tL_secureRequiredType2;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                    i2++;
                }
            }
        } else if (result.type == 3) {
            if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
                int size3 = this.availableDocumentTypes.size();
                int i3 = 0;
                while (true) {
                    if (i3 >= size3) {
                        break;
                    }
                    TLRPC.TL_secureRequiredType tL_secureRequiredType3 = this.availableDocumentTypes.get(i3);
                    if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
                        this.currentDocumentsType = tL_secureRequiredType3;
                        updateInterfaceStringsForDocumentType();
                        break;
                    }
                    i3++;
                }
            }
        } else if (result.type == 4 && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
            int size4 = this.availableDocumentTypes.size();
            int i4 = 0;
            while (true) {
                if (i4 >= size4) {
                    break;
                }
                TLRPC.TL_secureRequiredType tL_secureRequiredType4 = this.availableDocumentTypes.get(i4);
                if (tL_secureRequiredType4.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
                    this.currentDocumentsType = tL_secureRequiredType4;
                    updateInterfaceStringsForDocumentType();
                    break;
                }
                i4++;
            }
        }
        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 i5 = result.gender;
            if (i5 == 1) {
                this.currentGender = "male";
                this.inputFields[4].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
            } else if (i5 == 2) {
                this.currentGender = "female";
                this.inputFields[4].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
            }
        }
        if (!TextUtils.isEmpty(result.nationality)) {
            String str = result.nationality;
            this.currentCitizeship = str;
            String str2 = this.languageMap.get(str);
            if (str2 != null) {
                this.inputFields[5].setText(str2);
            }
        }
        if (!TextUtils.isEmpty(result.issuingCountry)) {
            String str3 = result.issuingCountry;
            this.currentResidence = str3;
            String str4 = this.languageMap.get(str3);
            if (str4 != null) {
                this.inputFields[6].setText(str4);
            }
        }
        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) {
            int[] iArr = this.currentExpireDate;
            iArr[2] = 0;
            iArr[1] = 0;
            iArr[0] = 0;
            this.inputFields[8].setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
            return;
        }
        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)));
    }

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

    /* access modifiers changed from: private */
    public class ProgressView extends View {
        private Paint paint = new Paint();
        private Paint paint2 = new Paint();
        private float progress;

        public ProgressView(Context context) {
            super(context);
            this.paint.setColor(Theme.getColor(Theme.key_login_progressInner));
            this.paint2.setColor(Theme.getColor(Theme.key_login_progressOuter));
        }

        public void setProgress(float f) {
            this.progress = f;
            invalidate();
        }

        /* access modifiers changed from: protected */
        public void onDraw(Canvas canvas) {
            float measuredWidth = (float) ((int) (((float) getMeasuredWidth()) * this.progress));
            canvas.drawRect(0.0f, 0.0f, measuredWidth, (float) getMeasuredHeight(), this.paint2);
            canvas.drawRect(measuredWidth, 0.0f, (float) getMeasuredWidth(), (float) getMeasuredHeight(), this.paint);
        }
    }

    public class PhoneConfirmationView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
        private ImageView blackImageView;
        private ImageView blueImageView;
        private EditTextBoldCursor[] codeField;
        private LinearLayout codeFieldContainer;
        private int codeTime = 15000;
        private Timer codeTimer;
        private TextView confirmTextView;
        private Bundle currentParams;
        private boolean ignoreOnTextChange;
        private double lastCodeTime;
        private double lastCurrentTime;
        private String lastError = "";
        private int length;
        private boolean nextPressed;
        private int nextType;
        private int openTime;
        private String pattern = "*";
        private String phone;
        private String phoneHash;
        private TextView problemText;
        private ProgressView progressView;
        private int time = TimeConstants.MIN;
        private TextView timeText;
        private Timer timeTimer;
        private int timeout;
        private final Object timerSync = new Object();
        private TextView titleTextView;
        private int verificationType;
        private boolean waitingForEvent;

        static /* synthetic */ void lambda$onBackPressed$9(TLObject tLObject, TLRPC.TL_error tL_error) {
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public PhoneConfirmationView(Context context, int i) {
            super(context);
            this.verificationType = i;
            setOrientation(1);
            TextView textView = new TextView(context);
            this.confirmTextView = textView;
            textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.confirmTextView.setTextSize(1, 14.0f);
            this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            TextView textView2 = new TextView(context);
            this.titleTextView = textView2;
            textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.titleTextView.setTextSize(1, 18.0f);
            this.titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.titleTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.titleTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.titleTextView.setGravity(49);
            if (this.verificationType == 3) {
                this.confirmTextView.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
                FrameLayout frameLayout = new FrameLayout(context);
                addView(frameLayout, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
                ImageView imageView = new ImageView(context);
                imageView.setImageResource(R.drawable.phone_activate);
                if (LocaleController.isRTL) {
                    frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
                    frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f));
                } else {
                    frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
                    frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 21, 0.0f, 2.0f, 0.0f, 2.0f));
                }
            } else {
                this.confirmTextView.setGravity(49);
                FrameLayout frameLayout2 = new FrameLayout(context);
                addView(frameLayout2, LayoutHelper.createLinear(-2, -2, 49));
                if (this.verificationType == 1) {
                    ImageView imageView2 = new ImageView(context);
                    this.blackImageView = imageView2;
                    imageView2.setImageResource(R.drawable.sms_devices);
                    this.blackImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
                    frameLayout2.addView(this.blackImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    ImageView imageView3 = new ImageView(context);
                    this.blueImageView = imageView3;
                    imageView3.setImageResource(R.drawable.sms_bubble);
                    this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY));
                    frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    this.titleTextView.setText(LocaleController.getString("SentAppCodeTitle", R.string.SentAppCodeTitle));
                } else {
                    ImageView imageView4 = new ImageView(context);
                    this.blueImageView = imageView4;
                    imageView4.setImageResource(R.drawable.sms_code);
                    this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY));
                    frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    this.titleTextView.setText(LocaleController.getString("SentSmsCodeTitle", R.string.SentSmsCodeTitle));
                }
                addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 18, 0, 0));
                addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 17, 0, 0));
            }
            LinearLayout linearLayout = new LinearLayout(context);
            this.codeFieldContainer = linearLayout;
            linearLayout.setOrientation(0);
            addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, 36, 1));
            if (this.verificationType == 3) {
                this.codeFieldContainer.setVisibility(8);
            }
            AnonymousClass1 r4 = new TextView(context, PassportActivity.this) {
                /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass1 */

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
                }
            };
            this.timeText = r4;
            r4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.timeText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            if (this.verificationType == 3) {
                this.timeText.setTextSize(1, 14.0f);
                addView(this.timeText, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
                this.progressView = new ProgressView(context);
                this.timeText.setGravity(LocaleController.isRTL ? 5 : 3);
                addView(this.progressView, LayoutHelper.createLinear(-1, 3, 0.0f, 12.0f, 0.0f, 0.0f));
            } else {
                this.timeText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
                this.timeText.setTextSize(1, 15.0f);
                this.timeText.setGravity(49);
                addView(this.timeText, LayoutHelper.createLinear(-2, -2, 49));
            }
            AnonymousClass2 r42 = new TextView(context, PassportActivity.this) {
                /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass2 */

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
                }
            };
            this.problemText = r42;
            r42.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            this.problemText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.problemText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
            this.problemText.setTextSize(1, 15.0f);
            this.problemText.setGravity(49);
            if (this.verificationType == 1) {
                this.problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms));
            } else {
                this.problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode));
            }
            addView(this.problemText, LayoutHelper.createLinear(-2, -2, 49));
            this.problemText.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$sej3EVGi6WcDmG18AAlK97hTY4 */

                public final void onClick(View view) {
                    PassportActivity.PhoneConfirmationView.this.lambda$new$0$PassportActivity$PhoneConfirmationView(view);
                }
            });
        }

        public /* synthetic */ void lambda$new$0$PassportActivity$PhoneConfirmationView(View view) {
            if (!this.nextPressed) {
                if (!((this.nextType == 4 && this.verificationType == 2) || this.nextType == 0)) {
                    resendCode();
                    return;
                }
                try {
                    PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
                    String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
                    Intent intent = new Intent("android.intent.action.SEND");
                    intent.setType("message/rfc822");
                    intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@stel.com"});
                    intent.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + format + " " + this.phone);
                    intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.phone + "\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.lastError);
                    getContext().startActivity(Intent.createChooser(intent, "Send email..."));
                } catch (Exception unused) {
                    AlertsCreator.showSimpleAlert(PassportActivity.this, LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
                }
            }
        }

        /* access modifiers changed from: protected */
        public void onMeasure(int i, int i2) {
            ImageView imageView;
            super.onMeasure(i, i2);
            if (this.verificationType != 3 && (imageView = this.blueImageView) != null) {
                int measuredHeight = imageView.getMeasuredHeight() + this.titleTextView.getMeasuredHeight() + this.confirmTextView.getMeasuredHeight() + AndroidUtilities.dp(35.0f);
                int dp = AndroidUtilities.dp(80.0f);
                int dp2 = AndroidUtilities.dp(291.0f);
                if (PassportActivity.this.scrollHeight - measuredHeight < dp) {
                    setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
                } else if (PassportActivity.this.scrollHeight > dp2) {
                    setMeasuredDimension(getMeasuredWidth(), dp2);
                } else {
                    setMeasuredDimension(getMeasuredWidth(), PassportActivity.this.scrollHeight);
                }
            }
        }

        /* access modifiers changed from: protected */
        public void onLayout(boolean z, int i, int i2, int i3, int i4) {
            int i5;
            super.onLayout(z, i, i2, i3, i4);
            if (this.verificationType != 3 && this.blueImageView != null) {
                int bottom = this.confirmTextView.getBottom();
                int measuredHeight = getMeasuredHeight() - bottom;
                if (this.problemText.getVisibility() == 0) {
                    int measuredHeight2 = this.problemText.getMeasuredHeight();
                    i5 = (measuredHeight + bottom) - measuredHeight2;
                    TextView textView = this.problemText;
                    textView.layout(textView.getLeft(), i5, this.problemText.getRight(), measuredHeight2 + i5);
                } else if (this.timeText.getVisibility() == 0) {
                    int measuredHeight3 = this.timeText.getMeasuredHeight();
                    i5 = (measuredHeight + bottom) - measuredHeight3;
                    TextView textView2 = this.timeText;
                    textView2.layout(textView2.getLeft(), i5, this.timeText.getRight(), measuredHeight3 + i5);
                } else {
                    i5 = measuredHeight + bottom;
                }
                int measuredHeight4 = this.codeFieldContainer.getMeasuredHeight();
                int i6 = (((i5 - bottom) - measuredHeight4) / 2) + bottom;
                LinearLayout linearLayout = this.codeFieldContainer;
                linearLayout.layout(linearLayout.getLeft(), i6, this.codeFieldContainer.getRight(), measuredHeight4 + i6);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void resendCode() {
            Bundle bundle = new Bundle();
            bundle.putString("phone", this.phone);
            this.nextPressed = true;
            PassportActivity.this.needShowProgress();
            TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
            tL_auth_resendCode.phone_number = this.phone;
            tL_auth_resendCode.phone_code_hash = this.phoneHash;
            ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate(bundle, tL_auth_resendCode) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$82Hl8oCkPHlJb3MbUDOliffcU */
                private final /* synthetic */ Bundle f$1;
                private final /* synthetic */ TLRPC.TL_auth_resendCode f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    PassportActivity.PhoneConfirmationView.this.lambda$resendCode$3$PassportActivity$PhoneConfirmationView(this.f$1, this.f$2, tLObject, tL_error);
                }
            }, 2);
        }

        public /* synthetic */ void lambda$resendCode$3$PassportActivity$PhoneConfirmationView(Bundle bundle, TLRPC.TL_auth_resendCode tL_auth_resendCode, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, bundle, tLObject, tL_auth_resendCode) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$JhbE5uvwsRxQApbEUjv1Znh2p8 */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ Bundle f$2;
                private final /* synthetic */ TLObject f$3;
                private final /* synthetic */ TLRPC.TL_auth_resendCode f$4;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                    this.f$4 = r5;
                }

                public final void run() {
                    PassportActivity.PhoneConfirmationView.this.lambda$null$2$PassportActivity$PhoneConfirmationView(this.f$1, this.f$2, this.f$3, this.f$4);
                }
            });
        }

        public /* synthetic */ void lambda$null$2$PassportActivity$PhoneConfirmationView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_auth_resendCode tL_auth_resendCode) {
            this.nextPressed = false;
            if (tL_error == null) {
                PassportActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject, true);
            } else {
                AlertDialog alertDialog = (AlertDialog) AlertsCreator.processError(PassportActivity.this.currentAccount, tL_error, PassportActivity.this, tL_auth_resendCode, new Object[0]);
                if (alertDialog != null && tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                    alertDialog.setPositiveButtonListener(new DialogInterface.OnClickListener() {
                        /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$60g0uZmU9SoriAKNErdM5yxTHTQ */

                        public final void onClick(DialogInterface dialogInterface, int i) {
                            PassportActivity.PhoneConfirmationView.this.lambda$null$1$PassportActivity$PhoneConfirmationView(dialogInterface, i);
                        }
                    });
                }
            }
            PassportActivity.this.needHideProgress();
        }

        public /* synthetic */ void lambda$null$1$PassportActivity$PhoneConfirmationView(DialogInterface dialogInterface, int i) {
            onBackPressed(true);
            PassportActivity.this.finishFragment();
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            int i;
            int i2;
            if (bundle != null) {
                this.waitingForEvent = true;
                int i3 = this.verificationType;
                if (i3 == 2) {
                    AndroidUtilities.setWaitingForSms(true);
                    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
                } else if (i3 == 3) {
                    AndroidUtilities.setWaitingForCall(true);
                    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
                }
                this.currentParams = bundle;
                this.phone = bundle.getString("phone");
                this.phoneHash = bundle.getString("phoneHash");
                int i4 = bundle.getInt("timeout");
                this.time = i4;
                this.timeout = i4;
                this.openTime = (int) (System.currentTimeMillis() / 1000);
                this.nextType = bundle.getInt("nextType");
                this.pattern = bundle.getString("pattern");
                int i5 = bundle.getInt("length");
                this.length = i5;
                if (i5 == 0) {
                    this.length = 5;
                }
                EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                CharSequence charSequence = "";
                int i6 = 8;
                if (editTextBoldCursorArr != null && editTextBoldCursorArr.length == this.length) {
                    int i7 = 0;
                    while (true) {
                        EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
                        if (i7 >= editTextBoldCursorArr2.length) {
                            break;
                        }
                        editTextBoldCursorArr2[i7].setText(charSequence);
                        i7++;
                    }
                } else {
                    this.codeField = new EditTextBoldCursor[this.length];
                    final int i8 = 0;
                    while (i8 < this.length) {
                        this.codeField[i8] = new EditTextBoldCursor(getContext());
                        this.codeField[i8].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                        this.codeField[i8].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                        this.codeField[i8].setCursorSize(AndroidUtilities.dp(20.0f));
                        this.codeField[i8].setCursorWidth(1.5f);
                        Drawable mutate = getResources().getDrawable(R.drawable.search_dark_activated).mutate();
                        mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.MULTIPLY));
                        this.codeField[i8].setBackgroundDrawable(mutate);
                        this.codeField[i8].setImeOptions(268435461);
                        this.codeField[i8].setTextSize(1, 20.0f);
                        this.codeField[i8].setMaxLines(1);
                        this.codeField[i8].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                        this.codeField[i8].setPadding(0, 0, 0, 0);
                        this.codeField[i8].setGravity(49);
                        if (this.verificationType == 3) {
                            this.codeField[i8].setEnabled(false);
                            this.codeField[i8].setInputType(0);
                            this.codeField[i8].setVisibility(8);
                        } else {
                            this.codeField[i8].setInputType(3);
                        }
                        this.codeFieldContainer.addView(this.codeField[i8], LayoutHelper.createLinear(34, 36, 1, 0, 0, i8 != this.length - 1 ? 7 : 0, 0));
                        this.codeField[i8].addTextChangedListener(new TextWatcher() {
                            /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass3 */

                            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void afterTextChanged(Editable editable) {
                                int length;
                                if (!PhoneConfirmationView.this.ignoreOnTextChange && (length = editable.length()) >= 1) {
                                    if (length > 1) {
                                        String obj = editable.toString();
                                        PhoneConfirmationView.this.ignoreOnTextChange = true;
                                        for (int i = 0; i < Math.min(PhoneConfirmationView.this.length - i8, length); i++) {
                                            if (i == 0) {
                                                editable.replace(0, length, obj.substring(i, i + 1));
                                            } else {
                                                PhoneConfirmationView.this.codeField[i8 + i].setText(obj.substring(i, i + 1));
                                            }
                                        }
                                        PhoneConfirmationView.this.ignoreOnTextChange = false;
                                    }
                                    if (i8 != PhoneConfirmationView.this.length - 1) {
                                        PhoneConfirmationView.this.codeField[i8 + 1].setSelection(PhoneConfirmationView.this.codeField[i8 + 1].length());
                                        PhoneConfirmationView.this.codeField[i8 + 1].requestFocus();
                                    }
                                    if ((i8 == PhoneConfirmationView.this.length - 1 || (i8 == PhoneConfirmationView.this.length - 2 && length >= 2)) && PhoneConfirmationView.this.getCode().length() == PhoneConfirmationView.this.length) {
                                        PhoneConfirmationView.this.onNextPressed();
                                    }
                                }
                            }
                        });
                        this.codeField[i8].setOnKeyListener(new View.OnKeyListener(i8) {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$3Otw8KYKyzM9Domm1dkITD0uDNk */
                            private final /* synthetic */ int f$1;

                            {
                                this.f$1 = r2;
                            }

                            public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                                return PassportActivity.PhoneConfirmationView.this.lambda$setParams$4$PassportActivity$PhoneConfirmationView(this.f$1, view, i, keyEvent);
                            }
                        });
                        this.codeField[i8].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$kcHPpyvhwMn3lJ0BkM_jYku4g4c */

                            public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                                return PassportActivity.PhoneConfirmationView.this.lambda$setParams$5$PassportActivity$PhoneConfirmationView(textView, i, keyEvent);
                            }
                        });
                        i8++;
                    }
                }
                ProgressView progressView2 = this.progressView;
                if (progressView2 != null) {
                    progressView2.setVisibility(this.nextType != 0 ? 0 : 8);
                }
                if (this.phone != null) {
                    PhoneFormat instance = PhoneFormat.getInstance();
                    String format = instance.format(Marker.ANY_NON_NULL_MARKER + this.phone);
                    int i9 = this.verificationType;
                    if (i9 == 2) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(format)));
                    } else if (i9 == 3) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(format)));
                    } else if (i9 == 4) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(format)));
                    }
                    this.confirmTextView.setText(charSequence);
                    if (this.verificationType != 3) {
                        AndroidUtilities.showKeyboard(this.codeField[0]);
                        this.codeField[0].requestFocus();
                    } else {
                        AndroidUtilities.hideKeyboard(this.codeField[0]);
                    }
                    destroyTimer();
                    destroyCodeTimer();
                    this.lastCurrentTime = (double) System.currentTimeMillis();
                    if (this.verificationType == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
                        this.problemText.setVisibility(8);
                        this.timeText.setVisibility(0);
                        int i10 = this.nextType;
                        if (i10 == 4) {
                            this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
                        } else if (i10 == 2) {
                            this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0));
                        }
                        createTimer();
                    } else if (this.verificationType == 2 && ((i = this.nextType) == 4 || i == 3)) {
                        this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
                        this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
                        TextView textView = this.timeText;
                        if (this.time >= 1000) {
                            i6 = 0;
                        }
                        textView.setVisibility(i6);
                        createTimer();
                    } else if (this.verificationType == 4 && this.nextType == 2) {
                        this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
                        this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
                        TextView textView2 = this.timeText;
                        if (this.time >= 1000) {
                            i6 = 0;
                        }
                        textView2.setVisibility(i6);
                        createTimer();
                    } else {
                        this.timeText.setVisibility(8);
                        this.problemText.setVisibility(8);
                        createCodeTimer();
                    }
                }
            }
        }

        public /* synthetic */ boolean lambda$setParams$4$PassportActivity$PhoneConfirmationView(int i, View view, int i2, KeyEvent keyEvent) {
            if (i2 != 67 || this.codeField[i].length() != 0 || i <= 0) {
                return false;
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
            int i3 = i - 1;
            editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length());
            this.codeField[i3].requestFocus();
            this.codeField[i3].dispatchKeyEvent(keyEvent);
            return true;
        }

        public /* synthetic */ boolean lambda$setParams$5$PassportActivity$PhoneConfirmationView(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void createCodeTimer() {
            if (this.codeTimer == null) {
                this.codeTime = 15000;
                this.codeTimer = new Timer();
                this.lastCodeTime = (double) System.currentTimeMillis();
                this.codeTimer.schedule(new TimerTask() {
                    /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass4 */

                    public void run() {
                        AndroidUtilities.runOnUIThread(new Runnable() {
                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$4$BnS0Y7ahFGp7xC1YrNo3EMvOkBU */

                            public final void run() {
                                PassportActivity.PhoneConfirmationView.AnonymousClass4.this.lambda$run$0$PassportActivity$PhoneConfirmationView$4();
                            }
                        });
                    }

                    public /* synthetic */ void lambda$run$0$PassportActivity$PhoneConfirmationView$4() {
                        double currentTimeMillis = (double) System.currentTimeMillis();
                        double d = PhoneConfirmationView.this.lastCodeTime;
                        Double.isNaN(currentTimeMillis);
                        double d2 = currentTimeMillis - d;
                        PhoneConfirmationView.this.lastCodeTime = currentTimeMillis;
                        PhoneConfirmationView phoneConfirmationView = PhoneConfirmationView.this;
                        double d3 = (double) phoneConfirmationView.codeTime;
                        Double.isNaN(d3);
                        phoneConfirmationView.codeTime = (int) (d3 - d2);
                        if (PhoneConfirmationView.this.codeTime <= 1000) {
                            PhoneConfirmationView.this.problemText.setVisibility(0);
                            PhoneConfirmationView.this.timeText.setVisibility(8);
                            PhoneConfirmationView.this.destroyCodeTimer();
                        }
                    }
                }, 0, 1000);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void destroyCodeTimer() {
            try {
                synchronized (this.timerSync) {
                    if (this.codeTimer != null) {
                        this.codeTimer.cancel();
                        this.codeTimer = null;
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        private void createTimer() {
            if (this.timeTimer == null) {
                Timer timer = new Timer();
                this.timeTimer = timer;
                timer.schedule(new TimerTask() {
                    /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass5 */

                    public void run() {
                        if (PhoneConfirmationView.this.timeTimer != null) {
                            double currentTimeMillis = (double) System.currentTimeMillis();
                            double d = PhoneConfirmationView.this.lastCurrentTime;
                            Double.isNaN(currentTimeMillis);
                            PhoneConfirmationView phoneConfirmationView = PhoneConfirmationView.this;
                            double d2 = (double) phoneConfirmationView.time;
                            Double.isNaN(d2);
                            phoneConfirmationView.time = (int) (d2 - (currentTimeMillis - d));
                            PhoneConfirmationView.this.lastCurrentTime = currentTimeMillis;
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                /* class im.guobwnxjuc.ui.PassportActivity.PhoneConfirmationView.AnonymousClass5.AnonymousClass1 */

                                public void run() {
                                    if (PhoneConfirmationView.this.time >= 1000) {
                                        int i = (PhoneConfirmationView.this.time / 1000) / 60;
                                        int i2 = (PhoneConfirmationView.this.time / 1000) - (i * 60);
                                        if (PhoneConfirmationView.this.nextType == 4 || PhoneConfirmationView.this.nextType == 3) {
                                            PhoneConfirmationView.this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(i), Integer.valueOf(i2)));
                                        } else if (PhoneConfirmationView.this.nextType == 2) {
                                            PhoneConfirmationView.this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(i), Integer.valueOf(i2)));
                                        }
                                        if (PhoneConfirmationView.this.progressView != null) {
                                            PhoneConfirmationView.this.progressView.setProgress(1.0f - (((float) PhoneConfirmationView.this.time) / ((float) PhoneConfirmationView.this.timeout)));
                                            return;
                                        }
                                        return;
                                    }
                                    if (PhoneConfirmationView.this.progressView != null) {
                                        PhoneConfirmationView.this.progressView.setProgress(1.0f);
                                    }
                                    PhoneConfirmationView.this.destroyTimer();
                                    if (PhoneConfirmationView.this.verificationType == 3) {
                                        AndroidUtilities.setWaitingForCall(false);
                                        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
                                        PhoneConfirmationView.this.waitingForEvent = false;
                                        PhoneConfirmationView.this.destroyCodeTimer();
                                        PhoneConfirmationView.this.resendCode();
                                    } else if (PhoneConfirmationView.this.verificationType != 2 && PhoneConfirmationView.this.verificationType != 4) {
                                    } else {
                                        if (PhoneConfirmationView.this.nextType == 4 || PhoneConfirmationView.this.nextType == 2) {
                                            if (PhoneConfirmationView.this.nextType == 4) {
                                                PhoneConfirmationView.this.timeText.setText(LocaleController.getString("Calling", R.string.Calling));
                                            } else {
                                                PhoneConfirmationView.this.timeText.setText(LocaleController.getString("SendingSms", R.string.SendingSms));
                                            }
                                            PhoneConfirmationView.this.createCodeTimer();
                                            TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
                                            tL_auth_resendCode.phone_number = PhoneConfirmationView.this.phone;
                                            tL_auth_resendCode.phone_code_hash = PhoneConfirmationView.this.phoneHash;
                                            ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
                                                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$5$1$nvREORUWWEew4S6a8GtO8qpJ0z8 */

                                                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                                    PassportActivity.PhoneConfirmationView.AnonymousClass5.AnonymousClass1.this.lambda$run$1$PassportActivity$PhoneConfirmationView$5$1(tLObject, tL_error);
                                                }
                                            }, 2);
                                        } else if (PhoneConfirmationView.this.nextType == 3) {
                                            AndroidUtilities.setWaitingForSms(false);
                                            NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
                                            PhoneConfirmationView.this.waitingForEvent = false;
                                            PhoneConfirmationView.this.destroyCodeTimer();
                                            PhoneConfirmationView.this.resendCode();
                                        }
                                    }
                                }

                                public /* synthetic */ void lambda$run$1$PassportActivity$PhoneConfirmationView$5$1(TLObject tLObject, TLRPC.TL_error tL_error) {
                                    if (tL_error != null && tL_error.text != null) {
                                        AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                                            /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$5$1$qHV4tyRJSdwrWYfN74v57cIvq8 */
                                            private final /* synthetic */ TLRPC.TL_error f$1;

                                            {
                                                this.f$1 = r2;
                                            }

                                            public final void run() {
                                                PassportActivity.PhoneConfirmationView.AnonymousClass5.AnonymousClass1.this.lambda$null$0$PassportActivity$PhoneConfirmationView$5$1(this.f$1);
                                            }
                                        });
                                    }
                                }

                                public /* synthetic */ void lambda$null$0$PassportActivity$PhoneConfirmationView$5$1(TLRPC.TL_error tL_error) {
                                    PhoneConfirmationView.this.lastError = tL_error.text;
                                }
                            });
                        }
                    }
                }, 0, 1000);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void destroyTimer() {
            try {
                synchronized (this.timerSync) {
                    if (this.timeTimer != null) {
                        this.timeTimer.cancel();
                        this.timeTimer = null;
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private String getCode() {
            if (this.codeField == null) {
                return "";
            }
            StringBuilder sb = new StringBuilder();
            int i = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                if (i >= editTextBoldCursorArr.length) {
                    return sb.toString();
                }
                sb.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[i].getText().toString()));
                i++;
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (!this.nextPressed) {
                String code = getCode();
                if (TextUtils.isEmpty(code)) {
                    AndroidUtilities.shakeView(this.codeFieldContainer, 2.0f, 0);
                    return;
                }
                this.nextPressed = true;
                int i = this.verificationType;
                if (i == 2) {
                    AndroidUtilities.setWaitingForSms(false);
                    NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
                } else if (i == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
                }
                this.waitingForEvent = false;
                PassportActivity.this.showEditDoneProgress(true, true);
                TLRPC.TL_account_verifyPhone tL_account_verifyPhone = new TLRPC.TL_account_verifyPhone();
                tL_account_verifyPhone.phone_number = this.phone;
                tL_account_verifyPhone.phone_code = code;
                tL_account_verifyPhone.phone_code_hash = this.phoneHash;
                destroyTimer();
                PassportActivity.this.needShowProgress();
                ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_verifyPhone, new RequestDelegate(tL_account_verifyPhone) {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$DZFGNChsXk0830_8mpH2qNns1K4 */
                    private final /* synthetic */ TLRPC.TL_account_verifyPhone f$1;

                    {
                        this.f$1 = r2;
                    }

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        PassportActivity.PhoneConfirmationView.this.lambda$onNextPressed$7$PassportActivity$PhoneConfirmationView(this.f$1, tLObject, tL_error);
                    }
                }, 2);
            }
        }

        public /* synthetic */ void lambda$onNextPressed$7$PassportActivity$PhoneConfirmationView(TLRPC.TL_account_verifyPhone tL_account_verifyPhone, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tL_account_verifyPhone) {
                /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$w9ihOjjFJFpHQqnAl0yZqp9AmQ */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLRPC.TL_account_verifyPhone f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    PassportActivity.PhoneConfirmationView.this.lambda$null$6$PassportActivity$PhoneConfirmationView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$6$PassportActivity$PhoneConfirmationView(TLRPC.TL_error tL_error, TLRPC.TL_account_verifyPhone tL_account_verifyPhone) {
            int i;
            int i2;
            PassportActivity.this.needHideProgress();
            this.nextPressed = false;
            if (tL_error == null) {
                destroyTimer();
                destroyCodeTimer();
                PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, (String) PassportActivity.this.currentValues.get("phone"), null, null, null, null, null, null, null, null, new Runnable() {
                    /* class im.guobwnxjuc.ui.$$Lambda$N6MIOtqJETyNLCZIHeFf2Mi6u5A */

                    public final void run() {
                        PassportActivity.this.finishFragment();
                    }
                }, null);
                return;
            }
            this.lastError = tL_error.text;
            if ((this.verificationType == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((this.verificationType == 2 && ((i = this.nextType) == 4 || i == 3)) || (this.verificationType == 4 && this.nextType == 2))) {
                createTimer();
            }
            int i3 = this.verificationType;
            if (i3 == 2) {
                AndroidUtilities.setWaitingForSms(true);
                NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
            } else if (i3 == 3) {
                AndroidUtilities.setWaitingForCall(true);
                NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
            }
            this.waitingForEvent = true;
            if (this.verificationType != 3) {
                AlertsCreator.processError(PassportActivity.this.currentAccount, tL_error, PassportActivity.this, tL_account_verifyPhone, new Object[0]);
            }
            PassportActivity.this.showEditDoneProgress(true, false);
            if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) {
                int i4 = 0;
                while (true) {
                    EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                    if (i4 < editTextBoldCursorArr.length) {
                        editTextBoldCursorArr[i4].setText("");
                        i4++;
                    } else {
                        editTextBoldCursorArr[0].requestFocus();
                        return;
                    }
                }
            } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                onBackPressed(true);
                PassportActivity.this.setPage(0, true, null);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            if (!z) {
                AlertDialog.Builder builder = new AlertDialog.Builder(PassportActivity.this.getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("StopVerification", R.string.StopVerification));
                builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null);
                builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                    /* class im.guobwnxjuc.ui.$$Lambda$PassportActivity$PhoneConfirmationView$Eio6dwFkn53s8c66XopzByMlit8 */

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        PassportActivity.PhoneConfirmationView.this.lambda$onBackPressed$8$PassportActivity$PhoneConfirmationView(dialogInterface, i);
                    }
                });
                PassportActivity.this.showDialog(builder.create());
                return false;
            }
            TLRPC.TL_auth_cancelCode tL_auth_cancelCode = new TLRPC.TL_auth_cancelCode();
            tL_auth_cancelCode.phone_number = this.phone;
            tL_auth_cancelCode.phone_code_hash = this.phoneHash;
            ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_auth_cancelCode, $$Lambda$PassportActivity$PhoneConfirmationView$cBlOUK6fMBQmf5U13ebfVDVb4U.INSTANCE, 2);
            destroyTimer();
            destroyCodeTimer();
            this.currentParams = null;
            int i = this.verificationType;
            if (i == 2) {
                AndroidUtilities.setWaitingForSms(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
            } else if (i == 3) {
                AndroidUtilities.setWaitingForCall(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
            }
            this.waitingForEvent = false;
            return true;
        }

        public /* synthetic */ void lambda$onBackPressed$8$PassportActivity$PhoneConfirmationView(DialogInterface dialogInterface, int i) {
            onBackPressed(true);
            PassportActivity.this.setPage(0, true, null);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onDestroyActivity() {
            super.onDestroyActivity();
            int i = this.verificationType;
            if (i == 2) {
                AndroidUtilities.setWaitingForSms(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
            } else if (i == 3) {
                AndroidUtilities.setWaitingForCall(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
            }
            this.waitingForEvent = false;
            destroyTimer();
            destroyCodeTimer();
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            LinearLayout linearLayout = this.codeFieldContainer;
            if (linearLayout != null && linearLayout.getVisibility() == 0) {
                for (int length2 = this.codeField.length - 1; length2 >= 0; length2--) {
                    if (length2 == 0 || this.codeField[length2].length() != 0) {
                        this.codeField[length2].requestFocus();
                        EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                        editTextBoldCursorArr[length2].setSelection(editTextBoldCursorArr[length2].length());
                        AndroidUtilities.showKeyboard(this.codeField[length2]);
                        return;
                    }
                }
            }
        }

        @Override // im.guobwnxjuc.messenger.NotificationCenter.NotificationCenterDelegate
        public void didReceivedNotification(int i, int i2, Object... objArr) {
            if (this.waitingForEvent && this.codeField != null) {
                if (i == NotificationCenter.didReceiveSmsCode) {
                    this.codeField[0].setText("" + objArr[0]);
                    onNextPressed();
                } else if (i == NotificationCenter.didReceiveCall) {
                    String str = "" + objArr[0];
                    if (AndroidUtilities.checkPhonePattern(this.pattern, str)) {
                        this.ignoreOnTextChange = true;
                        this.codeField[0].setText(str);
                        this.ignoreOnTextChange = false;
                        onNextPressed();
                    }
                }
            }
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public ThemeDescription[] getThemeDescriptions() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
        arrayList.add(new ThemeDescription(this.scrollView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
        arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider));
        arrayList.add(new ThemeDescription(this.extraBackgroundView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
        View view = this.extraBackgroundView2;
        if (view != null) {
            arrayList.add(new ThemeDescription(view, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
        }
        for (int i = 0; i < this.dividers.size(); i++) {
            arrayList.add(new ThemeDescription(this.dividers.get(i), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_divider));
        }
        for (Map.Entry<SecureDocument, SecureDocumentCell> entry : this.documentsCells.entrySet()) {
            SecureDocumentCell value = entry.getValue();
            arrayList.add(new ThemeDescription(value, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{SecureDocumentCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
            arrayList.add(new ThemeDescription(value, 0, new Class[]{SecureDocumentCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
            arrayList.add(new ThemeDescription(value, 0, new Class[]{SecureDocumentCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
        }
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSettingsCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextSettingsCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteValueText));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSecureCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, null, null, null, Theme.key_divider));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"checkImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_featuredStickers_addedIcon));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{HeaderCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueHeader));
        arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
        arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText4));
        if (this.inputFields != null) {
            int i2 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
                if (i2 >= editTextBoldCursorArr.length) {
                    break;
                }
                arrayList.add(new ThemeDescription((View) editTextBoldCursorArr[i2].getParent(), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(this.inputFields[i2], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteRedText3));
                i2++;
            }
        } else {
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
            arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteRedText3));
        }
        if (this.inputExtraFields != null) {
            int i3 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputExtraFields;
                if (i3 >= editTextBoldCursorArr2.length) {
                    break;
                }
                arrayList.add(new ThemeDescription((View) editTextBoldCursorArr2[i3].getParent(), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(this.inputExtraFields[i3], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteRedText3));
                i3++;
            }
        }
        arrayList.add(new ThemeDescription(this.emptyView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
        arrayList.add(new ThemeDescription(this.noPasswordImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_messagePanelIcons));
        arrayList.add(new ThemeDescription(this.noPasswordTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
        arrayList.add(new ThemeDescription(this.noPasswordSetTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText5));
        arrayList.add(new ThemeDescription(this.passwordForgotButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
        arrayList.add(new ThemeDescription(this.plusTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
        arrayList.add(new ThemeDescription(this.acceptTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_passport_authorizeText));
        arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_passport_authorizeBackground));
        arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_passport_authorizeBackgroundSelected));
        arrayList.add(new ThemeDescription(this.progressView, 0, null, null, null, null, Theme.key_contextProgressInner2));
        arrayList.add(new ThemeDescription(this.progressView, 0, null, null, null, null, Theme.key_contextProgressOuter2));
        arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, Theme.key_contextProgressInner2));
        arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, Theme.key_contextProgressOuter2));
        arrayList.add(new ThemeDescription(this.emptyImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_sessions_devicesImage));
        arrayList.add(new ThemeDescription(this.emptyTextView1, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
        arrayList.add(new ThemeDescription(this.emptyTextView2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
        arrayList.add(new ThemeDescription(this.emptyTextView3, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
        return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]);
    }
}