歌尔基办 v2.7.0版本的 MD5 值为:921fd7c85ec097e8cab7f049269b36e4
以下内容为反编译后的 PassportActivity.java 源代码,内容仅作参考
package im.ovithmjoec.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.ovithmjoec.messenger.AndroidUtilities;
import im.ovithmjoec.messenger.ApplicationLoader;
import im.ovithmjoec.messenger.BuildVars;
import im.ovithmjoec.messenger.DispatchQueue;
import im.ovithmjoec.messenger.DownloadController;
import im.ovithmjoec.messenger.FileLoader;
import im.ovithmjoec.messenger.FileLog;
import im.ovithmjoec.messenger.ImageLoader;
import im.ovithmjoec.messenger.ImageLocation;
import im.ovithmjoec.messenger.LocaleController;
import im.ovithmjoec.messenger.MediaController;
import im.ovithmjoec.messenger.MessageObject;
import im.ovithmjoec.messenger.MrzRecognizer;
import im.ovithmjoec.messenger.NotificationCenter;
import im.ovithmjoec.messenger.R;
import im.ovithmjoec.messenger.SRPHelper;
import im.ovithmjoec.messenger.SecureDocument;
import im.ovithmjoec.messenger.SecureDocumentKey;
import im.ovithmjoec.messenger.SendMessagesHelper;
import im.ovithmjoec.messenger.SharedConfig;
import im.ovithmjoec.messenger.UserConfig;
import im.ovithmjoec.messenger.UserObject;
import im.ovithmjoec.messenger.Utilities;
import im.ovithmjoec.messenger.browser.Browser;
import im.ovithmjoec.phoneformat.PhoneFormat;
import im.ovithmjoec.tgnet.ConnectionsManager;
import im.ovithmjoec.tgnet.RequestDelegate;
import im.ovithmjoec.tgnet.TLObject;
import im.ovithmjoec.tgnet.TLRPC;
import im.ovithmjoec.ui.CountrySelectActivity;
import im.ovithmjoec.ui.DocumentSelectActivity;
import im.ovithmjoec.ui.MrzCameraActivity;
import im.ovithmjoec.ui.PassportActivity;
import im.ovithmjoec.ui.PhotoAlbumPickerActivity;
import im.ovithmjoec.ui.PhotoViewer;
import im.ovithmjoec.ui.actionbar.ActionBar;
import im.ovithmjoec.ui.actionbar.ActionBarMenuItem;
import im.ovithmjoec.ui.actionbar.AlertDialog;
import im.ovithmjoec.ui.actionbar.BaseFragment;
import im.ovithmjoec.ui.actionbar.Theme;
import im.ovithmjoec.ui.actionbar.ThemeDescription;
import im.ovithmjoec.ui.cells.CheckBoxCell;
import im.ovithmjoec.ui.cells.HeaderCell;
import im.ovithmjoec.ui.cells.ShadowSectionCell;
import im.ovithmjoec.ui.cells.TextDetailSettingsCell;
import im.ovithmjoec.ui.cells.TextInfoPrivacyCell;
import im.ovithmjoec.ui.cells.TextSettingsCell;
import im.ovithmjoec.ui.components.AlertsCreator;
import im.ovithmjoec.ui.components.AvatarDrawable;
import im.ovithmjoec.ui.components.BackupImageView;
import im.ovithmjoec.ui.components.ChatAttachAlert;
import im.ovithmjoec.ui.components.ContextProgressView;
import im.ovithmjoec.ui.components.EditTextBoldCursor;
import im.ovithmjoec.ui.components.EmptyTextProgressView;
import im.ovithmjoec.ui.components.HintEditText;
import im.ovithmjoec.ui.components.LayoutHelper;
import im.ovithmjoec.ui.components.RadialProgress;
import im.ovithmjoec.ui.components.SlideView;
import im.ovithmjoec.ui.components.URLSpanNoUnderline;
import im.ovithmjoec.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;
public interface ErrorRunnable {
void onError(String str, String str2);
}
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() {
}
@Override
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setUnderlineText(true);
textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
}
@Override
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 = PassportActivity.this.currentActivityType == 8 ? 21 : 51;
TextView textView = new TextView(context);
this.textView = textView;
textView.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);
addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? i : 21, 10.0f, LocaleController.isRTL ? 21 : i, 0.0f));
TextView textView2 = new TextView(context);
this.valueTextView = textView2;
textView2.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, LocaleController.isRTL ? i : 21, 35.0f, LocaleController.isRTL ? 21 : 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 : 5) | 48, 21.0f, 25.0f, 21.0f, 0.0f));
}
@Override
protected 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();
}
@Override
protected void onDraw(Canvas canvas) {
if (this.needDivider) {
canvas.drawLine(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}
}
}
public class SecureDocumentCell extends FrameLayout implements DownloadController.FileDownloadProgressListener {
private int TAG;
private int buttonState;
private SecureDocument currentSecureDocument;
private BackupImageView imageView;
private RadialProgress radialProgress;
private TextView textView;
private TextView valueTextView;
public SecureDocumentCell(Context context) {
super(context);
this.TAG = DownloadController.getInstance(PassportActivity.this.currentAccount).generateObserverTag();
this.radialProgress = new RadialProgress(this);
BackupImageView backupImageView = new BackupImageView(context);
this.imageView = backupImageView;
addView(backupImageView, LayoutHelper.createFrame(48.0f, 48.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 8.0f, 21.0f, 0.0f));
TextView textView = new TextView(context);
this.textView = textView;
textView.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);
addView(this.textView, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 21 : 81, 10.0f, LocaleController.isRTL ? 81 : 21, 0.0f));
TextView textView2 = new TextView(context);
this.valueTextView = textView2;
textView2.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 ? 5 : 3) | 48, LocaleController.isRTL ? 21 : 81, 35.0f, LocaleController.isRTL ? 81 : 21, 0.0f));
setWillNotDraw(false);
}
@Override
protected 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));
}
@Override
protected 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);
}
@Override
protected 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;
}
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);
this.radialProgress.setProgress(fileProgress != null ? fileProgress.floatValue() : 0.0f, 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);
this.radialProgress.setProgress(fileProgress2 != null ? fileProgress2.floatValue() : 0.0f, z);
invalidate();
}
}
@Override
public void invalidate() {
super.invalidate();
this.textView.invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawLine(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}
@Override
public void onFailedDownload(String str, boolean z) {
updateButtonState(false);
}
@Override
public void onSuccessDownload(String str) {
this.radialProgress.setProgress(1.0f, true);
updateButtonState(true);
}
@Override
public void onProgressDownload(String str, float f) {
this.radialProgress.setProgress(f, true);
if (this.buttonState != 1) {
updateButtonState(false);
}
}
@Override
public void onProgressUpload(String str, float f, boolean z) {
this.radialProgress.setProgress(f, true);
}
@Override
public int getObserverTag() {
return this.TAG;
}
}
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;
boolean z;
String nameForType;
String str6;
byte[] bArr;
String str7;
String str8;
HashMap<String, String> hashMap;
char c;
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()) {
return;
}
try {
Collections.sort(tL_account_authorizationForm.errors, new Comparator<TLRPC.SecureValueError>() {
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;
}
@Override
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 str9 = null;
str9 = null;
str9 = null;
str9 = null;
str9 = null;
r6 = null;
str9 = null;
byte[] bArr2 = null;
if (secureValueError instanceof TLRPC.TL_secureValueErrorFrontSide) {
TLRPC.TL_secureValueErrorFrontSide tL_secureValueErrorFrontSide = (TLRPC.TL_secureValueErrorFrontSide) secureValueError;
nameForType = getNameForType(tL_secureValueErrorFrontSide.type);
str6 = tL_secureValueErrorFrontSide.text;
bArr = tL_secureValueErrorFrontSide.file_hash;
str7 = "front";
} else if (secureValueError instanceof TLRPC.TL_secureValueErrorReverseSide) {
TLRPC.TL_secureValueErrorReverseSide tL_secureValueErrorReverseSide = (TLRPC.TL_secureValueErrorReverseSide) secureValueError;
nameForType = getNameForType(tL_secureValueErrorReverseSide.type);
str6 = tL_secureValueErrorReverseSide.text;
bArr = tL_secureValueErrorReverseSide.file_hash;
str7 = "reverse";
} else if (secureValueError instanceof TLRPC.TL_secureValueErrorSelfie) {
TLRPC.TL_secureValueErrorSelfie tL_secureValueErrorSelfie = (TLRPC.TL_secureValueErrorSelfie) secureValueError;
nameForType = getNameForType(tL_secureValueErrorSelfie.type);
str6 = tL_secureValueErrorSelfie.text;
bArr = tL_secureValueErrorSelfie.file_hash;
str7 = "selfie";
} else if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFile) {
TLRPC.TL_secureValueErrorTranslationFile tL_secureValueErrorTranslationFile = (TLRPC.TL_secureValueErrorTranslationFile) secureValueError;
nameForType = getNameForType(tL_secureValueErrorTranslationFile.type);
str6 = tL_secureValueErrorTranslationFile.text;
bArr = tL_secureValueErrorTranslationFile.file_hash;
str7 = "translation";
} else {
if (secureValueError instanceof TLRPC.TL_secureValueErrorTranslationFiles) {
TLRPC.TL_secureValueErrorTranslationFiles tL_secureValueErrorTranslationFiles = (TLRPC.TL_secureValueErrorTranslationFiles) secureValueError;
nameForType = getNameForType(tL_secureValueErrorTranslationFiles.type);
str6 = tL_secureValueErrorTranslationFiles.text;
str8 = null;
str7 = "translation";
} else if (secureValueError instanceof TLRPC.TL_secureValueErrorFile) {
TLRPC.TL_secureValueErrorFile tL_secureValueErrorFile = (TLRPC.TL_secureValueErrorFile) secureValueError;
nameForType = getNameForType(tL_secureValueErrorFile.type);
str6 = tL_secureValueErrorFile.text;
bArr = tL_secureValueErrorFile.file_hash;
str7 = "files";
} else if (secureValueError instanceof TLRPC.TL_secureValueErrorFiles) {
TLRPC.TL_secureValueErrorFiles tL_secureValueErrorFiles = (TLRPC.TL_secureValueErrorFiles) secureValueError;
nameForType = getNameForType(tL_secureValueErrorFiles.type);
str6 = tL_secureValueErrorFiles.text;
str8 = null;
str7 = "files";
} else if (secureValueError instanceof TLRPC.TL_secureValueError) {
TLRPC.TL_secureValueError tL_secureValueError = (TLRPC.TL_secureValueError) secureValueError;
nameForType = getNameForType(tL_secureValueError.type);
str6 = tL_secureValueError.text;
bArr = tL_secureValueError.hash;
str7 = "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) {
nameForType = getNameForType(tL_secureValueErrorData.type);
str6 = tL_secureValueErrorData.text;
str9 = tL_secureValueErrorData.field;
bArr = tL_secureValueErrorData.data_hash;
str7 = "data";
}
}
i3 = size;
i4++;
size = i3;
}
hashMap = this.errorsMap.get(nameForType);
if (hashMap != null) {
hashMap = new HashMap<>();
i3 = size;
this.errorsMap.put(nameForType, hashMap);
this.mainErrorsMap.put(nameForType, str6);
} else {
i3 = size;
}
c = 2;
String encodeToString = bArr2 == null ? Base64.encodeToString(bArr2, 2) : "";
switch (str7.hashCode()) {
case -1840647503:
if (str7.equals("translation")) {
c = 3;
break;
}
c = 65535;
break;
case -906020504:
if (str7.equals("selfie")) {
break;
}
c = 65535;
break;
case 3076010:
if (str7.equals("data")) {
c = 0;
break;
}
c = 65535;
break;
case 97434231:
if (str7.equals("files")) {
c = 1;
break;
}
c = 65535;
break;
case 97705513:
if (str7.equals("front")) {
c = 4;
break;
}
c = 65535;
break;
case 329856746:
if (str7.equals("error_all")) {
c = 6;
break;
}
c = 65535;
break;
case 1099846370:
if (str7.equals("reverse")) {
c = 5;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
if (str8 != null) {
hashMap.put(str8, str6);
break;
} else {
continue;
continue;
}
case 1:
if (bArr2 != null) {
hashMap.put("files" + encodeToString, str6);
continue;
continue;
} else {
hashMap.put("files_all", str6);
break;
}
case 2:
hashMap.put("selfie" + encodeToString, str6);
continue;
continue;
case 3:
if (bArr2 != null) {
hashMap.put("translation" + encodeToString, str6);
continue;
continue;
} else {
hashMap.put("translation_all", str6);
break;
}
case 4:
hashMap.put("front" + encodeToString, str6);
continue;
continue;
case 5:
hashMap.put("reverse" + encodeToString, str6);
continue;
continue;
case 6:
hashMap.put("error_all", str6);
continue;
continue;
default:
continue;
continue;
}
i4++;
size = i3;
}
String str10 = str9;
bArr2 = bArr;
str8 = str10;
hashMap = this.errorsMap.get(nameForType);
if (hashMap != null) {
}
c = 2;
if (bArr2 == null) {
}
switch (str7.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() {
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i2, boolean z) {
if (i2 < 0 || i2 >= PassportActivity.this.currentPhotoViewerLayout.getChildCount()) {
return null;
}
SecureDocumentCell secureDocumentCell = (SecureDocumentCell) PassportActivity.this.currentPhotoViewerLayout.getChildAt(i2);
int[] iArr = new int[2];
secureDocumentCell.imageView.getLocationInWindow(iArr);
PhotoViewer.PlaceProviderObject placeProviderObject = new PhotoViewer.PlaceProviderObject();
placeProviderObject.viewX = iArr[0];
placeProviderObject.viewY = iArr[1] - (Build.VERSION.SDK_INT < 21 ? AndroidUtilities.statusBarHeight : 0);
placeProviderObject.parentView = PassportActivity.this.currentPhotoViewerLayout;
placeProviderObject.imageReceiver = secureDocumentCell.imageView.getImageReceiver();
placeProviderObject.thumb = placeProviderObject.imageReceiver.getBitmapSafe();
return placeProviderObject;
}
@Override
public void deleteImageAtIndex(int i2) {
SecureDocument secureDocument = PassportActivity.this.uploadingFileType == 1 ? PassportActivity.this.selfieDocument : PassportActivity.this.uploadingFileType == 4 ? (SecureDocument) PassportActivity.this.translationDocuments.get(i2) : PassportActivity.this.uploadingFileType == 2 ? PassportActivity.this.frontDocument : PassportActivity.this.uploadingFileType == 3 ? PassportActivity.this.reverseDocument : (SecureDocument) PassportActivity.this.documents.get(i2);
SecureDocumentCell secureDocumentCell = (SecureDocumentCell) PassportActivity.this.documentsCells.remove(secureDocument);
if (secureDocumentCell == null) {
return;
}
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) {
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;
}
} else {
str = "translation" + 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
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()) {
return;
}
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, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.lambda$null$0(TLObject.this);
}
});
}
});
}
}
public static 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
public void onResume() {
ViewGroup[] viewGroupArr;
super.onResume();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onResume();
}
if (this.currentActivityType == 5 && (viewGroupArr = this.inputFieldContainers) != null && viewGroupArr[0] != null && viewGroupArr[0].getVisibility() == 0) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$onResume$2$PassportActivity();
}
}, 200L);
}
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
}
public void lambda$onResume$2$PassportActivity() {
ViewGroup[] viewGroupArr = this.inputFieldContainers;
if (viewGroupArr == null || viewGroupArr[0] == null || viewGroupArr[0].getVisibility() != 0) {
return;
}
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
@Override
public void onPause() {
super.onPause();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onPause();
}
}
@Override
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
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 chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.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
public View createView(Context context) {
ChatAttachAlert chatAttachAlert;
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
this.actionBar.setAllowOverlayTitle(true);
this.actionBar.setActionBarMenuOnItemClick(new AnonymousClass3());
if (this.currentActivityType == 7) {
ScrollView scrollView = new ScrollView(context) {
@Override
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
return false;
}
@Override
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);
}
@Override
protected void onMeasure(int i, int i2) {
PassportActivity.this.scrollHeight = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
super.onMeasure(i, i2);
}
};
this.scrollView = scrollView;
this.fragmentView = scrollView;
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));
ScrollView scrollView2 = new ScrollView(context) {
@Override
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
return false;
}
@Override
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 = scrollView2;
scrollView2.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) && (chatAttachAlert = this.chatAttachAlert) != null) {
try {
if (chatAttachAlert.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;
}
public class AnonymousClass3 extends ActionBar.ActionBarMenuOnItemClick {
AnonymousClass3() {
}
private boolean onIdentityDone(final Runnable runnable, final ErrorRunnable errorRunnable) {
JSONObject jSONObject;
JSONObject jSONObject2;
String obj;
String obj2;
String obj3;
if (!PassportActivity.this.uploadingDocuments.isEmpty() || PassportActivity.this.checkFieldsForError()) {
return false;
}
if (PassportActivity.this.allowNonLatinName) {
PassportActivity.this.allowNonLatinName = false;
boolean z = false;
for (final 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;
obj = passportActivity.getTranslitString(passportActivity.inputExtraFields[0].getText().toString());
} else {
obj = PassportActivity.this.inputFields[0].getText().toString();
}
final String str = obj;
if (PassportActivity.this.nonLatinNames[1]) {
PassportActivity passportActivity2 = PassportActivity.this;
obj2 = passportActivity2.getTranslitString(passportActivity2.inputExtraFields[1].getText().toString());
} else {
obj2 = PassportActivity.this.inputFields[1].getText().toString();
}
final String str2 = obj2;
if (PassportActivity.this.nonLatinNames[2]) {
PassportActivity passportActivity3 = PassportActivity.this;
obj3 = passportActivity3.getTranslitString(passportActivity3.inputExtraFields[2].getText().toString());
} else {
obj3 = PassportActivity.this.inputFields[2].getText().toString();
}
final String str3 = obj3;
if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$0$PassportActivity$3(str, str2, str3, runnable, errorRunnable, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Edit", R.string.Edit), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$1$PassportActivity$3(i, dialogInterface, i2);
}
});
PassportActivity.this.showDialog(builder.create());
} else {
PassportActivity passportActivity4 = PassportActivity.this;
passportActivity4.onFieldError(passportActivity4.inputFields[i]);
}
z = true;
}
}
}
if (z) {
return false;
}
}
if (!PassportActivity.this.isHasNotAnyChanges()) {
SecureDocument secureDocument = null;
try {
if (PassportActivity.this.documentOnly) {
jSONObject = null;
} else {
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);
jSONObject = new JSONObject();
try {
ArrayList arrayList = new ArrayList(hashMap.keySet());
Collections.sort(arrayList, new Comparator() {
@Override
public final int compare(Object obj4, Object obj5) {
return PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$2$PassportActivity$3((String) obj4, (String) obj5);
}
});
int size = arrayList.size();
for (int i2 = 0; i2 < size; i2++) {
String str4 = (String) arrayList.get(i2);
jSONObject.put(str4, hashMap.get(str4));
}
} catch (Exception unused) {
}
}
} catch (Exception unused2) {
jSONObject = null;
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", "");
}
jSONObject2 = new JSONObject();
try {
ArrayList arrayList2 = new ArrayList(hashMap2.keySet());
Collections.sort(arrayList2, new Comparator() {
@Override
public final int compare(Object obj4, Object obj5) {
return PassportActivity.AnonymousClass3.this.lambda$onIdentityDone$3$PassportActivity$3((String) obj4, (String) obj5);
}
});
int size2 = arrayList2.size();
for (int i3 = 0; i3 < size2; i3++) {
String str5 = (String) arrayList2.get(i3);
jSONObject2.put(str5, hashMap2.get(str5));
}
} catch (Exception unused3) {
}
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 = jSONObject == null ? jSONObject.toString() : null;
TLRPC.TL_secureRequiredType tL_secureRequiredType2 = PassportActivity.this.currentDocumentsType;
String jSONObject4 = jSONObject2 == null ? jSONObject2.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;
}
jSONObject2 = 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 (jSONObject == null) {
}
TLRPC.TL_secureRequiredType tL_secureRequiredType22 = PassportActivity.this.currentDocumentsType;
if (jSONObject2 == null) {
}
SecureDocument secureDocument22 = PassportActivity.this.selfieDocument;
ArrayList<SecureDocument> arrayList32 = PassportActivity.this.translationDocuments;
SecureDocument secureDocument32 = PassportActivity.this.frontDocument;
if (PassportActivity.this.reverseLayout != null) {
secureDocument = PassportActivity.this.reverseDocument;
}
passportActivityDelegate2.saveValue(tL_secureRequiredType3, null, jSONObject3, tL_secureRequiredType22, jSONObject4, null, secureDocument22, arrayList32, secureDocument32, secureDocument, runnable, errorRunnable);
return true;
}
PassportActivity.this.finishFragment();
return false;
}
public 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 void lambda$onIdentityDone$1$PassportActivity$3(int i, DialogInterface dialogInterface, int i2) {
PassportActivity passportActivity = PassportActivity.this;
passportActivity.onFieldError(passportActivity.inputFields[i]);
}
public 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 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;
}
@Override
public void onItemClick(int i) {
JSONObject jSONObject;
String str;
String obj;
if (i == -1) {
if (PassportActivity.this.checkDiscard()) {
return;
}
if (PassportActivity.this.currentActivityType == 0 || PassportActivity.this.currentActivityType == 5) {
PassportActivity.this.callCallback(false);
}
PassportActivity.this.finishFragment();
return;
}
if (i == 1) {
if (PassportActivity.this.getParentActivity() == null) {
return;
}
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)) {
@Override
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) {
if (PassportActivity.this.currentActivityType == 5) {
PassportActivity.this.onPasswordDone(false);
} else if (PassportActivity.this.currentActivityType == 7) {
PassportActivity.this.views[PassportActivity.this.currentViewNum].onNextPressed();
} else {
final Runnable runnable = new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass3.this.lambda$onItemClick$4$PassportActivity$3();
}
};
final ErrorRunnable errorRunnable = new ErrorRunnable() {
@Override
public void onError(String str2, String str3) {
if ("PHONE_VERIFICATION_NEEDED".equals(str2)) {
PassportActivity.this.startPhoneVerification(true, str3, runnable, 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()) {
return;
} else {
obj = PassportActivity.this.inputFields[0].getText().toString();
}
PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, obj, null, null, null, null, null, null, null, null, runnable, errorRunnable);
} else if (PassportActivity.this.currentActivityType == 3) {
if (PassportActivity.this.useCurrentValue) {
str = UserConfig.getInstance(PassportActivity.this.currentAccount).getCurrentUser().phone;
} else if (PassportActivity.this.checkFieldsForError()) {
return;
} else {
str = PassportActivity.this.inputFields[1].getText().toString() + PassportActivity.this.inputFields[2].getText().toString();
}
PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, str, null, null, null, null, null, null, null, null, runnable, errorRunnable);
} else if (PassportActivity.this.currentActivityType == 2) {
if (!PassportActivity.this.uploadingDocuments.isEmpty() || PassportActivity.this.checkFieldsForError()) {
return;
}
if (!PassportActivity.this.isHasNotAnyChanges()) {
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();
}
PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, null, jSONObject != null ? jSONObject.toString() : null, PassportActivity.this.currentDocumentsType, null, PassportActivity.this.documents, PassportActivity.this.selfieDocument, PassportActivity.this.translationDocuments, null, null, runnable, errorRunnable);
}
jSONObject = null;
if (PassportActivity.this.fieldsErrors != null) {
}
if (PassportActivity.this.documentsErrors != null) {
}
PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, null, jSONObject != null ? jSONObject.toString() : null, PassportActivity.this.currentDocumentsType, null, PassportActivity.this.documents, PassportActivity.this.selfieDocument, PassportActivity.this.translationDocuments, null, null, runnable, errorRunnable);
} else {
PassportActivity.this.finishFragment();
return;
}
} else if (PassportActivity.this.currentActivityType != 1) {
if (PassportActivity.this.currentActivityType == 6) {
final 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass3.this.lambda$onItemClick$6$PassportActivity$3(runnable, errorRunnable, tL_account_verifyEmail, tLObject, tL_error);
}
}), PassportActivity.this.classGuid);
}
} else if (!onIdentityDone(runnable, errorRunnable)) {
return;
}
PassportActivity.this.showEditDoneProgress(true, true);
}
}
}
public void lambda$onItemClick$4$PassportActivity$3() {
PassportActivity.this.finishFragment();
}
public void lambda$onItemClick$6$PassportActivity$3(final Runnable runnable, final ErrorRunnable errorRunnable, final TLRPC.TL_account_verifyEmail tL_account_verifyEmail, TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass3.this.lambda$null$5$PassportActivity$3(tL_error, runnable, errorRunnable, tL_account_verifyEmail);
}
});
}
public 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);
}
}
@Override
public boolean dismissDialogOnPause(Dialog dialog) {
return dialog != this.chatAttachAlert && super.dismissDialogOnPause(dialog);
}
@Override
public void dismissCurrentDialog() {
if (this.chatAttachAlert != null) {
Dialog dialog = this.visibleDialog;
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (dialog == chatAttachAlert) {
chatAttachAlert.closeCamera(false);
this.chatAttachAlert.dismissInternal();
this.chatAttachAlert.hideCamera(true);
return;
}
}
super.dismissCurrentDialog();
}
public String getTranslitString(String str) {
return LocaleController.getInstance().getTranslitString(str, true);
}
public 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$loadPasswordInfo$4$PassportActivity(tLObject, tL_error);
}
}), this.classGuid);
}
public void lambda$loadPasswordInfo$4$PassportActivity(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$3$PassportActivity(tLObject);
}
});
}
public 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() {
@Override
public final boolean onEditorAction(TextView textView, int i3, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createEmailVerificationInterface$5$PassportActivity(textView, i3, keyEvent);
}
});
this.inputFields[i].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void afterTextChanged(Editable editable) {
if (PassportActivity.this.ignoreOnTextChange || PassportActivity.this.emailCodeLength == 0 || PassportActivity.this.inputFields[0].length() != PassportActivity.this.emailCodeLength) {
return;
}
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 boolean lambda$createEmailVerificationInterface$5$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 6 || i == 5) {
this.doneItem.callOnClick();
return true;
}
return false;
}
private void createPasswordInterface(Context context) {
TLRPC.User currentUser;
if (this.currentForm != null) {
int i = 0;
while (true) {
if (i >= this.currentForm.users.size()) {
currentUser = null;
break;
}
currentUser = this.currentForm.users.get(i);
if (currentUser.id == this.currentBotId) {
break;
}
i++;
}
} else {
currentUser = 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(currentUser, false), "50_50", new AvatarDrawable(currentUser), currentUser);
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(currentUser))));
}
((FrameLayout.LayoutParams) this.passwordRequestTextView.getTextView().getLayoutParams()).gravity = 1;
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() {
@Override
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 i2 = 0; i2 < 1; i2++) {
this.inputFieldContainers[i2] = new FrameLayout(context);
this.linearLayout2.addView(this.inputFieldContainers[i2], LayoutHelper.createLinear(-1, 50));
this.inputFieldContainers[i2].setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
this.inputFields[i2] = new EditTextBoldCursor(context);
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);
this.inputFields[i2].setInputType(TsExtractor.TS_STREAM_TYPE_AC3);
this.inputFields[i2].setMaxLines(1);
this.inputFields[i2].setLines(1);
this.inputFields[i2].setSingleLine(true);
this.inputFields[i2].setTransformationMethod(PasswordTransformationMethod.getInstance());
this.inputFields[i2].setTypeface(Typeface.DEFAULT);
this.inputFields[i2].setImeOptions(268435462);
this.inputFields[i2].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
this.inputFields[i2].setGravity(LocaleController.isRTL ? 5 : 3);
this.inputFieldContainers[i2].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() {
@Override
public final boolean onEditorAction(TextView textView3, int i3, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createPasswordInterface$7$PassportActivity(textView3, i3, keyEvent);
}
});
this.inputFields[i2].setCustomSelectionActionModeCallback(new ActionMode.Callback() {
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return false;
}
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
}
@Override
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);
this.linearLayout2.addView(this.passwordForgotButton, LayoutHelper.createLinear(-2, 30, (LocaleController.isRTL ? 5 : 3) | 48, 21, 0, 21, 0));
this.passwordForgotButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$createPasswordInterface$12$PassportActivity(view);
}
});
updatePasswordInterface();
}
public 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 boolean lambda$createPasswordInterface$7$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5 || i == 6) {
this.doneItem.callOnClick();
return true;
}
return false;
}
public void lambda$createPasswordInterface$12$PassportActivity(View view) {
if (this.currentPassword.has_recovery) {
needShowProgress();
ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(new TLRPC.TL_auth_requestPasswordRecovery(), new RequestDelegate() {
@Override
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) {
} else {
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() {
@Override
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 void lambda$null$10$PassportActivity(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$9$PassportActivity(tL_error, tLObject);
}
});
}
public void lambda$null$9$PassportActivity(TLRPC.TL_error tL_error, TLObject tLObject) {
String formatPluralString;
needHideProgress();
if (tL_error == null) {
final 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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.this.lambda$null$8$PassportActivity(tL_auth_passwordRecovery, 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) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60);
}
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, formatPluralString));
} else {
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
}
}
public 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 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());
}
public void onPasswordDone(final boolean z) {
final String obj;
if (z) {
obj = null;
} else {
obj = this.inputFields[0].getText().toString();
if (TextUtils.isEmpty(obj)) {
onPasscodeError(false);
return;
}
showEditDoneProgress(true, true);
}
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$onPasswordDone$13$PassportActivity(z, obj);
}
});
}
public void lambda$onPasswordDone$13$PassportActivity(boolean z, String str) {
byte[] bArr;
byte[] x;
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 anonymousClass8 = new AnonymousClass8(z, bArr, tL_account_getPasswordSettings, str);
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";
anonymousClass8.run(null, tL_error);
return;
}
ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_getPasswordSettings, anonymousClass8, 10), this.classGuid);
return;
}
TLRPC.TL_error tL_error2 = new TLRPC.TL_error();
tL_error2.text = "PASSWORD_HASH_INVALID";
anonymousClass8.run(null, tL_error2);
return;
}
bArr = x;
AnonymousClass8 anonymousClass82 = new AnonymousClass8(z, bArr, tL_account_getPasswordSettings, str);
if (!(this.currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
}
}
public class AnonymousClass8 implements RequestDelegate {
final TLRPC.TL_account_getPasswordSettings val$req;
final boolean val$saved;
final String val$textPassword;
final byte[] val$x_bytes;
AnonymousClass8(boolean z, byte[] bArr, TLRPC.TL_account_getPasswordSettings tL_account_getPasswordSettings, String str) {
this.val$saved = z;
this.val$x_bytes = bArr;
this.val$req = tL_account_getPasswordSettings;
this.val$textPassword = str;
}
private void openRequestInterface() {
if (PassportActivity.this.inputFields == null) {
return;
}
if (!this.val$saved) {
UserConfig.getInstance(PassportActivity.this.currentAccount).savePassword(this.val$x_bytes, 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.presentAfterAnimation = passportActivity;
} else {
PassportActivity.this.presentFragment(passportActivity, true);
}
}
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(this.val$x_bytes, 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 = 0L;
tL_account_updatePasswordSettings.new_settings.flags |= 4;
ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(this.val$req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$resetSecret$3$PassportActivity$8(tLObject, tL_error);
}
});
}
public void lambda$resetSecret$3$PassportActivity$8(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$2$PassportActivity$8(tL_error);
}
});
}
public void lambda$null$2$PassportActivity$8(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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass8.this.lambda$null$1$PassportActivity$8(tLObject, tL_error2);
}
}, 8);
return;
}
generateNewSecret();
}
public void lambda$null$1$PassportActivity$8(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$0$PassportActivity$8(tL_error, tLObject);
}
});
}
public 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() {
DispatchQueue dispatchQueue = Utilities.globalQueue;
final byte[] bArr = this.val$x_bytes;
final String str = this.val$textPassword;
dispatchQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$8$PassportActivity$8(bArr, str);
}
});
}
public 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$null$7$PassportActivity$8(tLObject, tL_error);
}
});
}
public void lambda$null$7$PassportActivity$8(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$6$PassportActivity$8(tL_error);
}
});
}
public 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass8.this.lambda$null$5$PassportActivity$8(tLObject, tL_error2);
}
}, 8);
}
public void lambda$null$5$PassportActivity$8(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$4$PassportActivity$8(tL_error, tLObject);
}
});
}
public 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
public void run(final TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
TLRPC.TL_account_getPassword tL_account_getPassword = new TLRPC.TL_account_getPassword();
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(PassportActivity.this.currentAccount);
final boolean z = this.val$saved;
connectionsManager.sendRequest(tL_account_getPassword, new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass8.this.lambda$run$10$PassportActivity$8(z, tLObject2, tL_error2);
}
}, 8);
} else if (tL_error == null) {
DispatchQueue dispatchQueue = Utilities.globalQueue;
final String str = this.val$textPassword;
final boolean z2 = this.val$saved;
dispatchQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$15$PassportActivity$8(tLObject, str, z2);
}
});
} else {
final boolean z3 = this.val$saved;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$16$PassportActivity$8(z3, tL_error);
}
});
}
}
public void lambda$run$10$PassportActivity$8(final boolean z, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$9$PassportActivity$8(tL_error, tLObject, z);
}
});
}
public 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 void lambda$run$15$PassportActivity$8(TLObject tLObject, String str, final boolean z) {
final byte[] bArr;
final TLRPC.TL_account_passwordSettings tL_account_passwordSettings = (TLRPC.TL_account_passwordSettings) tLObject;
if (tL_account_passwordSettings.secure_settings == null) {
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;
byte[] bArr2 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt;
PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
bArr = bArr2;
} else {
bArr = new byte[0];
}
PassportActivity.this.secureSecret = null;
PassportActivity.this.secureSecretId = 0L;
} else {
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_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) tL_account_passwordSettings.secure_settings.secure_algo;
byte[] bArr3 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt;
PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt);
bArr = bArr3;
} else if (tL_account_passwordSettings.secure_settings.secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoUnknown) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$11$PassportActivity$8();
}
});
return;
} else {
bArr = new byte[0];
}
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$14$PassportActivity$8(tL_account_passwordSettings, z, bArr);
}
});
}
public void lambda$null$11$PassportActivity$8() {
AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
}
public 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 (PassportActivity.this.currentBotId == 0) {
ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getAllSecureValues(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$null$13$PassportActivity$8(tLObject, tL_error);
}
});
return;
}
openRequestInterface();
} else if (z) {
UserConfig.getInstance(PassportActivity.this.currentAccount).resetSavedPassword();
PassportActivity.this.usingSavedPassword = 0;
PassportActivity.this.updatePasswordInterface();
} else {
if (PassportActivity.this.currentForm != null) {
PassportActivity.this.currentForm.values.clear();
PassportActivity.this.currentForm.errors.clear();
}
if (PassportActivity.this.secureSecret == null || PassportActivity.this.secureSecret.length == 0) {
generateNewSecret();
} else {
resetSecret();
}
}
}
public void lambda$null$13$PassportActivity$8(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$null$12$PassportActivity$8(tLObject, tL_error);
}
});
}
public 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)) {
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
} else {
AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
}
PassportActivity.this.showEditDoneProgress(true, false);
}
public void lambda$run$16$PassportActivity$8(boolean z, TLRPC.TL_error tL_error) {
String formatPluralString;
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) {
return;
}
PassportActivity.this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(PassportActivity.this.inputFields[0]);
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")) {
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
} else {
int intValue = Utilities.parseInt(tL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60);
}
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, formatPluralString));
}
}
}
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;
TLRPC.TL_secureRequiredType tL_secureRequiredType;
ArrayList<TLRPC.TL_secureRequiredType> arrayList;
boolean z;
TLRPC.TL_secureRequiredType tL_secureRequiredType2;
ArrayList<TLRPC.TL_secureRequiredType> arrayList2;
int i;
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) {
for (int i3 = 0; i3 < this.currentForm.users.size(); i3++) {
TLRPC.User user2 = this.currentForm.users.get(i3);
if (user2.id == this.currentBotId) {
user = user2;
break;
}
}
}
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 headerCell = new HeaderCell(context);
this.headerCell = headerCell;
headerCell.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++;
arrayList5 = arrayList6;
} 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;
}
arrayList5 = arrayList6;
}
} 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 size2 = tL_secureRequiredTypeOneOf.types.size();
int i7 = 0;
while (i7 < size2) {
TLRPC.SecureRequiredType secureRequiredType3 = tL_secureRequiredTypeOneOf.types.get(i7);
int i8 = size2;
if (secureRequiredType3 instanceof TLRPC.TL_secureRequiredType) {
arrayList6.add((TLRPC.TL_secureRequiredType) secureRequiredType3);
}
i7++;
size2 = i8;
}
i5++;
} else if (isAddressDocument(tL_secureRequiredType5.type)) {
int size3 = tL_secureRequiredTypeOneOf.types.size();
int i9 = 0;
while (i9 < size3) {
TLRPC.SecureRequiredType secureRequiredType4 = tL_secureRequiredTypeOneOf.types.get(i9);
ArrayList<TLRPC.TL_secureRequiredType> arrayList8 = arrayList6;
if (secureRequiredType4 instanceof TLRPC.TL_secureRequiredType) {
arrayList7.add((TLRPC.TL_secureRequiredType) secureRequiredType4);
}
i9++;
arrayList6 = arrayList8;
}
arrayList5 = arrayList6;
i6++;
}
}
}
}
arrayList5 = arrayList6;
}
i4++;
arrayList6 = arrayList5;
i2 = 0;
}
ArrayList<TLRPC.TL_secureRequiredType> arrayList9 = arrayList6;
boolean z4 = !z2 || i5 > 1;
boolean z5 = !z3 || i6 > 1;
int i10 = 0;
while (i10 < size) {
TLRPC.SecureRequiredType secureRequiredType5 = this.currentForm.required_types.get(i10);
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_secureRequiredType2 = tL_secureRequiredType6;
arrayList = null;
} else if (tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
if (!z4) {
arrayList4 = arrayList9;
tL_secureRequiredType2 = tL_secureRequiredType6;
arrayList = arrayList4;
}
arrayList4 = null;
tL_secureRequiredType2 = tL_secureRequiredType6;
arrayList = arrayList4;
} else if (tL_secureRequiredType6.type instanceof TLRPC.TL_secureValueTypeAddress) {
if (!z5) {
arrayList4 = arrayList7;
tL_secureRequiredType2 = tL_secureRequiredType6;
arrayList = arrayList4;
}
arrayList4 = null;
tL_secureRequiredType2 = tL_secureRequiredType6;
arrayList = arrayList4;
} else {
if (z4 && isPersonalDocument(tL_secureRequiredType6.type)) {
arrayList3 = new ArrayList<>();
arrayList3.add(tL_secureRequiredType6);
tL_secureRequiredType3 = new TLRPC.TL_secureRequiredType();
tL_secureRequiredType3.type = new TLRPC.TL_secureValueTypePersonalDetails();
} else {
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();
}
arrayList2 = arrayList7;
i = size;
}
tL_secureRequiredType2 = tL_secureRequiredType3;
arrayList = arrayList3;
z = true;
arrayList2 = arrayList7;
ArrayList<TLRPC.TL_secureRequiredType> arrayList10 = arrayList;
boolean z6 = z;
i = size;
addField(context, tL_secureRequiredType2, arrayList10, z6, i10 == size + (-1));
}
z = false;
arrayList2 = arrayList7;
ArrayList<TLRPC.TL_secureRequiredType> arrayList102 = arrayList;
boolean z62 = z;
i = size;
addField(context, tL_secureRequiredType2, arrayList102, z62, i10 == size + (-1));
} 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> arrayList11 = new ArrayList<>();
int size4 = tL_secureRequiredTypeOneOf2.types.size();
int i11 = 0;
while (i11 < size4) {
TLRPC.SecureRequiredType secureRequiredType7 = tL_secureRequiredTypeOneOf2.types.get(i11);
TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf3 = tL_secureRequiredTypeOneOf2;
if (secureRequiredType7 instanceof TLRPC.TL_secureRequiredType) {
arrayList11.add((TLRPC.TL_secureRequiredType) secureRequiredType7);
}
i11++;
tL_secureRequiredTypeOneOf2 = tL_secureRequiredTypeOneOf3;
}
if (isPersonalDocument(tL_secureRequiredType7.type)) {
tL_secureRequiredType = new TLRPC.TL_secureRequiredType();
tL_secureRequiredType.type = new TLRPC.TL_secureValueTypePersonalDetails();
} else {
tL_secureRequiredType = new TLRPC.TL_secureRequiredType();
tL_secureRequiredType.type = new TLRPC.TL_secureValueTypeAddress();
}
arrayList = arrayList11;
z = true;
tL_secureRequiredType2 = tL_secureRequiredType;
arrayList2 = arrayList7;
ArrayList<TLRPC.TL_secureRequiredType> arrayList1022 = arrayList;
boolean z622 = z;
i = size;
addField(context, tL_secureRequiredType2, arrayList1022, z622, i10 == size + (-1));
}
}
}
}
arrayList2 = arrayList7;
i = size;
}
i10++;
size = i;
arrayList7 = arrayList2;
}
}
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() {
@Override
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));
}
class C1ValueToSend {
boolean selfie_required;
boolean translation_required;
TLRPC.TL_secureValue value;
public C1ValueToSend(TLRPC.TL_secureValue tL_secureValue, boolean z, boolean z2) {
this.value = tL_secureValue;
this.selfie_required = z;
this.translation_required = z2;
}
}
public void lambda$createRequestInterface$16$PassportActivity(View view) {
ArrayList arrayList;
int i;
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(200L);
}
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()) {
Vibrator vibrator2 = (Vibrator) getParentActivity().getSystemService("vibrator");
if (vibrator2 != null) {
vibrator2.vibrate(200L);
}
AndroidUtilities.shakeView(getViewByType(tL_secureRequiredType), 2.0f, 0);
return;
}
arrayList2.add(new C1ValueToSend(valueByType, tL_secureRequiredType.selfie_required, tL_secureRequiredType.translation_required));
}
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) {
C1ValueToSend c1ValueToSend = (C1ValueToSend) arrayList2.get(i4);
TLRPC.TL_secureValue tL_secureValue = c1ValueToSend.value;
JSONObject jSONObject2 = new JSONObject();
if (tL_secureValue.plain_data != null) {
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;
}
} else {
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()) {
arrayList = arrayList2;
i = size3;
} else {
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);
}
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 (c1ValueToSend.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 (c1ValueToSend.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;
}
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 cipher = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding", "BC");
cipher.init(1, (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decode(replace, 0))));
tL_account_acceptAuthorization.credentials.secret = cipher.doFinal(encryptData.decrypyedFileSecret);
} catch (Exception e) {
FileLog.e(e);
}
ConnectionsManager.getInstance(this.currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_account_acceptAuthorization, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$null$15$PassportActivity(tLObject, tL_error);
}
}), this.classGuid);
}
public void lambda$null$15$PassportActivity(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$14$PassportActivity(tL_error);
}
});
}
public 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);
}
}
private void createManageInterface(Context context) {
ArrayList<TLRPC.TL_secureRequiredType> arrayList;
TLRPC.TL_secureRequiredType tL_secureRequiredType;
boolean z;
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 headerCell = new HeaderCell(context);
this.headerCell = headerCell;
headerCell.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() {
@Override
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() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$createManageInterface$21$PassportActivity(view);
}
});
ShadowSectionCell shadowSectionCell2 = new ShadowSectionCell(context);
this.addDocumentSectionCell = shadowSectionCell2;
shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(context, (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() {
@Override
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 void lambda$createManageInterface$17$PassportActivity(View view) {
openAddDocumentAlert();
}
public 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() {
@Override
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 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$null$19$PassportActivity(tLObject, tL_error);
}
});
}
public void lambda$null$19$PassportActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$18$PassportActivity();
}
});
}
public 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 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();
final 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()) {
return;
}
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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.this.lambda$openAddDocumentAlert$23$PassportActivity(arrayList2, dialogInterface, i);
}
});
showDialog(builder.create());
}
public 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;
}
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();
}
openTypeActivity(tL_secureRequiredType, tL_secureRequiredType3, new ArrayList<>(), tL_secureRequiredType3 != null);
}
tL_secureRequiredType3 = tL_secureRequiredType;
tL_secureRequiredType = tL_secureRequiredType2;
openTypeActivity(tL_secureRequiredType, tL_secureRequiredType3, new ArrayList<>(), tL_secureRequiredType3 != null);
}
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);
}
}
public 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() {
@Override
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() {
@Override
public final boolean onEditorAction(TextView textView, int i2, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createEmailInterface$25$PassportActivity(textView, i2, 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 void lambda$createEmailInterface$24$PassportActivity(View view) {
this.useCurrentValue = true;
this.doneItem.callOnClick();
this.useCurrentValue = false;
}
public boolean lambda$createEmailInterface$25$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 6 || i == 5) {
this.doneItem.callOnClick();
return true;
}
return false;
}
private void createPhoneInterface(Context context) {
String str;
String str2;
TelephonyManager telephonyManager;
ViewGroup frameLayout;
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() {
@Override
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 headerCell = new HeaderCell(context);
this.headerCell = headerCell;
headerCell.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) {
frameLayout = new LinearLayout(context);
((LinearLayout) frameLayout).setOrientation(0);
this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(i, 50));
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
} else if (i2 == 2) {
frameLayout = (ViewGroup) this.inputFields[1].getParent();
} else {
frameLayout = new FrameLayout(context);
this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(i, 50));
frameLayout.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() {
@Override
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());
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);
frameLayout.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);
frameLayout.addView(this.inputFields[i2], LayoutHelper.createLinear(55, -2, 0.0f, 12.0f, 16.0f, 6.0f));
this.inputFields[i2].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void afterTextChanged(Editable editable) {
String str4;
boolean z;
boolean z2;
int indexOf;
if (PassportActivity.this.ignoreOnTextChange) {
return;
}
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 i3 = 4;
if (stripExceptNumbers.length() > 4) {
while (true) {
if (i3 < 1) {
str4 = null;
z = false;
break;
}
String substring = stripExceptNumbers.substring(0, i3);
if (((String) PassportActivity.this.codesMap.get(substring)) != null) {
String str5 = stripExceptNumbers.substring(i3) + PassportActivity.this.inputFields[2].getText().toString();
PassportActivity.this.inputFields[1].setText(substring);
z = true;
str4 = str5;
stripExceptNumbers = substring;
break;
}
i3--;
}
if (!z) {
str4 = stripExceptNumbers.substring(1) + PassportActivity.this.inputFields[2].getText().toString();
EditTextBoldCursor editTextBoldCursor = PassportActivity.this.inputFields[1];
stripExceptNumbers = stripExceptNumbers.substring(0, 1);
editTextBoldCursor.setText(stripExceptNumbers);
}
} else {
str4 = null;
z = false;
}
String str6 = (String) PassportActivity.this.codesMap.get(stripExceptNumbers);
if (str6 == null || (indexOf = PassportActivity.this.countriesArray.indexOf(str6)) == -1) {
z2 = false;
} else {
PassportActivity.this.inputFields[0].setText((CharSequence) PassportActivity.this.countriesArray.get(indexOf));
String str7 = (String) PassportActivity.this.phoneFormatMap.get(stripExceptNumbers);
if (str7 != null) {
hintEditText.setHintText(str7.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 (str4 != null) {
hintEditText.requestFocus();
hintEditText.setText(str4);
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));
frameLayout.addView(this.inputFields[i2], LayoutHelper.createLinear(-1, -2, 0.0f, 12.0f, 21.0f, 6.0f));
this.inputFields[i2].addTextChangedListener(new TextWatcher() {
private int actionPosition;
private int characterAction = -1;
@Override
public void onTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
if (i4 == 0 && i5 == 1) {
this.characterAction = 1;
} else if (i4 == 1 && i5 == 0) {
if (charSequence.charAt(i3) == ' ' && i3 > 0) {
this.characterAction = 3;
this.actionPosition = i3 - 1;
return;
}
this.characterAction = 2;
} else {
this.characterAction = -1;
}
}
@Override
public void afterTextChanged(Editable editable) {
int i3;
int i4;
if (PassportActivity.this.ignoreOnPhoneChange) {
return;
}
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 i5 = 0;
while (i5 < obj.length()) {
int i6 = i5 + 1;
String substring = obj.substring(i5, i6);
if ("0123456789".contains(substring)) {
sb.append(substring);
}
i5 = i6;
}
PassportActivity.this.ignoreOnPhoneChange = true;
String hintText = hintEditText.getHintText();
if (hintText != null) {
int i7 = 0;
while (true) {
if (i7 >= sb.length()) {
break;
} else if (i7 < hintText.length()) {
if (hintText.charAt(i7) == ' ') {
sb.insert(i7, ' ');
i7++;
if (selectionStart == i7 && (i4 = this.characterAction) != 2 && i4 != 3) {
selectionStart++;
}
}
i7++;
} else {
sb.insert(i7, ' ');
if (selectionStart == i7 + 1 && (i3 = this.characterAction) != 2 && i3 != 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));
this.inputFields[i2].setGravity(LocaleController.isRTL ? 5 : 3);
frameLayout.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() {
@Override
public final boolean onEditorAction(TextView textView2, int i3, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createPhoneInterface$30$PassportActivity(textView2, i3, keyEvent);
}
});
if (i2 == 2) {
this.inputFields[i2].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i3, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createPhoneInterface$31$PassportActivity(view, i3, keyEvent);
}
});
}
if (i2 == 0) {
View view = new View(context);
this.dividers.add(view);
view.setBackgroundColor(Theme.getColor(Theme.key_divider));
frameLayout.addView(view, new FrameLayout.LayoutParams(-1, 1, 83));
}
i2++;
i = -1;
}
try {
telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
} catch (Exception e2) {
FileLog.e(e2);
}
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));
}
str = null;
if (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 void lambda$createPhoneInterface$26$PassportActivity(View view) {
this.useCurrentValue = true;
this.doneItem.callOnClick();
this.useCurrentValue = false;
}
public 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() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
PassportActivity.this.lambda$null$28$PassportActivity(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public 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() {
@Override
public final void run() {
PassportActivity.this.lambda$null$27$PassportActivity();
}
}, 300L);
this.inputFields[2].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
editTextBoldCursorArr[2].setSelection(editTextBoldCursorArr[2].length());
}
}
public void lambda$null$27$PassportActivity() {
AndroidUtilities.showKeyboard(this.inputFields[2]);
}
public boolean lambda$createPhoneInterface$30$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
this.inputFields[2].requestFocus();
return true;
} else if (i == 6) {
this.doneItem.callOnClick();
return true;
} else {
return false;
}
}
public boolean lambda$createPhoneInterface$31$PassportActivity(View view, int i, KeyEvent keyEvent) {
if (i == 67 && this.inputFields[2].length() == 0) {
this.inputFields[1].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
editTextBoldCursorArr[1].setSelection(editTextBoldCursorArr[1].length());
this.inputFields[1].dispatchKeyEvent(keyEvent);
return true;
}
return false;
}
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 headerCell = new HeaderCell(context);
this.headerCell = headerCell;
headerCell.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() {
@Override
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 headerCell2 = new HeaderCell(context);
this.headerCell = headerCell2;
headerCell2.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 linearLayout2 = new LinearLayout(context);
this.translationLayout = linearLayout2;
linearLayout2.setOrientation(1);
this.linearLayout2.addView(this.translationLayout, LayoutHelper.createLinear(-1, -2));
TextSettingsCell textSettingsCell2 = new TextSettingsCell(context);
this.uploadTranslationCell = textSettingsCell2;
textSettingsCell2.setBackgroundDrawable(Theme.getSelectorDrawable(true));
this.linearLayout2.addView(this.uploadTranslationCell, LayoutHelper.createLinear(-1, -2));
this.uploadTranslationCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$createAddressInterface$33$PassportActivity(view);
}
});
TextInfoPrivacyCell textInfoPrivacyCell3 = new TextInfoPrivacyCell(context);
this.bottomCellTranslation = textInfoPrivacyCell3;
textInfoPrivacyCell3.setBackgroundDrawable(Theme.getThemedDrawable(context, (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 headerCell3 = new HeaderCell(context);
this.headerCell = headerCell3;
headerCell3.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;
FrameLayout frameLayout = new FrameLayout(context) {
private StaticLayout errorLayout;
float offsetX;
@Override
protected void onMeasure(int i4, int i5) {
int size = View.MeasureSpec.getSize(i4) - AndroidUtilities.dp(34.0f);
StaticLayout errorLayout = editTextBoldCursor.getErrorLayout(size);
this.errorLayout = errorLayout;
if (errorLayout != null) {
int lineCount = errorLayout.getLineCount();
int i6 = 0;
if (lineCount > 1) {
i5 = 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 (i6 >= lineCount) {
break;
} else if (this.errorLayout.getLineLeft(i6) != 0.0f) {
this.offsetX = 0.0f;
break;
} else {
f = Math.max(f, this.errorLayout.getLineWidth(i6));
if (i6 == lineCount - 1) {
this.offsetX = size - f;
}
i6++;
}
}
}
}
super.onMeasure(i4, i5);
}
@Override
protected void onDraw(Canvas canvas) {
if (this.errorLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.offsetX, editTextBoldCursor.getLineY() + AndroidUtilities.dp(3.0f));
this.errorLayout.draw(canvas);
canvas.restore();
}
}
};
frameLayout.setWillNotDraw(false);
this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(-1, i));
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
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) {
frameLayout.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() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
return PassportActivity.this.lambda$createAddressInterface$35$PassportActivity(view3, 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() {
private boolean ignore;
@Override
public void beforeTextChanged(CharSequence charSequence3, int i4, int i5, int i6) {
}
@Override
public void onTextChanged(CharSequence charSequence3, int i4, int i5, int i6) {
}
@Override
public void afterTextChanged(Editable editable) {
if (this.ignore) {
return;
}
boolean z = true;
this.ignore = true;
int i4 = 0;
while (true) {
if (i4 >= editable.length()) {
z = false;
break;
}
char charAt = editable.charAt(i4);
if ((charAt < 'a' || charAt > 'z') && ((charAt < 'A' || charAt > 'Z') && !((charAt >= '0' && charAt <= '9') || charAt == '-' || charAt == ' '))) {
break;
}
i4++;
}
this.ignore = false;
if (!z) {
PassportActivity.this.checkFieldForError(editTextBoldCursor, str, editable, false);
} else {
editTextBoldCursor.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
}
}
});
this.inputFields[i3].setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
} else {
this.inputFields[i3].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence3, int i4, int i5, int i6) {
}
@Override
public void onTextChanged(CharSequence charSequence3, int i4, int i5, int i6) {
}
@Override
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);
this.inputFields[i3].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
frameLayout.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() {
@Override
public final boolean onEditorAction(TextView textView, int i4, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createAddressInterface$36$PassportActivity(textView, i4, 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() {
@Override
public final void onClick(View view3) {
PassportActivity.this.lambda$createAddressInterface$37$PassportActivity(view3);
}
});
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 void lambda$createAddressInterface$32$PassportActivity(View view) {
this.uploadingFileType = 0;
openAttachMenu();
}
public void lambda$createAddressInterface$33$PassportActivity(View view) {
this.uploadingFileType = 4;
openAttachMenu();
}
public 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() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
PassportActivity.this.lambda$null$34$PassportActivity(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$null$34$PassportActivity(CountrySelectActivity.Country country) {
if (country != null) {
this.inputFields[5].setText(country.name);
this.currentCitizeship = country.shortname;
}
}
public boolean lambda$createAddressInterface$36$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
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(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
return false;
}
public void lambda$createAddressInterface$37$PassportActivity(View view) {
createDocumentDeleteAlert();
}
private void createDocumentDeleteAlert() {
final boolean[] zArr = {true};
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.this.lambda$createDocumentDeleteAlert$38$PassportActivity(zArr, 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("PassportDeletePersonalAlert", R.string.PassportDeletePersonalAlert));
} else {
builder.setMessage(LocaleController.getString("PassportDeleteDocumentAlert", R.string.PassportDeleteDocumentAlert));
}
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() {
@Override
public final void onClick(View view) {
PassportActivity.lambda$createDocumentDeleteAlert$39(zArr, view);
}
});
builder.setView(frameLayout);
}
showDialog(builder.create());
}
public 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();
}
public static void lambda$createDocumentDeleteAlert$39(boolean[] zArr, View view) {
if (view.isEnabled()) {
zArr[0] = !zArr[0];
((CheckBoxCell) view).setChecked(zArr[0], true);
}
}
public void onFieldError(View view) {
if (view == null) {
return;
}
Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
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));
}
}
public String getDocumentHash(SecureDocument secureDocument) {
if (secureDocument != null) {
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);
}
return "";
}
public 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) {
if (TextUtils.equals(str2, editable)) {
HashMap<String, String> hashMap2 = this.fieldsErrors;
if (hashMap2 != null && (str4 = hashMap2.get(str)) != null) {
editTextBoldCursor.setErrorText(str4);
} else {
HashMap<String, String> hashMap3 = this.documentsErrors;
if (hashMap3 != null && (str3 = hashMap3.get(str)) != null) {
editTextBoldCursor.setErrorText(str3);
}
}
} else {
editTextBoldCursor.setErrorText(null);
}
} else {
editTextBoldCursor.setErrorText(null);
}
String str5 = z ? "error_document_all" : "error_all";
HashMap<String, String> hashMap4 = this.errorsValues;
if (hashMap4 == null || !hashMap4.containsKey(str5)) {
return;
}
this.errorsValues.remove(str5);
checkTopErrorCell(false);
}
public 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 (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) {
}
} else 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 5:
break;
case 6:
str3 = "residence_country_code";
break;
case 7:
str3 = "document_no";
break;
case 8:
str3 = "expiry_date";
break;
default:
str3 = null;
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) {
if (i4 == 2) {
str3 = "last_name_native";
}
str3 = null;
} else {
str3 = "middle_name_native";
}
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) {
}
hasErrorText = true;
}
}
}
z = false;
if (!hasErrorText) {
}
} else if (i4 != 8) {
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;
if (!hasErrorText && !z && length == 0) {
hasErrorText = true;
}
}
} else if (i4 == 7) {
}
z = false;
if (!hasErrorText) {
hasErrorText = true;
}
} else {
continue;
}
}
if (hasErrorText) {
onFieldError(viewArr[i4]);
return true;
}
}
i4++;
}
continue;
}
}
return false;
}
private void createIdentityInterface(final Context context) {
HashMap<String, String> hashMap;
final String str;
final HashMap<String, String> hashMap2;
final String str2;
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 headerCell = new HeaderCell(context);
this.headerCell = headerCell;
if (this.documentOnly) {
headerCell.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
} else {
headerCell.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() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$createIdentityInterface$40$PassportActivity(view);
}
});
LinearLayout linearLayout2 = new LinearLayout(context);
this.reverseLayout = linearLayout2;
linearLayout2.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() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$createIdentityInterface$41$PassportActivity(view);
}
});
if (this.currentDocumentsType.selfie_required) {
LinearLayout linearLayout3 = new LinearLayout(context);
this.selfieLayout = linearLayout3;
linearLayout3.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() {
@Override
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 headerCell2 = new HeaderCell(context);
this.headerCell = headerCell2;
headerCell2.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 linearLayout4 = new LinearLayout(context);
this.translationLayout = linearLayout4;
linearLayout4.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() {
@Override
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() {
@Override
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 headerCell3 = new HeaderCell(context);
this.headerCell = headerCell3;
if (this.documentOnly) {
headerCell3.setText(LocaleController.getString("PassportDocument", R.string.PassportDocument));
} else {
headerCell3.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;
FrameLayout frameLayout = new FrameLayout(context) {
private StaticLayout errorLayout;
private float offsetX;
@Override
protected void onMeasure(int i5, int i6) {
int size = View.MeasureSpec.getSize(i5) - AndroidUtilities.dp(34.0f);
StaticLayout errorLayout = editTextBoldCursor.getErrorLayout(size);
this.errorLayout = errorLayout;
if (errorLayout != null) {
int lineCount = errorLayout.getLineCount();
int i7 = 0;
if (lineCount > 1) {
i6 = 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 (i7 >= lineCount) {
break;
} else if (this.errorLayout.getLineLeft(i7) != 0.0f) {
this.offsetX = 0.0f;
break;
} else {
f = Math.max(f, this.errorLayout.getLineWidth(i7));
if (i7 == lineCount - 1) {
this.offsetX = size - f;
}
i7++;
}
}
}
}
super.onMeasure(i5, i6);
}
@Override
protected void onDraw(Canvas canvas) {
if (this.errorLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.offsetX, editTextBoldCursor.getLineY() + AndroidUtilities.dp(3.0f));
this.errorLayout.draw(canvas);
canvas.restore();
}
}
};
frameLayout.setWillNotDraw(z);
this.linearLayout2.addView(frameLayout, LayoutHelper.createLinear(i, 64));
frameLayout.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) {
frameLayout.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() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
return PassportActivity.this.lambda$createIdentityInterface$47$PassportActivity(view3, motionEvent);
}
});
this.inputFields[i3].setInputType(0);
} else if (i3 == 3 || i3 == 8) {
this.inputFields[i3].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
return PassportActivity.this.lambda$createIdentityInterface$50$PassportActivity(context, view3, motionEvent);
}
});
this.inputFields[i3].setInputType(0);
this.inputFields[i3].setFocusable(false);
} else if (i3 == 4) {
this.inputFields[i3].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
return PassportActivity.this.lambda$createIdentityInterface$52$PassportActivity(view3, 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() {
private boolean ignore;
@Override
public void beforeTextChanged(CharSequence charSequence2, int i5, int i6, int i7) {
}
@Override
public void onTextChanged(CharSequence charSequence2, int i5, int i6, int i7) {
}
@Override
public void afterTextChanged(Editable editable) {
boolean z3;
if (this.ignore) {
return;
}
int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
int i5 = 0;
while (true) {
if (i5 >= editable.length()) {
z3 = false;
break;
}
char charAt = editable.charAt(i5);
if ((charAt < '0' || charAt > '9') && ((charAt < 'a' || charAt > 'z') && !((charAt >= 'A' && charAt <= 'Z') || charAt == ' ' || charAt == '\'' || charAt == ',' || charAt == '.' || charAt == '&' || charAt == '-' || charAt == '/'))) {
z3 = true;
break;
}
i5++;
}
if (!z3 || PassportActivity.this.allowNonLatinName) {
PassportActivity.this.nonLatinNames[intValue] = z3;
PassportActivity.this.checkFieldForError(editTextBoldCursor, str2, editable, false);
return;
}
editTextBoldCursor.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
}
});
} else {
this.inputFields[i3].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence2, int i5, int i6, int i7) {
}
@Override
public void onTextChanged(CharSequence charSequence2, int i5, int i6, int i7) {
}
@Override
public void afterTextChanged(Editable editable) {
PassportActivity passportActivity = PassportActivity.this;
passportActivity.checkFieldForError(editTextBoldCursor, str2, editable, hashMap2 == passportActivity.currentDocumentValues);
int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
EditTextBoldCursor editTextBoldCursor2 = 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);
frameLayout.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() {
@Override
public final boolean onEditorAction(TextView textView, int i5, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createIdentityInterface$53$PassportActivity(textView, i5, keyEvent);
}
});
i3++;
z = false;
i = -1;
} else {
ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context);
this.sectionCell2 = shadowSectionCell;
this.linearLayout2.addView(shadowSectionCell, LayoutHelper.createLinear(-1, -2));
HeaderCell headerCell4 = new HeaderCell(context);
this.headerCell = headerCell4;
headerCell4.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;
FrameLayout frameLayout2 = new FrameLayout(context) {
private StaticLayout errorLayout;
private float offsetX;
@Override
protected void onMeasure(int i7, int i8) {
int size = View.MeasureSpec.getSize(i7) - AndroidUtilities.dp(34.0f);
StaticLayout errorLayout = editTextBoldCursor2.getErrorLayout(size);
this.errorLayout = errorLayout;
if (errorLayout != null) {
int lineCount = errorLayout.getLineCount();
int i9 = 0;
if (lineCount > 1) {
i8 = 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 (i9 >= lineCount) {
break;
} else if (this.errorLayout.getLineLeft(i9) != 0.0f) {
this.offsetX = 0.0f;
break;
} else {
f = Math.max(f, this.errorLayout.getLineWidth(i9));
if (i9 == lineCount - 1) {
this.offsetX = size - f;
}
i9++;
}
}
}
}
super.onMeasure(i7, i8);
}
@Override
protected void onDraw(Canvas canvas) {
if (this.errorLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.offsetX, editTextBoldCursor2.getLineY() + AndroidUtilities.dp(3.0f));
this.errorLayout.draw(canvas);
canvas.restore();
}
}
};
frameLayout2.setWillNotDraw(false);
this.linearLayout2.addView(frameLayout2, LayoutHelper.createLinear(-1, i4));
frameLayout2.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() {
private boolean ignore;
@Override
public void beforeTextChanged(CharSequence charSequence2, int i7, int i8, int i9) {
}
@Override
public void onTextChanged(CharSequence charSequence2, int i7, int i8, int i9) {
}
@Override
public void afterTextChanged(Editable editable) {
if (this.ignore) {
return;
}
PassportActivity.this.checkFieldForError(editTextBoldCursor2, str, editable, false);
}
});
}
this.inputExtraFields[i6].setPadding(0, 0, 0, 0);
this.inputExtraFields[i6].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
frameLayout2.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() {
@Override
public final boolean onEditorAction(TextView textView, int i7, KeyEvent keyEvent) {
return PassportActivity.this.lambda$createIdentityInterface$54$PassportActivity(textView, i7, 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() {
@Override
public final void onClick(View view4) {
PassportActivity.this.lambda$createIdentityInterface$55$PassportActivity(view4);
}
});
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 void lambda$createIdentityInterface$40$PassportActivity(View view) {
this.uploadingFileType = 2;
openAttachMenu();
}
public void lambda$createIdentityInterface$41$PassportActivity(View view) {
this.uploadingFileType = 3;
openAttachMenu();
}
public void lambda$createIdentityInterface$42$PassportActivity(View view) {
this.uploadingFileType = 1;
openAttachMenu();
}
public void lambda$createIdentityInterface$43$PassportActivity(View view) {
this.uploadingFileType = 4;
openAttachMenu();
}
public void lambda$createIdentityInterface$45$PassportActivity(View view) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 22);
return;
}
MrzCameraActivity mrzCameraActivity = new MrzCameraActivity();
mrzCameraActivity.setDelegate(new MrzCameraActivity.MrzCameraActivityDelegate() {
@Override
public final void didFindMrzInfo(MrzRecognizer.Result result) {
PassportActivity.this.lambda$null$44$PassportActivity(result);
}
});
presentFragment(mrzCameraActivity);
}
public 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) {
return;
}
this.inputFields[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.birthDay), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
}
public boolean lambda$createIdentityInterface$47$PassportActivity(final View view, MotionEvent motionEvent) {
if (getParentActivity() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
PassportActivity.this.lambda$null$46$PassportActivity(view, country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public 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 boolean lambda$createIdentityInterface$50$PassportActivity(Context context, View view, MotionEvent motionEvent) {
String string;
int i;
int i2;
int i3;
int i4;
int i5;
int i6;
if (getParentActivity() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
Calendar calendar = Calendar.getInstance();
calendar.get(1);
calendar.get(2);
calendar.get(5);
try {
final EditTextBoldCursor editTextBoldCursor = (EditTextBoldCursor) view;
final int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
if (intValue == 8) {
string = LocaleController.getString("PassportSelectExpiredDate", R.string.PassportSelectExpiredDate);
i = 0;
i2 = 20;
i3 = 0;
} else {
string = LocaleController.getString("PassportSelectBithdayDate", R.string.PassportSelectBithdayDate);
i = -120;
i2 = 0;
i3 = -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();
i6 = Utilities.parseInt(split[2]).intValue();
i4 = intValue2;
i5 = intValue3;
} else {
i4 = -1;
i5 = -1;
i6 = -1;
}
AlertDialog.Builder createDatePickerDialog = AlertsCreator.createDatePickerDialog(context, i, i2, i3, i4, i5, i6, string, intValue == 8, new AlertsCreator.DatePickerDelegate() {
@Override
public final void didSelectDate(int i7, int i8, int i9) {
PassportActivity.this.lambda$null$48$PassportActivity(intValue, editTextBoldCursor, i7, i8, i9);
}
});
if (intValue == 8) {
createDatePickerDialog.setNegativeButton(LocaleController.getString("PassportSelectNotExpire", R.string.PassportSelectNotExpire), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
PassportActivity.this.lambda$null$49$PassportActivity(editTextBoldCursor, dialogInterface, i7);
}
});
}
showDialog(createDatePickerDialog.create());
} catch (Exception e) {
FileLog.e(e);
}
}
return true;
}
public 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 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 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() {
@Override
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 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 boolean lambda$createIdentityInterface$53$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
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(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
return false;
}
public boolean lambda$createIdentityInterface$54$PassportActivity(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
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(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
return false;
}
public 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);
}
public void updateUploadText(int i) {
boolean z = true;
if (i == 0) {
if (this.uploadDocumentCell == null) {
return;
}
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) {
return;
}
textDetailSettingsCell.setVisibility(this.selfieDocument != null ? 8 : 0);
} else if (i == 4) {
if (this.uploadTranslationCell == null) {
return;
}
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) {
return;
}
TLRPC.TL_secureRequiredType tL_secureRequiredType = this.currentDocumentsType;
if (tL_secureRequiredType == null || (!tL_secureRequiredType.selfie_required && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense))) {
z = false;
}
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);
}
this.uploadFrontCell.setVisibility(this.frontDocument != null ? 8 : 0);
} else if (i != 3 || this.uploadReverseCell == null) {
} else {
if ((this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) || (this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
this.reverseLayout.setVisibility(0);
this.uploadReverseCell.setVisibility(this.reverseDocument != null ? 8 : 0);
return;
}
this.reverseLayout.setVisibility(8);
this.uploadReverseCell.setVisibility(8);
}
}
private void checkTopErrorCell(boolean z) {
String str;
String str2;
if (this.topErrorCell == null) {
return;
}
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);
}
}
}
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) {
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 {
editTextBoldCursor.setText(str2);
}
} 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) {
editTextBoldCursor.setErrorText(charSequence2);
this.errorsValues.put(str, editTextBoldCursor.getText().toString());
return;
}
HashMap<String, String> hashMap3 = this.documentsErrors;
if (hashMap3 == null || (charSequence = (String) hashMap3.get(str)) == null) {
return;
}
editTextBoldCursor.setErrorText(charSequence);
this.errorsValues.put(str, editTextBoldCursor.getText().toString());
}
private void addDocumentView(final SecureDocument secureDocument, final int i) {
String string;
String str;
String formatDateForBan;
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) {
return;
}
final 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;
}
final String str2 = str;
if (str2 != null && (hashMap = this.documentsErrors) != null && (formatDateForBan = hashMap.get(str2)) != null) {
secureDocumentCell.valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3));
this.errorsValues.put(str2, "");
} else {
formatDateForBan = LocaleController.formatDateForBan(secureDocument.secureFile.date);
}
secureDocumentCell.setTextAndValueAndImage(string, formatDateForBan, secureDocument);
secureDocumentCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$addDocumentView$56$PassportActivity(i, view);
}
});
secureDocumentCell.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return PassportActivity.this.lambda$addDocumentView$58$PassportActivity(i, secureDocument, secureDocumentCell, str2, view);
}
});
}
public 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 photoViewer = PhotoViewer.getInstance();
ArrayList<SecureDocument> arrayList = this.documents;
photoViewer.openPhoto(arrayList, arrayList.indexOf(secureDocument), this.provider);
return;
}
PhotoViewer photoViewer2 = PhotoViewer.getInstance();
ArrayList<SecureDocument> arrayList2 = this.translationDocuments;
photoViewer2.openPhoto(arrayList2, arrayList2.indexOf(secureDocument), this.provider);
}
public boolean lambda$addDocumentView$58$PassportActivity(final int i, final SecureDocument secureDocument, final SecureDocumentCell secureDocumentCell, final 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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
PassportActivity.this.lambda$null$57$PassportActivity(secureDocument, i, secureDocumentCell, str, dialogInterface, i2);
}
});
showDialog(builder.create());
return true;
}
public 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) {
return;
}
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) {
return secureValueType instanceof TLRPC.TL_secureValueTypePersonalDetails ? "personal_details" : secureValueType instanceof TLRPC.TL_secureValueTypePassport ? "passport" : secureValueType instanceof TLRPC.TL_secureValueTypeInternalPassport ? "internal_passport" : secureValueType instanceof TLRPC.TL_secureValueTypeDriverLicense ? "driver_license" : secureValueType instanceof TLRPC.TL_secureValueTypeIdentityCard ? "identity_card" : secureValueType instanceof TLRPC.TL_secureValueTypeUtilityBill ? "utility_bill" : secureValueType instanceof TLRPC.TL_secureValueTypeAddress ? "address" : secureValueType instanceof TLRPC.TL_secureValueTypeBankStatement ? "bank_statement" : secureValueType instanceof TLRPC.TL_secureValueTypeRentalAgreement ? "rental_agreement" : secureValueType instanceof TLRPC.TL_secureValueTypeTemporaryRegistration ? "temporary_registration" : secureValueType instanceof TLRPC.TL_secureValueTypePassportRegistration ? "passport_registration" : secureValueType instanceof TLRPC.TL_secureValueTypeEmail ? "email" : 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) : "";
}
public 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;
StringBuilder sb;
String[] strArr;
String[] strArr2;
int i2;
int i3;
JSONObject jSONObject;
String[] strArr3;
HashMap<String, String> hashMap;
String str5;
HashMap<String, String> hashMap2;
Iterator<String> keys;
int i4;
JSONObject jSONObject2;
HashMap<String, String> hashMap3;
String str6;
HashMap<String, String> hashMap4;
char c;
String str7;
String sb2;
TextDetailSecureCell textDetailSecureCell2;
boolean z3;
BufferedReader bufferedReader;
String str8 = str2;
TextDetailSecureCell textDetailSecureCell3 = this.typesViews.get(tL_secureRequiredType);
if (textDetailSecureCell3 != null) {
str4 = "last_name_native";
z2 = true;
} else if (this.currentActivityType != 8) {
return;
} else {
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();
}
TextDetailSecureCell textDetailSecureCell4 = textDetailSecureCell3;
HashMap<String, String> hashMap5 = this.typesValues.get(tL_secureRequiredType);
HashMap<String, String> hashMap6 = 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 (str8 != null && this.languageMap == null) {
this.languageMap = new HashMap<>();
try {
tL_secureValue = valueByType;
try {
bufferedReader = new BufferedReader(new InputStreamReader(ApplicationLoader.applicationContext.getResources().getAssets().open("countries.txt")));
} catch (Exception e) {
e = e;
textDetailSecureCell = textDetailSecureCell4;
}
} catch (Exception e2) {
e = e2;
textDetailSecureCell = textDetailSecureCell4;
tL_secureValue = valueByType;
}
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 e3) {
e = e3;
}
e = e3;
FileLog.e(e);
}
textDetailSecureCell = textDetailSecureCell4;
bufferedReader.close();
} else {
textDetailSecureCell = textDetailSecureCell4;
tL_secureValue = valueByType;
this.languageMap = null;
}
if (str != null) {
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
PhoneFormat phoneFormat = PhoneFormat.getInstance();
sb2 = phoneFormat.format(Marker.ANY_NON_NULL_MARKER + str);
} else {
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail) {
sb2 = str;
}
sb2 = null;
}
} else {
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 (str8 != null || str3 != null) {
if (hashMap5 == null) {
return;
}
hashMap5.clear();
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
strArr = ((this.currentActivityType != 0 || z) && !(this.currentActivityType == 8 && tL_secureRequiredType2 == null)) ? null : 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)) {
strArr2 = new String[]{"document_no", "expiry_date"};
if (strArr == null || strArr2 != null) {
StringBuilder sb3 = sb;
String[] strArr4 = strArr;
JSONObject jSONObject3 = null;
i2 = 2;
i3 = 0;
String[] strArr5 = null;
while (i3 < i2) {
if (i3 == 0) {
if (str8 != null) {
try {
jSONObject = new JSONObject(str8);
strArr3 = strArr2;
strArr2 = strArr4;
if (strArr2 != null && jSONObject != null) {
keys = jSONObject.keys();
while (keys.hasNext()) {
Iterator<String> it = keys;
String next = keys.next();
if (i3 == 0) {
hashMap5.put(next, jSONObject.getString(next));
} else {
hashMap6.put(next, jSONObject.getString(next));
}
keys = it;
}
i4 = 0;
while (i4 < strArr2.length) {
if (jSONObject.has(strArr2[i4])) {
if (sb3 == null) {
sb3 = new StringBuilder();
}
String string = jSONObject.getString(strArr2[i4]);
if (string != null && !TextUtils.isEmpty(string)) {
jSONObject2 = jSONObject;
hashMap3 = hashMap5;
if (!"first_name_native".equals(strArr2[i4]) && !"middle_name_native".equals(strArr2[i4])) {
String str9 = str4;
if (str9.equals(strArr2[i4])) {
str6 = str9;
hashMap4 = hashMap6;
} else {
if (sb3.length() > 0) {
hashMap4 = hashMap6;
if (!"last_name".equals(strArr2[i4]) && !str9.equals(strArr2[i4]) && !"middle_name".equals(strArr2[i4]) && !"middle_name_native".equals(strArr2[i4])) {
sb3.append(", ");
}
sb3.append(" ");
} else {
hashMap4 = hashMap6;
}
String str10 = strArr2[i4];
int hashCode = str10.hashCode();
str6 = str9;
if (hashCode == -2006252145) {
if (str10.equals("residence_country_code")) {
c = 1;
if (c != 0) {
}
str7 = this.languageMap.get(string);
if (str7 == null) {
}
}
c = 65535;
if (c != 0) {
}
str7 = this.languageMap.get(string);
if (str7 == null) {
}
} else if (hashCode != -1249512767) {
if (hashCode == 1481071862 && str10.equals("country_code")) {
c = 0;
if (c != 0 || c == 1) {
str7 = this.languageMap.get(string);
if (str7 == null) {
sb3.append(str7);
}
} else if (c == 2) {
if ("male".equals(string)) {
sb3.append(LocaleController.getString("PassportMale", R.string.PassportMale));
} else if ("female".equals(string)) {
sb3.append(LocaleController.getString("PassportFemale", R.string.PassportFemale));
}
} else {
sb3.append(string);
}
}
c = 65535;
if (c != 0) {
}
str7 = this.languageMap.get(string);
if (str7 == null) {
}
} else {
if (str10.equals("gender")) {
c = 2;
if (c != 0) {
}
str7 = this.languageMap.get(string);
if (str7 == null) {
}
}
c = 65535;
if (c != 0) {
}
str7 = this.languageMap.get(string);
if (str7 == null) {
}
}
}
i4++;
hashMap6 = hashMap4;
jSONObject = jSONObject2;
hashMap5 = hashMap3;
str4 = str6;
}
str6 = str4;
hashMap4 = hashMap6;
i4++;
hashMap6 = hashMap4;
jSONObject = jSONObject2;
hashMap5 = hashMap3;
str4 = str6;
}
}
jSONObject2 = jSONObject;
hashMap3 = hashMap5;
str6 = str4;
hashMap4 = hashMap6;
i4++;
hashMap6 = hashMap4;
jSONObject = jSONObject2;
hashMap5 = hashMap3;
str4 = str6;
}
}
hashMap = hashMap5;
str5 = str4;
hashMap2 = hashMap6;
jSONObject3 = jSONObject;
} catch (Exception unused) {
}
}
jSONObject = jSONObject3;
String[] strArr6 = strArr5;
strArr3 = strArr2;
strArr2 = strArr6;
if (strArr2 != null) {
keys = jSONObject.keys();
while (keys.hasNext()) {
}
i4 = 0;
while (i4 < strArr2.length) {
}
}
hashMap = hashMap5;
str5 = str4;
hashMap2 = hashMap6;
jSONObject3 = jSONObject;
} else if (hashMap6 == null) {
hashMap = hashMap5;
str5 = str4;
hashMap2 = hashMap6;
String[] strArr7 = strArr5;
strArr3 = strArr2;
strArr2 = strArr7;
} else {
if (str3 != null) {
jSONObject = new JSONObject(str3);
strArr3 = strArr2;
if (strArr2 != null) {
}
hashMap = hashMap5;
str5 = str4;
hashMap2 = hashMap6;
jSONObject3 = jSONObject;
}
jSONObject = jSONObject3;
String[] strArr62 = strArr5;
strArr3 = strArr2;
strArr2 = strArr62;
if (strArr2 != null) {
}
hashMap = hashMap5;
str5 = str4;
hashMap2 = hashMap6;
jSONObject3 = jSONObject;
}
i3++;
str8 = str2;
hashMap6 = hashMap2;
hashMap5 = hashMap;
str4 = str5;
i2 = 2;
String[] strArr8 = strArr3;
strArr5 = strArr2;
strArr2 = strArr8;
}
sb = sb3;
}
}
} else {
strArr = (!(tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) || ((this.currentActivityType != 0 || z) && !(this.currentActivityType == 8 && tL_secureRequiredType2 == null))) ? null : new String[]{"street_line1", "street_line2", "post_code", "city", RemoteConfigConstants.ResponseFieldKey.STATE, "country_code"};
}
strArr2 = null;
if (strArr == null) {
}
StringBuilder sb32 = sb;
String[] strArr42 = strArr;
JSONObject jSONObject32 = null;
i2 = 2;
i3 = 0;
String[] strArr52 = null;
while (i3 < i2) {
}
sb = sb32;
}
if (sb != null) {
sb2 = sb.toString();
}
sb2 = null;
}
HashMap<String, String> hashMap7 = !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 ((hashMap7 != null && hashMap7.size() > 0) || (hashMap8 != null && hashMap8.size() > 0)) {
String str11 = !z ? this.mainErrorsMap.get(getNameForType(tL_secureRequiredType.type)) : null;
sb2 = str11 == null ? this.mainErrorsMap.get(getNameForType(tL_secureRequiredType2.type)) : str11;
textDetailSecureCell2 = textDetailSecureCell;
z3 = true;
} else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
if (TextUtils.isEmpty(sb2)) {
if (tL_secureRequiredType2 == null) {
sb2 = LocaleController.getString("PassportPersonalDetailsInfo", R.string.PassportPersonalDetailsInfo);
} else if (this.currentActivityType == 8) {
sb2 = LocaleController.getString("PassportDocuments", R.string.PassportDocuments);
} else if (i == 1) {
if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassport) {
sb2 = LocaleController.getString("PassportIdentityPassport", R.string.PassportIdentityPassport);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
sb2 = LocaleController.getString("PassportIdentityInternalPassport", R.string.PassportIdentityInternalPassport);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
sb2 = LocaleController.getString("PassportIdentityDriverLicence", R.string.PassportIdentityDriverLicence);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
sb2 = LocaleController.getString("PassportIdentityID", R.string.PassportIdentityID);
}
} else {
sb2 = LocaleController.getString("PassportIdentityDocumentInfo", R.string.PassportIdentityDocumentInfo);
}
textDetailSecureCell2 = textDetailSecureCell;
z3 = false;
}
textDetailSecureCell2 = textDetailSecureCell;
z3 = false;
} else {
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
if (TextUtils.isEmpty(sb2)) {
if (tL_secureRequiredType2 == null) {
sb2 = LocaleController.getString("PassportAddressNoUploadInfo", R.string.PassportAddressNoUploadInfo);
} else if (this.currentActivityType == 8) {
sb2 = LocaleController.getString("PassportDocuments", R.string.PassportDocuments);
} else if (i == 1) {
if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
sb2 = LocaleController.getString("PassportAddAgreementInfo", R.string.PassportAddAgreementInfo);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
sb2 = LocaleController.getString("PassportAddBillInfo", R.string.PassportAddBillInfo);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
sb2 = LocaleController.getString("PassportAddPassportRegistrationInfo", R.string.PassportAddPassportRegistrationInfo);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
sb2 = LocaleController.getString("PassportAddTemporaryRegistrationInfo", R.string.PassportAddTemporaryRegistrationInfo);
} else if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypeBankStatement) {
sb2 = LocaleController.getString("PassportAddBankInfo", R.string.PassportAddBankInfo);
}
} else {
sb2 = LocaleController.getString("PassportAddressInfo", R.string.PassportAddressInfo);
}
textDetailSecureCell2 = textDetailSecureCell;
z3 = false;
}
} else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePhone) {
if (TextUtils.isEmpty(sb2)) {
sb2 = LocaleController.getString("PassportPhoneInfo", R.string.PassportPhoneInfo);
}
} else if ((tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeEmail) && TextUtils.isEmpty(sb2)) {
sb2 = LocaleController.getString("PassportEmailInfo", R.string.PassportEmailInfo);
}
textDetailSecureCell2 = textDetailSecureCell;
z3 = false;
}
textDetailSecureCell2.setValue(sb2);
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)) ? false : true);
}
public void checkNativeFields(boolean z) {
EditTextBoldCursor[] editTextBoldCursorArr;
if (this.inputExtraFields == null) {
return;
}
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() != 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));
return;
} else {
this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), (int) R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
return;
}
}
return;
}
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() {
@Override
public final void run() {
PassportActivity.this.lambda$checkNativeFields$59$PassportActivity();
}
});
}
}
public 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;
JSONObject jSONObject;
int i;
if (tL_secureRequiredType == null) {
return null;
}
int size = this.currentForm.values.size();
for (int i2 = 0; i2 < size; i2++) {
TLRPC.TL_secureValue tL_secureValue = this.currentForm.values.get(i2);
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) {
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"};
}
} else {
strArr = new String[]{"street_line1", "street_line2", "post_code", "city", RemoteConfigConstants.ResponseFieldKey.STATE, "country_code"};
}
try {
jSONObject = new JSONObject(decryptData(tL_secureValue.data.data, decryptValueSecret(tL_secureValue.data.secret, tL_secureValue.data.data_hash), tL_secureValue.data.data_hash));
} catch (Throwable unused) {
}
while (i < strArr.length) {
i = (jSONObject.has(strArr[i]) && !TextUtils.isEmpty(jSONObject.getString(strArr[i]))) ? i + 1 : 0;
return null;
}
}
}
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;
}
int i2 = i;
PassportActivity passportActivity = new PassportActivity(i, tL_account_authorizationForm, tL_account_password, tL_secureRequiredType, valueByType, tL_secureRequiredType2, valueByType2, hashMap4, hashMap);
passportActivity.delegate = new PassportActivityDelegate() {
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;
}
public 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);
}
@Override
public void saveValue(TLRPC.TL_secureRequiredType tL_secureRequiredType3, String str, String str2, TLRPC.TL_secureRequiredType tL_secureRequiredType4, String str3, ArrayList<SecureDocument> arrayList2, SecureDocument secureDocument, ArrayList<SecureDocument> arrayList3, SecureDocument secureDocument2, SecureDocument secureDocument3, Runnable runnable, ErrorRunnable errorRunnable) {
TLRPC.TL_inputSecureValue tL_inputSecureValue;
TLRPC.TL_securePlainPhone tL_securePlainPhone;
TLRPC.TL_inputSecureValue tL_inputSecureValue2;
if (!TextUtils.isEmpty(str2)) {
tL_inputSecureValue = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue.type = tL_secureRequiredType3.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)) {
tL_inputSecureValue = null;
} else {
TLRPC.SecureValueType secureValueType3 = secureValueType;
if (secureValueType3 instanceof TLRPC.TL_secureValueTypeEmail) {
TLRPC.TL_securePlainEmail tL_securePlainEmail = new TLRPC.TL_securePlainEmail();
tL_securePlainEmail.email = str;
tL_securePlainPhone = tL_securePlainEmail;
} else if (!(secureValueType3 instanceof TLRPC.TL_secureValueTypePhone)) {
return;
} else {
TLRPC.TL_securePlainPhone tL_securePlainPhone2 = new TLRPC.TL_securePlainPhone();
tL_securePlainPhone2.phone = str;
tL_securePlainPhone = tL_securePlainPhone2;
}
TLRPC.TL_inputSecureValue tL_inputSecureValue3 = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue3.type = tL_secureRequiredType3.type;
tL_inputSecureValue3.flags |= 32;
tL_inputSecureValue3.plain_data = tL_securePlainPhone;
tL_inputSecureValue = tL_inputSecureValue3;
}
if (!z && tL_inputSecureValue == null) {
if (errorRunnable != null) {
errorRunnable.onError(null, null);
return;
}
return;
}
if (tL_secureRequiredType4 != null) {
TLRPC.TL_inputSecureValue tL_inputSecureValue4 = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue4.type = tL_secureRequiredType4.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 (arrayList3 != null && !arrayList3.isEmpty()) {
tL_inputSecureValue4.flags |= 64;
int size2 = arrayList3.size();
for (int i3 = 0; i3 < size2; i3++) {
tL_inputSecureValue4.translation.add(getInputSecureFile(arrayList3.get(i3)));
}
}
if (arrayList2 != null && !arrayList2.isEmpty()) {
tL_inputSecureValue4.flags |= 16;
int size3 = arrayList2.size();
for (int i4 = 0; i4 < size3; i4++) {
tL_inputSecureValue4.files.add(getInputSecureFile(arrayList2.get(i4)));
}
}
if (!z) {
tL_inputSecureValue2 = tL_inputSecureValue4;
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 AnonymousClass1(errorRunnable, str, tL_account_saveSecureValue, tL_secureRequiredType4, tL_secureRequiredType3, arrayList2, secureDocument, secureDocument2, secureDocument3, arrayList3, str2, str3, runnable, this, tL_inputSecureValue2));
}
tL_inputSecureValue = tL_inputSecureValue4;
}
tL_inputSecureValue2 = null;
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 AnonymousClass1(errorRunnable, str, tL_account_saveSecureValue2, tL_secureRequiredType4, tL_secureRequiredType3, arrayList2, secureDocument, secureDocument2, secureDocument3, arrayList3, str2, str3, runnable, this, tL_inputSecureValue2));
}
public class AnonymousClass1 implements RequestDelegate {
final PassportActivityDelegate val$currentDelegate;
final TLRPC.TL_secureRequiredType val$documentRequiredType;
final ArrayList val$documents;
final String val$documentsJson;
final ErrorRunnable val$errorRunnable;
final TLRPC.TL_inputSecureValue val$finalFileInputSecureValue;
final Runnable val$finishRunnable;
final SecureDocument val$front;
final String val$json;
final TLRPC.TL_account_saveSecureValue val$req;
final TLRPC.TL_secureRequiredType val$requiredType;
final SecureDocument val$reverse;
final SecureDocument val$selfie;
final String val$text;
final ArrayList val$translationDocuments;
AnonymousClass1(ErrorRunnable errorRunnable, String str, TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue, TLRPC.TL_secureRequiredType tL_secureRequiredType, TLRPC.TL_secureRequiredType tL_secureRequiredType2, ArrayList arrayList, SecureDocument secureDocument, SecureDocument secureDocument2, SecureDocument secureDocument3, ArrayList arrayList2, String str2, String str3, Runnable runnable, PassportActivityDelegate passportActivityDelegate, TLRPC.TL_inputSecureValue tL_inputSecureValue) {
this.val$errorRunnable = errorRunnable;
this.val$text = str;
this.val$req = tL_account_saveSecureValue;
this.val$documentRequiredType = tL_secureRequiredType;
this.val$requiredType = tL_secureRequiredType2;
this.val$documents = arrayList;
this.val$selfie = secureDocument;
this.val$front = secureDocument2;
this.val$reverse = secureDocument3;
this.val$translationDocuments = arrayList2;
this.val$json = str2;
this.val$documentsJson = str3;
this.val$finishRunnable = runnable;
this.val$currentDelegate = passportActivityDelegate;
this.val$finalFileInputSecureValue = tL_inputSecureValue;
}
public void lambda$run$4$PassportActivity$19$1(final TLRPC.TL_error tL_error, final TLRPC.TL_secureValue tL_secureValue, final TLRPC.TL_secureValue tL_secureValue2) {
final ErrorRunnable errorRunnable = this.val$errorRunnable;
final String str = this.val$text;
final TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = this.val$req;
final boolean z = z;
final TLRPC.TL_secureRequiredType tL_secureRequiredType = this.val$documentRequiredType;
final TLRPC.TL_secureRequiredType tL_secureRequiredType2 = this.val$requiredType;
final ArrayList arrayList = this.val$documents;
final SecureDocument secureDocument = this.val$selfie;
final SecureDocument secureDocument2 = this.val$front;
final SecureDocument secureDocument3 = this.val$reverse;
final ArrayList arrayList2 = this.val$translationDocuments;
final String str2 = this.val$json;
final String str3 = this.val$documentsJson;
final int i = size;
final Runnable runnable = this.val$finishRunnable;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$onResult$0$PassportActivity$19$1(tL_error, errorRunnable, str, tL_account_saveSecureValue, z, tL_secureRequiredType, tL_secureRequiredType2, tL_secureValue, tL_secureValue2, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, i, runnable);
}
});
}
public 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 (i4 < size2) {
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)) {
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)) {
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)) {
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)) {
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();
for (int i6 = 0; i6 < size4; i6++) {
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)) {
renameFile(secureDocument5, tL_secureFile5);
break;
}
}
}
}
}
}
PassportActivity.this.setTypeValue(tL_secureRequiredType2, str, str2, tL_secureRequiredType, str3, z, i);
if (runnable != null) {
runnable.run();
}
}
@Override
public void run(TLObject tLObject, final 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 = this.val$text;
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(PassportActivity.this.currentAccount);
final String str = this.val$text;
final TLRPC.TL_secureRequiredType tL_secureRequiredType = this.val$requiredType;
final PassportActivityDelegate passportActivityDelegate = this.val$currentDelegate;
final ErrorRunnable errorRunnable = this.val$errorRunnable;
connectionsManager.sendRequest(tL_account_sendVerifyEmailCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$2$PassportActivity$19$1(str, tL_secureRequiredType, passportActivityDelegate, errorRunnable, tLObject2, tL_error2);
}
});
return;
} else if (tL_error.text.equals("PHONE_VERIFICATION_NEEDED")) {
final ErrorRunnable errorRunnable2 = this.val$errorRunnable;
final String str2 = this.val$text;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.ErrorRunnable.this.onError(tL_error.text, str2);
}
});
return;
}
}
if (tL_error == null && this.val$finalFileInputSecureValue != null) {
final TLRPC.TL_secureValue tL_secureValue = (TLRPC.TL_secureValue) tLObject;
TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = new TLRPC.TL_account_saveSecureValue();
tL_account_saveSecureValue.value = this.val$finalFileInputSecureValue;
tL_account_saveSecureValue.secure_secret_id = PassportActivity.this.secureSecretId;
ConnectionsManager.getInstance(PassportActivity.this.currentAccount).sendRequest(tL_account_saveSecureValue, new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$run$4$PassportActivity$19$1(tL_secureValue, tLObject2, tL_error2);
}
});
return;
}
lambda$run$4$PassportActivity$19$1(tL_error, (TLRPC.TL_secureValue) tLObject, null);
}
public void lambda$run$2$PassportActivity$19$1(final String str, final TLRPC.TL_secureRequiredType tL_secureRequiredType, final PassportActivityDelegate passportActivityDelegate, final ErrorRunnable errorRunnable, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass19.AnonymousClass1.this.lambda$null$1$PassportActivity$19$1(tLObject, str, tL_secureRequiredType, passportActivityDelegate, tL_error, errorRunnable);
}
});
}
public 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) {
PassportActivity.this.showAlertWithText(LocaleController.getString("PassportEmail", R.string.PassportEmail), tL_error.text);
if (errorRunnable != null) {
errorRunnable.onError(tL_error.text, str);
return;
}
return;
}
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);
}
}
@Override
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
public void deleteValue(TLRPC.TL_secureRequiredType tL_secureRequiredType3, TLRPC.TL_secureRequiredType tL_secureRequiredType4, ArrayList<TLRPC.TL_secureRequiredType> arrayList2, boolean z2, Runnable runnable, ErrorRunnable errorRunnable) {
PassportActivity.this.deleteValueInternal(tL_secureRequiredType3, tL_secureRequiredType4, arrayList2, z2, 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 (i2 == 4) {
passportActivity.currentEmail = this.currentEmail;
}
presentFragment(passportActivity);
}
}
public 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;
}
public void deleteValueInternal(final TLRPC.TL_secureRequiredType tL_secureRequiredType, final TLRPC.TL_secureRequiredType tL_secureRequiredType2, final ArrayList<TLRPC.TL_secureRequiredType> arrayList, final boolean z, final Runnable runnable, final ErrorRunnable errorRunnable, final boolean z2) {
if (tL_secureRequiredType == null) {
return;
}
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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$deleteValueInternal$61$PassportActivity(errorRunnable, z2, tL_secureRequiredType2, tL_secureRequiredType, z, arrayList, runnable, tLObject, tL_error);
}
});
}
public void lambda$deleteValueInternal$61$PassportActivity(final ErrorRunnable errorRunnable, final boolean z, final TLRPC.TL_secureRequiredType tL_secureRequiredType, final TLRPC.TL_secureRequiredType tL_secureRequiredType2, final boolean z2, final ArrayList arrayList, final Runnable runnable, TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$60$PassportActivity(tL_error, errorRunnable, z, tL_secureRequiredType, tL_secureRequiredType2, z2, arrayList, runnable);
}
});
}
public 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) {
TLRPC.TL_secureRequiredType tL_secureRequiredType3;
String str;
String str2;
LinearLayout linearLayout;
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);
View childAt = this.linearLayout2.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();
}
}
private TextDetailSecureCell addField(Context context, final TLRPC.TL_secureRequiredType tL_secureRequiredType, final ArrayList<TLRPC.TL_secureRequiredType> arrayList, final boolean z, boolean z2) {
String string;
String str;
String str2;
String str3;
TLRPC.TL_secureValue valueByType;
LinearLayout linearLayout;
String string2;
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()) {
string2 = LocaleController.getString("PassportPersonalDetails", R.string.PassportPersonalDetails);
} else if (z && arrayList.size() == 1) {
string2 = getTextForType(arrayList.get(0).type);
} else {
string2 = (z && arrayList.size() == 2) ? LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, getTextForType(arrayList.get(0).type), getTextForType(arrayList.get(1).type)) : LocaleController.getString("PassportIdentityDocument", R.string.PassportIdentityDocument);
}
textDetailSecureCell.setTextAndValue(string2, "", !z2);
} else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
if (arrayList == null || arrayList.isEmpty()) {
string = LocaleController.getString("PassportAddress", R.string.PassportAddress);
} else if (z && arrayList.size() == 1) {
string = getTextForType(arrayList.get(0).type);
} else {
string = (z && arrayList.size() == 2) ? LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, getTextForType(arrayList.get(0).type), getTextForType(arrayList.get(1).type)) : LocaleController.getString("PassportResidentialAddress", R.string.PassportResidentialAddress);
}
textDetailSecureCell.setTextAndValue(string, "", !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) {
this.linearLayout2.addView(textDetailSecureCell, linearLayout.getChildCount() - 5, LayoutHelper.createLinear(-1, -2));
} else {
this.linearLayout2.addView(textDetailSecureCell, LayoutHelper.createLinear(-1, -2));
}
textDetailSecureCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$addField$65$PassportActivity(arrayList, tL_secureRequiredType, z, 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) {
str = ((TLRPC.TL_securePlainEmail) valueByType2.plain_data).email;
} else if (valueByType2.plain_data instanceof TLRPC.TL_securePlainPhone) {
str = ((TLRPC.TL_securePlainPhone) valueByType2.plain_data).phone;
} else if (valueByType2.data != null) {
str2 = decryptData(valueByType2.data.data, decryptValueSecret(valueByType2.data.secret, valueByType2.data.data_hash), valueByType2.data.data_hash);
str = 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, str, str2, tL_secureRequiredType2, str3, z, size);
return textDetailSecureCell;
}
str2 = null;
if (arrayList != null) {
}
str3 = null;
setTypeValue(tL_secureRequiredType, str, str2, tL_secureRequiredType2, str3, z, size);
return textDetailSecureCell;
}
str = null;
str2 = null;
if (arrayList != null) {
}
str3 = null;
setTypeValue(tL_secureRequiredType, str, str2, tL_secureRequiredType2, str3, z, size);
return textDetailSecureCell;
}
public void lambda$addField$65$PassportActivity(final ArrayList arrayList, final TLRPC.TL_secureRequiredType tL_secureRequiredType, final boolean z, View view) {
TLRPC.TL_secureRequiredType tL_secureRequiredType2;
int i;
String str;
if (arrayList != null) {
int size = arrayList.size();
for (int i2 = 0; i2 < size; i2++) {
tL_secureRequiredType2 = (TLRPC.TL_secureRequiredType) arrayList.get(i2);
if (getValueByType(tL_secureRequiredType2, false) != null || size == 1) {
break;
}
}
}
tL_secureRequiredType2 = null;
if ((tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) || (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
if (tL_secureRequiredType2 == null && arrayList != null && !arrayList.isEmpty()) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
builder.setTitle(LocaleController.getString("PassportIdentityDocument", R.string.PassportIdentityDocument));
} else if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeAddress) {
builder.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));
}
}
builder.setItems((CharSequence[]) arrayList2.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
PassportActivity.this.lambda$null$62$PassportActivity(tL_secureRequiredType, arrayList, z, dialogInterface, i4);
}
});
showDialog(builder.create());
return;
}
} else {
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 builder2 = new AlertDialog.Builder(getParentActivity());
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
PassportActivity.this.lambda$null$64$PassportActivity(tL_secureRequiredType, z, dialogInterface, i4);
}
});
builder2.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (z2) {
i = R.string.PassportDeletePhoneAlert;
str = "PassportDeletePhoneAlert";
} else {
i = R.string.PassportDeleteEmailAlert;
str = "PassportDeleteEmailAlert";
}
builder2.setMessage(LocaleController.getString(str, i));
showDialog(builder2.create());
return;
}
}
openTypeActivity(tL_secureRequiredType, tL_secureRequiredType2, arrayList, z);
}
public 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 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() {
@Override
public final void run() {
PassportActivity.this.needHideProgress();
}
}, new ErrorRunnable() {
@Override
public final void onError(String str, String str2) {
PassportActivity.this.lambda$null$63$PassportActivity(str, str2);
}
}, z);
}
public void lambda$null$63$PassportActivity(String str, String str2) {
needHideProgress();
}
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);
}
public 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)) {
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;
}
return null;
}
public EncryptionResult createSecureDocument(String str) {
RandomAccessFile randomAccessFile;
byte[] bArr = new byte[(int) new File(str).length()];
RandomAccessFile randomAccessFile2 = null;
try {
randomAccessFile = new RandomAccessFile(str, "rws");
} catch (Exception unused) {
}
try {
randomAccessFile.readFully(bArr);
} catch (Exception unused2) {
randomAccessFile2 = randomAccessFile;
randomAccessFile = randomAccessFile2;
EncryptionResult encryptData = encryptData(bArr);
randomAccessFile.seek(0L);
randomAccessFile.write(encryptData.encryptedData);
randomAccessFile.close();
return encryptData;
}
EncryptionResult encryptData2 = encryptData(bArr);
randomAccessFile.seek(0L);
randomAccessFile.write(encryptData2.encryptedData);
randomAccessFile.close();
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)) {
int i = bArr6[0] & UByte.MAX_VALUE;
return new String(bArr6, i, length - i);
}
return null;
}
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;
}
return l == null || Utilities.bytesToLong(Utilities.computeSHA256(bArr)) == l.longValue();
}
public 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;
}
public 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);
}
public void showAlertWithText(String str, String str2) {
if (getParentActivity() == null) {
return;
}
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());
}
public void onPasscodeError(boolean z) {
if (getParentActivity() == null) {
return;
}
Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
if (z) {
this.inputFields[0].setText("");
}
AndroidUtilities.shakeView(this.inputFields[0], 2.0f, 0);
}
public void startPhoneVerification(boolean z, final String str, Runnable runnable, ErrorRunnable errorRunnable, final PassportActivityDelegate passportActivityDelegate) {
final 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$startPhoneVerification$67$PassportActivity(str, passportActivityDelegate, tL_account_sendVerifyPhoneCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$startPhoneVerification$67$PassportActivity(final String str, final PassportActivityDelegate passportActivityDelegate, final TLRPC.TL_account_sendVerifyPhoneCode tL_account_sendVerifyPhoneCode, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$66$PassportActivity(tL_error, str, passportActivityDelegate, tLObject, tL_account_sendVerifyPhoneCode);
}
});
}
public 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);
}
public void updatePasswordInterface() {
if (this.noPasswordImageView == null) {
return;
}
TLRPC.TL_account_password tL_account_password = this.currentPassword;
if (tL_account_password == null || this.usingSavedPassword != 0) {
this.noPasswordImageView.setVisibility(8);
this.noPasswordTextView.setVisibility(8);
this.noPasswordSetTextView.setVisibility(8);
this.passwordAvatarContainer.setVisibility(8);
this.inputFieldContainers[0].setVisibility(8);
this.doneItem.setVisibility(8);
this.passwordForgotButton.setVisibility(8);
this.passwordInfoRequestTextView.setVisibility(8);
this.passwordRequestTextView.setVisibility(8);
this.emptyView.setVisibility(0);
} 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(this.currentPassword.hint);
} else {
this.inputFields[0].setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
}
}
}
}
public 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() {
@Override
public void onAnimationEnd(Animator animator) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animator)) {
return;
}
if (!z2) {
PassportActivity.this.progressView.setVisibility(4);
} else {
PassportActivity.this.doneItem.getContentView().setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animator)) {
return;
}
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() {
@Override
public void onAnimationEnd(Animator animator) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animator)) {
return;
}
if (!z2) {
PassportActivity.this.progressViewButton.setVisibility(4);
} else {
PassportActivity.this.acceptTextView.setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animator)) {
return;
}
PassportActivity.this.doneItemAnimation = null;
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
}
}
@Override
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) {
} else {
if (i == NotificationCenter.didSetTwoStepPassword) {
if (objArr != null && objArr.length > 0) {
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 = -1L;
this.currentPassword.srp_B = new byte[256];
Utilities.random.nextBytes(this.currentPassword.srp_B);
EditTextBoldCursor[] editTextBoldCursorArr2 = this.inputFields;
if (editTextBoldCursorArr2[0] != null && editTextBoldCursorArr2[0].length() > 0) {
this.usingSavedPassword = 2;
}
}
} else {
this.currentPassword = null;
loadPasswordInfo();
}
updatePasswordInterface();
return;
}
int i3 = NotificationCenter.didRemoveTwoStepPassword;
}
}
@Override
public void onTransitionAnimationEnd(boolean z, boolean z2) {
if (this.presentAfterAnimation != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$onTransitionAnimationEnd$68$PassportActivity();
}
});
}
int i = this.currentActivityType;
if (i == 5) {
if (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 void lambda$onTransitionAnimationEnd$68$PassportActivity() {
presentFragment(this.presentAfterAnimation, true);
this.presentAfterAnimation = null;
}
private void showAttachmentError() {
if (getParentActivity() == null) {
return;
}
ToastUtils.show((int) R.string.UnsupportedAttachment);
}
@Override
public void onActivityResultFragment(int i, int i2, Intent intent) {
if (i2 == -1) {
if (i == 0 || i == 2) {
createChatAttachView();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onActivityResultFragment(i, intent, this.currentPicturePath);
}
this.currentPicturePath = null;
} else if (i == 1) {
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
public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) {
ChatAttachAlert chatAttachAlert;
TextSettingsCell textSettingsCell;
int i2 = this.currentActivityType;
if ((i2 != 1 && i2 != 2) || (chatAttachAlert = this.chatAttachAlert) == null) {
if (this.currentActivityType == 3 && i == 6) {
startPhoneVerification(false, this.pendingPhone, this.pendingFinishRunnable, this.pendingErrorRunnable, this.pendingDelegate);
}
} else if (i == 17 && chatAttachAlert != null) {
chatAttachAlert.checkCamera(false);
} else if (i == 21) {
if (getParentActivity() == null || iArr == null || iArr.length == 0 || iArr[0] == 0) {
return;
}
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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i3) {
PassportActivity.this.lambda$onRequestPermissionsResultFragment$69$PassportActivity(dialogInterface, i3);
}
});
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) {
} else {
textSettingsCell.callOnClick();
}
}
public 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
public void saveSelfArgs(Bundle bundle) {
String str = this.currentPicturePath;
if (str != null) {
bundle.putString("path", str);
}
}
@Override
public void restoreSelfArgs(Bundle bundle) {
this.currentPicturePath = bundle.getString("path");
}
@Override
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;
}
@Override
public void onDialogDismiss(Dialog dialog) {
if (this.currentActivityType != 3 || Build.VERSION.SDK_INT < 23 || dialog != this.permissionsDialog || this.permissionsItems.isEmpty()) {
return;
}
getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
}
public void needShowProgress() {
if (getParentActivity() == null || getParentActivity().isFinishing() || this.progressDialog != null) {
return;
}
AlertDialog alertDialog = new AlertDialog(getParentActivity(), 3);
this.progressDialog = alertDialog;
alertDialog.setCanCancel(false);
this.progressDialog.show();
}
public void needHideProgress() {
AlertDialog alertDialog = this.progressDialog;
if (alertDialog == null) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
this.progressDialog = null;
}
public void setPage(int 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(AndroidUtilities.displaySize.x);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.setDuration(300L);
animatorSet.playTogether(ObjectAnimator.ofFloat(slideView, "translationX", -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(slideView2, "translationX", 0.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
slideView2.setVisibility(0);
}
@Override
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);
}
}
public 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) {
return;
}
if (this.uploadingFileType == 0 && this.documents.size() >= 20) {
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("PassportUploadMaxReached", R.string.PassportUploadMaxReached, LocaleController.formatPluralString("Files", 20)));
return;
}
createChatAttachView();
this.chatAttachAlert.setOpenWithFrontFaceCamera(this.uploadingFileType == 1);
this.chatAttachAlert.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
this.chatAttachAlert.loadGalleryPhotos();
if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) {
AndroidUtilities.hideKeyboard(this.fragmentView.findFocus());
}
this.chatAttachAlert.init();
showDialog(this.chatAttachAlert);
}
private void createChatAttachView() {
if (getParentActivity() != null && this.chatAttachAlert == null) {
ChatAttachAlert chatAttachAlert = new ChatAttachAlert(getParentActivity(), this);
this.chatAttachAlert = chatAttachAlert;
chatAttachAlert.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() {
@Override
public void didSelectBot(TLRPC.User user) {
}
@Override
public View getRevealView() {
return null;
}
@Override
public void needEnterComment() {
}
@Override
public void didPressedButton(int i, boolean z, boolean z2, int i2) {
if (PassportActivity.this.getParentActivity() == null || PassportActivity.this.chatAttachAlert == null) {
return;
}
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()) {
return;
}
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;
}
if (PassportActivity.this.chatAttachAlert != null) {
PassportActivity.this.chatAttachAlert.dismissWithButtonClick(i);
}
PassportActivity.this.processSelectedAttach(i);
}
@Override
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;
}
public void processSelectedAttach(int i) {
if (i == 0) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 19);
return;
}
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.ovithmjoec.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 if (i == 1) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
return;
}
PhotoAlbumPickerActivity photoAlbumPickerActivity = new PhotoAlbumPickerActivity(0, false, false, null);
photoAlbumPickerActivity.setCurrentAccount(this.currentAccount);
photoAlbumPickerActivity.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
photoAlbumPickerActivity.setAllowSearchImages(false);
photoAlbumPickerActivity.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
@Override
public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList, boolean z, int i2, boolean z2) {
PassportActivity.this.processSelectedFiles(arrayList);
}
@Override
public void startPhotoSelectActivity() {
try {
Intent intent2 = new Intent("android.intent.action.PICK");
intent2.setType("image/*");
PassportActivity.this.startActivityForResult(intent2, 1);
} catch (Exception e2) {
FileLog.e(e2);
}
}
});
presentFragment(photoAlbumPickerActivity);
} else if (i == 4) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
return;
}
DocumentSelectActivity documentSelectActivity = new DocumentSelectActivity(false);
documentSelectActivity.setCurrentAccount(this.currentAccount);
documentSelectActivity.setCanSelectOnlyImageFiles(true);
documentSelectActivity.setMaxSelectedFiles(getMaxSelectedDocuments());
documentSelectActivity.setDelegate(new DocumentSelectActivity.DocumentSelectActivityDelegate() {
@Override
public void startMusicSelectActivity(BaseFragment baseFragment) {
DocumentSelectActivity.DocumentSelectActivityDelegate.CC.$default$startMusicSelectActivity(this, baseFragment);
}
@Override
public void didSelectFiles(DocumentSelectActivity documentSelectActivity2, ArrayList<String> arrayList, boolean z, int i2) {
documentSelectActivity2.finishFragment();
ArrayList arrayList2 = new ArrayList();
int size = arrayList.size();
for (int i3 = 0; i3 < size; i3++) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
sendingMediaInfo.path = arrayList.get(i3);
arrayList2.add(sendingMediaInfo);
}
PassportActivity.this.processSelectedFiles(arrayList2);
}
@Override
public void startDocumentSelectActivity() {
try {
Intent intent2 = new Intent("android.intent.action.GET_CONTENT");
if (Build.VERSION.SDK_INT >= 18) {
intent2.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
}
intent2.setType("*/*");
PassportActivity.this.startActivityForResult(intent2, 21);
} catch (Exception e2) {
FileLog.e(e2);
}
}
});
presentFragment(documentSelectActivity);
}
}
private void fillInitialValues() {
if (this.initialValues != null) {
return;
}
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();
}
public boolean isHasNotAnyChanges() {
String str = this.initialValues;
return str == null || str.equals(getCurrentValues());
}
public boolean checkDiscard() {
if (isHasNotAnyChanges()) {
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(LocaleController.getString("PassportDiscard", R.string.PassportDiscard), new DialogInterface.OnClickListener() {
@Override
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 void lambda$checkDiscard$70$PassportActivity(DialogInterface dialogInterface, int i) {
finishFragment();
}
public void processSelectedFiles(final ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList) {
if (arrayList.isEmpty()) {
return;
}
int i = this.uploadingFileType;
boolean z = true;
final 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;
}
final int i3 = this.uploadingFileType;
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$processSelectedFiles$73$PassportActivity(arrayList, i3, z2);
}
});
}
public void lambda$processSelectedFiles$73$PassportActivity(ArrayList arrayList, final int i, boolean z) {
TLRPC.PhotoSize scaleAndSaveImage;
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 = scaleAndSaveImage.location.local_id;
tL_secureFile.date = (int) (System.currentTimeMillis() / 1000);
final SecureDocument saveFile = this.delegate.saveFile(tL_secureFile);
saveFile.type = i;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$71$PassportActivity(saveFile, i);
}
});
if (z && !z2) {
try {
final MrzRecognizer.Result recognize = MrzRecognizer.recognize(loadBitmap, this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense);
if (recognize != null) {
try {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$null$72$PassportActivity(recognize);
}
});
z2 = true;
} catch (Throwable th) {
th = th;
z2 = true;
FileLog.e(th);
}
}
} catch (Throwable th2) {
th = th2;
}
}
}
}
SharedConfig.saveConfig();
}
public 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 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) {
this.currentExpireDate[0] = result.expiryYear;
this.currentExpireDate[1] = result.expiryMonth;
this.currentExpireDate[2] = result.expiryDay;
this.inputFields[8].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.expiryDay), Integer.valueOf(result.expiryMonth), Integer.valueOf(result.expiryYear)));
return;
}
int[] iArr = this.currentExpireDate;
iArr[2] = 0;
iArr[1] = 0;
iArr[0] = 0;
this.inputFields[8].setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
}
public void setNeedActivityResult(boolean z) {
this.needActivityResult = z;
}
private class ProgressView extends View {
private Paint paint;
private Paint paint2;
private float progress;
public ProgressView(Context context) {
super(context);
this.paint = new Paint();
this.paint2 = new Paint();
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();
}
@Override
protected void onDraw(Canvas canvas) {
float measuredWidth = (int) (getMeasuredWidth() * this.progress);
canvas.drawRect(0.0f, 0.0f, measuredWidth, getMeasuredHeight(), this.paint2);
canvas.drawRect(measuredWidth, 0.0f, getMeasuredWidth(), 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;
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;
private TextView timeText;
private Timer timeTimer;
private int timeout;
private final Object timerSync;
private TextView titleTextView;
private int verificationType;
private boolean waitingForEvent;
public static void lambda$onBackPressed$9(TLObject tLObject, TLRPC.TL_error tL_error) {
}
@Override
public boolean needBackButton() {
return true;
}
public PhoneConfirmationView(Context context, int i) {
super(context);
this.timerSync = new Object();
this.time = TimeConstants.MIN;
this.codeTime = 15000;
this.lastError = "";
this.pattern = "*";
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(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(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);
}
TextView textView3 = new TextView(context) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.timeText = textView3;
textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.timeText.setLineSpacing(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));
}
TextView textView4 = new TextView(context) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.problemText = textView4;
textView4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.problemText.setLineSpacing(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() {
@Override
public final void onClick(View view) {
PassportActivity.PhoneConfirmationView.this.lambda$new$0$PassportActivity$PhoneConfirmationView(view);
}
});
}
public void lambda$new$0$PassportActivity$PhoneConfirmationView(View view) {
if (this.nextPressed) {
return;
}
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));
}
}
@Override
protected void onMeasure(int i, int i2) {
ImageView imageView;
super.onMeasure(i, i2);
if (this.verificationType == 3 || (imageView = this.blueImageView) == null) {
return;
}
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) {
if (PassportActivity.this.scrollHeight <= dp2) {
setMeasuredDimension(getMeasuredWidth(), PassportActivity.this.scrollHeight);
return;
} else {
setMeasuredDimension(getMeasuredWidth(), dp2);
return;
}
}
setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
}
@Override
protected 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) {
return;
}
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);
}
public void resendCode() {
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
this.nextPressed = true;
PassportActivity.this.needShowProgress();
final 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.this.lambda$resendCode$3$PassportActivity$PhoneConfirmationView(bundle, tL_auth_resendCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$resendCode$3$PassportActivity$PhoneConfirmationView(final Bundle bundle, final TLRPC.TL_auth_resendCode tL_auth_resendCode, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.this.lambda$null$2$PassportActivity$PhoneConfirmationView(tL_error, bundle, tLObject, tL_auth_resendCode);
}
});
}
public 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() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.PhoneConfirmationView.this.lambda$null$1$PassportActivity$PhoneConfirmationView(dialogInterface, i);
}
});
}
}
PassportActivity.this.needHideProgress();
}
public void lambda$null$1$PassportActivity$PhoneConfirmationView(DialogInterface dialogInterface, int i) {
onBackPressed(true);
PassportActivity.this.finishFragment();
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void setParams(Bundle bundle, boolean z) {
int i;
int i2;
if (bundle == null) {
return;
}
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 = "";
if (editTextBoldCursorArr != null && editTextBoldCursorArr.length == this.length) {
int i6 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
if (i6 >= editTextBoldCursorArr2.length) {
break;
}
editTextBoldCursorArr2[i6].setText("");
i6++;
}
} else {
this.codeField = new EditTextBoldCursor[this.length];
final int i7 = 0;
while (i7 < this.length) {
this.codeField[i7] = new EditTextBoldCursor(getContext());
this.codeField[i7].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[i7].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[i7].setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField[i7].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[i7].setBackgroundDrawable(mutate);
this.codeField[i7].setImeOptions(268435461);
this.codeField[i7].setTextSize(1, 20.0f);
this.codeField[i7].setMaxLines(1);
this.codeField[i7].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.codeField[i7].setPadding(0, 0, 0, 0);
this.codeField[i7].setGravity(49);
if (this.verificationType == 3) {
this.codeField[i7].setEnabled(false);
this.codeField[i7].setInputType(0);
this.codeField[i7].setVisibility(8);
} else {
this.codeField[i7].setInputType(3);
}
this.codeFieldContainer.addView(this.codeField[i7], LayoutHelper.createLinear(34, 36, 1, 0, 0, i7 != this.length - 1 ? 7 : 0, 0));
this.codeField[i7].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence2, int i8, int i9, int i10) {
}
@Override
public void onTextChanged(CharSequence charSequence2, int i8, int i9, int i10) {
}
@Override
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 i8 = 0; i8 < Math.min(PhoneConfirmationView.this.length - i7, length); i8++) {
if (i8 != 0) {
PhoneConfirmationView.this.codeField[i7 + i8].setText(obj.substring(i8, i8 + 1));
} else {
editable.replace(0, length, obj.substring(i8, i8 + 1));
}
}
PhoneConfirmationView.this.ignoreOnTextChange = false;
}
if (i7 != PhoneConfirmationView.this.length - 1) {
PhoneConfirmationView.this.codeField[i7 + 1].setSelection(PhoneConfirmationView.this.codeField[i7 + 1].length());
PhoneConfirmationView.this.codeField[i7 + 1].requestFocus();
}
if ((i7 == PhoneConfirmationView.this.length - 1 || (i7 == PhoneConfirmationView.this.length - 2 && length >= 2)) && PhoneConfirmationView.this.getCode().length() == PhoneConfirmationView.this.length) {
PhoneConfirmationView.this.onNextPressed();
}
}
}
});
this.codeField[i7].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i8, KeyEvent keyEvent) {
return PassportActivity.PhoneConfirmationView.this.lambda$setParams$4$PassportActivity$PhoneConfirmationView(i7, view, i8, keyEvent);
}
});
this.codeField[i7].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i8, KeyEvent keyEvent) {
return PassportActivity.PhoneConfirmationView.this.lambda$setParams$5$PassportActivity$PhoneConfirmationView(textView, i8, keyEvent);
}
});
i7++;
}
}
ProgressView progressView = this.progressView;
if (progressView != null) {
progressView.setVisibility(this.nextType != 0 ? 0 : 8);
}
if (this.phone == null) {
return;
}
PhoneFormat phoneFormat = PhoneFormat.getInstance();
String format = phoneFormat.format(Marker.ANY_NON_NULL_MARKER + this.phone);
int i8 = this.verificationType;
if (i8 == 2) {
charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(format)));
} else if (i8 == 3) {
charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(format)));
} else if (i8 == 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 = System.currentTimeMillis();
if (this.verificationType == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
this.problemText.setVisibility(8);
this.timeText.setVisibility(0);
int i9 = this.nextType;
if (i9 == 4) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
} else if (i9 == 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);
this.timeText.setVisibility(this.time >= 1000 ? 0 : 8);
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);
this.timeText.setVisibility(this.time >= 1000 ? 0 : 8);
createTimer();
} else {
this.timeText.setVisibility(8);
this.problemText.setVisibility(8);
createCodeTimer();
}
}
public boolean lambda$setParams$4$PassportActivity$PhoneConfirmationView(int i, View view, int i2, KeyEvent keyEvent) {
if (i2 == 67 && this.codeField[i].length() == 0 && i > 0) {
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;
}
return false;
}
public boolean lambda$setParams$5$PassportActivity$PhoneConfirmationView(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public void createCodeTimer() {
if (this.codeTimer != null) {
return;
}
this.codeTime = 15000;
this.codeTimer = new Timer();
this.lastCodeTime = System.currentTimeMillis();
this.codeTimer.schedule(new AnonymousClass4(), 0L, 1000L);
}
public class AnonymousClass4 extends TimerTask {
AnonymousClass4() {
}
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.AnonymousClass4.this.lambda$run$0$PassportActivity$PhoneConfirmationView$4();
}
});
}
public void lambda$run$0$PassportActivity$PhoneConfirmationView$4() {
double currentTimeMillis = System.currentTimeMillis();
double d = PhoneConfirmationView.this.lastCodeTime;
Double.isNaN(currentTimeMillis);
double d2 = currentTimeMillis - d;
PhoneConfirmationView.this.lastCodeTime = currentTimeMillis;
PhoneConfirmationView phoneConfirmationView = PhoneConfirmationView.this;
double d3 = 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();
}
}
}
public 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) {
return;
}
Timer timer = new Timer();
this.timeTimer = timer;
timer.schedule(new TimerTask() {
@Override
public void run() {
if (PhoneConfirmationView.this.timeTimer == null) {
return;
}
double currentTimeMillis = System.currentTimeMillis();
double d = PhoneConfirmationView.this.lastCurrentTime;
Double.isNaN(currentTimeMillis);
PhoneConfirmationView phoneConfirmationView = PhoneConfirmationView.this;
double d2 = phoneConfirmationView.time;
Double.isNaN(d2);
phoneConfirmationView.time = (int) (d2 - (currentTimeMillis - d));
PhoneConfirmationView.this.lastCurrentTime = currentTimeMillis;
AndroidUtilities.runOnUIThread(new AnonymousClass1());
}
public class AnonymousClass1 implements Runnable {
AnonymousClass1() {
}
@Override
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 - (PhoneConfirmationView.this.time / PhoneConfirmationView.this.timeout));
return;
}
return;
}
if (PhoneConfirmationView.this.progressView != null) {
PhoneConfirmationView.this.progressView.setProgress(1.0f);
}
PhoneConfirmationView.this.destroyTimer();
if (PhoneConfirmationView.this.verificationType != 3) {
if (PhoneConfirmationView.this.verificationType == 2 || PhoneConfirmationView.this.verificationType == 4) {
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() {
@Override
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);
return;
} 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();
return;
} else {
return;
}
}
return;
}
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
PhoneConfirmationView.this.waitingForEvent = false;
PhoneConfirmationView.this.destroyCodeTimer();
PhoneConfirmationView.this.resendCode();
}
public void lambda$run$1$PassportActivity$PhoneConfirmationView$5$1(TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tL_error == null || tL_error.text == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.AnonymousClass5.AnonymousClass1.this.lambda$null$0$PassportActivity$PhoneConfirmationView$5$1(tL_error);
}
});
}
public void lambda$null$0$PassportActivity$PhoneConfirmationView$5$1(TLRPC.TL_error tL_error) {
PhoneConfirmationView.this.lastError = tL_error.text;
}
}
}, 0L, 1000L);
}
public void destroyTimer() {
try {
synchronized (this.timerSync) {
if (this.timeTimer != null) {
this.timeTimer.cancel();
this.timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public String getCode() {
if (this.codeField == null) {
return "";
}
StringBuilder sb = new StringBuilder();
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i < editTextBoldCursorArr.length) {
sb.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[i].getText().toString()));
i++;
} else {
return sb.toString();
}
}
}
@Override
public void onNextPressed() {
if (this.nextPressed) {
return;
}
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);
final 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() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.this.lambda$onNextPressed$7$PassportActivity$PhoneConfirmationView(tL_account_verifyPhone, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$7$PassportActivity$PhoneConfirmationView(final TLRPC.TL_account_verifyPhone tL_account_verifyPhone, TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.this.lambda$null$6$PassportActivity$PhoneConfirmationView(tL_error, tL_account_verifyPhone);
}
});
}
public 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();
PassportActivityDelegate passportActivityDelegate = PassportActivity.this.delegate;
TLRPC.TL_secureRequiredType tL_secureRequiredType = PassportActivity.this.currentType;
String str = (String) PassportActivity.this.currentValues.get("phone");
final PassportActivity passportActivity = PassportActivity.this;
passportActivityDelegate.saveValue(tL_secureRequiredType, str, null, null, null, null, null, null, null, null, new Runnable() {
@Override
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")) {
if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
PassportActivity.this.setPage(0, true, null);
return;
}
return;
}
int i4 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i4 < editTextBoldCursorArr.length) {
editTextBoldCursorArr[i4].setText("");
i4++;
} else {
editTextBoldCursorArr[0].requestFocus();
return;
}
}
}
@Override
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() {
@Override
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, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.lambda$onBackPressed$9(tLObject, tL_error);
}
}, 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 void lambda$onBackPressed$8$PassportActivity$PhoneConfirmationView(DialogInterface dialogInterface, int i) {
onBackPressed(true);
PassportActivity.this.setPage(0, true, null);
}
@Override
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
public void onShow() {
super.onShow();
LinearLayout linearLayout = this.codeFieldContainer;
if (linearLayout == null || linearLayout.getVisibility() != 0) {
return;
}
for (int length = this.codeField.length - 1; length >= 0; length--) {
if (length == 0 || this.codeField[length].length() != 0) {
this.codeField[length].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
editTextBoldCursorArr[length].setSelection(editTextBoldCursorArr[length].length());
AndroidUtilities.showKeyboard(this.codeField[length]);
return;
}
}
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (!this.waitingForEvent || this.codeField == null) {
return;
}
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
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));
if (this.extraBackgroundView2 != null) {
arrayList.add(new ThemeDescription(this.extraBackgroundView2, 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) {
for (int i2 = 0; i2 < this.inputFields.length; i2++) {
arrayList.add(new ThemeDescription((View) this.inputFields[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));
}
} 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) {
for (int i3 = 0; i3 < this.inputExtraFields.length; i3++) {
arrayList.add(new ThemeDescription((View) this.inputExtraFields[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));
}
}
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]);
}
}