正在查看: Plus 12 v10.13.1.1 应用的 PassportActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 PassportActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.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.PhoneNumberUtils;
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.util.Property;
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.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.crypto.Cipher;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.DispatchQueue;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MrzRecognizer;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.PushListenerController;
import org.telegram.messenger.R;
import org.telegram.messenger.SRPHelper;
import org.telegram.messenger.SecureDocument;
import org.telegram.messenger.SecureDocumentKey;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.browser.Browser;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.CameraScanActivity;
import org.telegram.ui.Cells.CheckBoxCell;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextDetailSettingsCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.ChatAttachAlert;
import org.telegram.ui.Components.ContextProgressView;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.EmptyTextProgressView;
import org.telegram.ui.Components.HintEditText;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.Premium.boosts.BoostRepository$$ExternalSyntheticLambda31;
import org.telegram.ui.Components.RadialProgress;
import org.telegram.ui.Components.SlideView;
import org.telegram.ui.CountrySelectActivity;
import org.telegram.ui.PassportActivity;
import org.telegram.ui.PhotoViewer;
public class PassportActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
public TextView acceptTextView;
public TextSettingsCell addDocumentCell;
public ShadowSectionCell addDocumentSectionCell;
public boolean allowNonLatinName;
public ArrayList<TLRPC.TL_secureRequiredType> availableDocumentTypes;
public TextInfoPrivacyCell bottomCell;
public TextInfoPrivacyCell bottomCellTranslation;
public FrameLayout bottomLayout;
public boolean callbackCalled;
public ChatAttachAlert chatAttachAlert;
public HashMap<String, String> codesMap;
public ArrayList<String> countriesArray;
public HashMap<String, String> countriesMap;
public int currentActivityType;
public long currentBotId;
public String currentCallbackUrl;
public String currentCitizeship;
public HashMap<String, String> currentDocumentValues;
public TLRPC.TL_secureRequiredType currentDocumentsType;
public TLRPC.TL_secureValue currentDocumentsTypeValue;
public String currentEmail;
public int[] currentExpireDate;
public TLRPC.TL_account_authorizationForm currentForm;
public String currentGender;
public String currentNonce;
public TLRPC.account_Password currentPassword;
public String currentPayload;
public TLRPC.TL_auth_sentCode currentPhoneVerification;
public LinearLayout currentPhotoViewerLayout;
public String currentPicturePath;
public String currentPublicKey;
public String currentResidence;
public String currentScope;
public TLRPC.TL_secureRequiredType currentType;
public TLRPC.TL_secureValue currentTypeValue;
public HashMap<String, String> currentValues;
public int currentViewNum;
public PassportActivityDelegate delegate;
public TextSettingsCell deletePassportCell;
public ArrayList<View> dividers;
public boolean documentOnly;
public ArrayList<SecureDocument> documents;
public HashMap<SecureDocument, SecureDocumentCell> documentsCells;
public HashMap<String, String> documentsErrors;
public LinearLayout documentsLayout;
public HashMap<TLRPC.TL_secureRequiredType, TLRPC.TL_secureRequiredType> documentsToTypesLink;
public ActionBarMenuItem doneItem;
public AnimatorSet doneItemAnimation;
public int emailCodeLength;
public ImageView emptyImageView;
public LinearLayout emptyLayout;
public TextView emptyTextView1;
public TextView emptyTextView2;
public TextView emptyTextView3;
public EmptyTextProgressView emptyView;
public HashMap<String, HashMap<String, String>> errorsMap;
public HashMap<String, String> errorsValues;
public View extraBackgroundView;
public View extraBackgroundView2;
public HashMap<String, String> fieldsErrors;
public SecureDocument frontDocument;
public LinearLayout frontLayout;
public HeaderCell headerCell;
public boolean ignoreOnFailure;
public boolean ignoreOnPhoneChange;
public boolean ignoreOnTextChange;
public String initialValues;
public EditTextBoldCursor[] inputExtraFields;
public ViewGroup[] inputFieldContainers;
public EditTextBoldCursor[] inputFields;
public HashMap<String, String> languageMap;
public LinearLayout linearLayout2;
public HashMap<String, String> mainErrorsMap;
public TextInfoPrivacyCell nativeInfoCell;
public boolean needActivityResult;
public CharSequence noAllDocumentsErrorText;
public CharSequence noAllTranslationErrorText;
public ImageView noPasswordImageView;
public TextView noPasswordSetTextView;
public TextView noPasswordTextView;
public boolean[] nonLatinNames;
public FrameLayout passwordAvatarContainer;
public TextView passwordForgotButton;
public TextInfoPrivacyCell passwordInfoRequestTextView;
public TextInfoPrivacyCell passwordRequestTextView;
public PassportActivityDelegate pendingDelegate;
public ErrorRunnable pendingErrorRunnable;
public Runnable pendingFinishRunnable;
public String pendingPhone;
public Dialog permissionsDialog;
public ArrayList<String> permissionsItems;
public HashMap<String, String> phoneFormatMap;
public TextView plusTextView;
public PassportActivity presentAfterAnimation;
public AlertDialog progressDialog;
public ContextProgressView progressView;
public ContextProgressView progressViewButton;
public PhotoViewer.PhotoViewerProvider provider;
public SecureDocument reverseDocument;
public LinearLayout reverseLayout;
public byte[] saltedPassword;
public byte[] savedPasswordHash;
public byte[] savedSaltedPassword;
public TextSettingsCell scanDocumentCell;
public int scrollHeight;
public ScrollView scrollView;
public ShadowSectionCell sectionCell;
public ShadowSectionCell sectionCell2;
public byte[] secureSecret;
public long secureSecretId;
public SecureDocument selfieDocument;
public LinearLayout selfieLayout;
public TextInfoPrivacyCell topErrorCell;
public ArrayList<SecureDocument> translationDocuments;
public LinearLayout translationLayout;
public HashMap<TLRPC.TL_secureRequiredType, HashMap<String, String>> typesValues;
public HashMap<TLRPC.TL_secureRequiredType, TextDetailSecureCell> typesViews;
public TextSettingsCell uploadDocumentCell;
public TextDetailSettingsCell uploadFrontCell;
public TextDetailSettingsCell uploadReverseCell;
public TextDetailSettingsCell uploadSelfieCell;
public TextSettingsCell uploadTranslationCell;
public HashMap<String, SecureDocument> uploadingDocuments;
public int uploadingFileType;
public boolean useCurrentValue;
public int usingSavedPassword;
public SlideView[] views;
public interface ErrorRunnable {
void onError(String error, String text);
}
public interface PassportActivityDelegate {
void deleteValue(TLRPC.TL_secureRequiredType type, TLRPC.TL_secureRequiredType documentType, ArrayList<TLRPC.TL_secureRequiredType> documentRequiredTypes, boolean deleteType, Runnable finishRunnable, ErrorRunnable errorRunnable);
SecureDocument saveFile(TLRPC.TL_secureFile secureFile);
void saveValue(TLRPC.TL_secureRequiredType type, String text, String json, TLRPC.TL_secureRequiredType documentType, String documentsJson, ArrayList<SecureDocument> documents, SecureDocument selfie, ArrayList<SecureDocument> translationDocuments, SecureDocument front, SecureDocument reverse, Runnable finishRunnable, ErrorRunnable errorRunnable);
}
public class LinkSpan extends ClickableSpan {
public LinkSpan() {
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(true);
ds.setTypeface(AndroidUtilities.bold());
}
@Override
public void onClick(View widget) {
Browser.openUrl(PassportActivity.this.getParentActivity(), PassportActivity.this.currentForm.privacy_policy_url);
}
}
public class TextDetailSecureCell extends FrameLayout {
public ImageView checkImageView;
public boolean needDivider;
public TextView textView;
public TextView valueTextView;
public TextDetailSecureCell(final PassportActivity this$0, Context context) {
super(context);
int i = this$0.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);
TextView textView2 = this.textView;
boolean z = LocaleController.isRTL;
addView(textView2, LayoutHelper.createFrame(-2, -2.0f, (z ? 5 : 3) | 48, z ? i : 21, 10.0f, z ? 21 : i, 0.0f));
TextView textView3 = new TextView(context);
this.valueTextView = textView3;
textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
this.valueTextView.setTextSize(1, 13.0f);
this.valueTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.valueTextView.setLines(1);
this.valueTextView.setMaxLines(1);
this.valueTextView.setSingleLine(true);
this.valueTextView.setEllipsize(TextUtils.TruncateAt.END);
this.valueTextView.setPadding(0, 0, 0, 0);
TextView textView4 = this.valueTextView;
boolean z2 = LocaleController.isRTL;
addView(textView4, LayoutHelper.createFrame(-2, -2.0f, (z2 ? 5 : 3) | 48, z2 ? i : 21, 35.0f, z2 ? 21 : i, 0.0f));
ImageView imageView = new ImageView(context);
this.checkImageView = imageView;
imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
this.checkImageView.setImageResource(R.drawable.sticker_added);
addView(this.checkImageView, LayoutHelper.createFrame(-2, -2.0f, (LocaleController.isRTL ? 3 : 5) | 48, 21.0f, 25.0f, 21.0f, 0.0f));
}
@Override
public void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.needDivider ? 1 : 0), 1073741824));
}
public void setTextAndValue(String text, CharSequence value, boolean divider) {
this.textView.setText(text);
this.valueTextView.setText(value);
this.needDivider = divider;
setWillNotDraw(!divider);
}
public void setChecked(boolean checked) {
this.checkImageView.setVisibility(checked ? 0 : 4);
}
public void setValue(CharSequence value) {
this.valueTextView.setText(value);
}
public void setNeedDivider(boolean value) {
this.needDivider = value;
setWillNotDraw(!value);
invalidate();
}
@Override
public 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 {
public int TAG;
public int buttonState;
public SecureDocument currentSecureDocument;
public BackupImageView imageView;
public RadialProgress radialProgress;
public TextView textView;
public TextView valueTextView;
public SecureDocumentCell(Context context) {
super(context);
this.TAG = DownloadController.getInstance(((BaseFragment) PassportActivity.this).currentAccount).generateObserverTag();
this.radialProgress = new RadialProgress(this);
BackupImageView backupImageView = new BackupImageView(context);
this.imageView = backupImageView;
addView((View) backupImageView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(48, 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);
TextView textView2 = this.textView;
boolean z = LocaleController.isRTL;
addView(textView2, LayoutHelper.createFrame(-2, -2.0f, (z ? 5 : 3) | 48, z ? 21 : 81, 10.0f, z ? 81 : 21, 0.0f));
TextView textView3 = new TextView(context);
this.valueTextView = textView3;
textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
this.valueTextView.setTextSize(1, 13.0f);
this.valueTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.valueTextView.setLines(1);
this.valueTextView.setMaxLines(1);
this.valueTextView.setSingleLine(true);
this.valueTextView.setPadding(0, 0, 0, 0);
TextView textView4 = this.valueTextView;
boolean z2 = LocaleController.isRTL;
addView(textView4, LayoutHelper.createFrame(-2, -2.0f, (z2 ? 5 : 3) | 48, z2 ? 21 : 81, 35.0f, z2 ? 81 : 21, 0.0f));
setWillNotDraw(false);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + 1, 1073741824));
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
int left2 = this.imageView.getLeft() + ((this.imageView.getMeasuredWidth() - AndroidUtilities.dp(24.0f)) / 2);
int top2 = this.imageView.getTop() + ((this.imageView.getMeasuredHeight() - AndroidUtilities.dp(24.0f)) / 2);
this.radialProgress.setProgressRect(left2, top2, AndroidUtilities.dp(24.0f) + left2, AndroidUtilities.dp(24.0f) + top2);
}
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
boolean drawChild = super.drawChild(canvas, child, drawingTime);
if (child == this.imageView) {
this.radialProgress.draw(canvas);
}
return drawChild;
}
public void setTextAndValueAndImage(String text, CharSequence value, SecureDocument document) {
this.textView.setText(text);
this.valueTextView.setText(value);
this.imageView.setImage(document, "48_48");
this.currentSecureDocument = document;
updateButtonState(false);
}
public void setValue(CharSequence value) {
this.valueTextView.setText(value);
}
public void updateButtonState(boolean animated) {
String attachFileName = FileLoader.getAttachFileName(this.currentSecureDocument);
boolean exists = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(this.currentSecureDocument).exists();
if (TextUtils.isEmpty(attachFileName)) {
this.radialProgress.setBackground((Drawable) null, false, false);
return;
}
SecureDocument secureDocument = this.currentSecureDocument;
if (secureDocument.path != null) {
if (secureDocument.inputFile != null) {
DownloadController.getInstance(((BaseFragment) PassportActivity.this).currentAccount).removeLoadingFileObserver(this);
this.radialProgress.setBackground((Drawable) null, false, animated);
this.buttonState = -1;
return;
} else {
DownloadController.getInstance(((BaseFragment) PassportActivity.this).currentAccount).addLoadingFileObserver(this.currentSecureDocument.path, this);
this.buttonState = 1;
Float fileProgress = ImageLoader.getInstance().getFileProgress(this.currentSecureDocument.path);
this.radialProgress.setBackground(getResources().getDrawable(R.drawable.circle), true, animated);
this.radialProgress.setProgress(fileProgress != null ? fileProgress.floatValue() : 0.0f, false);
invalidate();
return;
}
}
if (exists) {
DownloadController.getInstance(((BaseFragment) PassportActivity.this).currentAccount).removeLoadingFileObserver(this);
this.buttonState = -1;
this.radialProgress.setBackground((Drawable) null, false, animated);
invalidate();
return;
}
DownloadController.getInstance(((BaseFragment) PassportActivity.this).currentAccount).addLoadingFileObserver(attachFileName, this);
this.buttonState = 1;
Float fileProgress2 = ImageLoader.getInstance().getFileProgress(attachFileName);
this.radialProgress.setBackground(getResources().getDrawable(R.drawable.circle), true, animated);
this.radialProgress.setProgress(fileProgress2 != null ? fileProgress2.floatValue() : 0.0f, animated);
invalidate();
}
@Override
public void invalidate() {
super.invalidate();
this.textView.invalidate();
}
@Override
public 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);
}
public void onFailedDownload(String fileName, boolean canceled) {
updateButtonState(false);
}
public void onSuccessDownload(String fileName) {
this.radialProgress.setProgress(1.0f, true);
updateButtonState(true);
}
public void onProgressDownload(String fileName, long downloadedSize, long totalSize) {
this.radialProgress.setProgress(Math.min(1.0f, downloadedSize / totalSize), true);
if (this.buttonState != 1) {
updateButtonState(false);
}
}
public void onProgressUpload(String fileName, long uploadedSize, long totalSize, boolean isEncrypted) {
this.radialProgress.setProgress(Math.min(1.0f, uploadedSize / totalSize), true);
}
public int getObserverTag() {
return this.TAG;
}
}
public PassportActivity(int r20, long r21, java.lang.String r23, java.lang.String r24, java.lang.String r25, java.lang.String r26, java.lang.String r27, org.telegram.tgnet.TLRPC.TL_account_authorizationForm r28, org.telegram.tgnet.TLRPC.account_Password r29) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.<init>(int, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.telegram.tgnet.TLRPC$TL_account_authorizationForm, org.telegram.tgnet.TLRPC$account_Password):void");
}
public PassportActivity(int type, TLRPC.TL_account_authorizationForm form, TLRPC.account_Password accountPassword, TLRPC.TL_secureRequiredType secureType, TLRPC.TL_secureValue secureValue, TLRPC.TL_secureRequiredType secureDocumentsType, TLRPC.TL_secureValue secureDocumentsValue, HashMap<String, String> values, HashMap<String, String> documentValues) {
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 index, boolean needPreview) {
if (index < 0 || index >= PassportActivity.this.currentPhotoViewerLayout.getChildCount()) {
return null;
}
SecureDocumentCell secureDocumentCell = (SecureDocumentCell) PassportActivity.this.currentPhotoViewerLayout.getChildAt(index);
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;
ImageReceiver imageReceiver = secureDocumentCell.imageView.getImageReceiver();
placeProviderObject.imageReceiver = imageReceiver;
placeProviderObject.thumb = imageReceiver.getBitmapSafe();
return placeProviderObject;
}
@Override
public void deleteImageAtIndex(int index) {
SecureDocument secureDocument;
if (PassportActivity.this.uploadingFileType == 1) {
secureDocument = PassportActivity.this.selfieDocument;
} else if (PassportActivity.this.uploadingFileType == 4) {
secureDocument = (SecureDocument) PassportActivity.this.translationDocuments.get(index);
} else if (PassportActivity.this.uploadingFileType == 2) {
secureDocument = PassportActivity.this.frontDocument;
} else if (PassportActivity.this.uploadingFileType == 3) {
secureDocument = PassportActivity.this.reverseDocument;
} else {
secureDocument = (SecureDocument) PassportActivity.this.documents.get(index);
}
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) {
str = "translation" + documentHash;
} else if (PassportActivity.this.uploadingFileType == 2) {
PassportActivity.this.frontDocument = null;
str = "front" + documentHash;
} else if (PassportActivity.this.uploadingFileType == 3) {
PassportActivity.this.reverseDocument = null;
str = "reverse" + documentHash;
} else if (PassportActivity.this.uploadingFileType == 0) {
str = "files" + documentHash;
}
if (str != null) {
if (PassportActivity.this.documentsErrors != null) {
PassportActivity.this.documentsErrors.remove(str);
}
if (PassportActivity.this.errorsValues != null) {
PassportActivity.this.errorsValues.remove(str);
}
}
PassportActivity passportActivity = PassportActivity.this;
passportActivity.updateUploadText(passportActivity.uploadingFileType);
PassportActivity.this.currentPhotoViewerLayout.removeView(secureDocumentCell);
}
@Override
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 = type;
this.currentForm = form;
this.currentType = secureType;
if (secureType != null) {
this.allowNonLatinName = secureType.native_names;
}
this.currentTypeValue = secureValue;
this.currentDocumentsType = secureDocumentsType;
this.currentDocumentsTypeValue = secureDocumentsValue;
this.currentPassword = accountPassword;
this.currentValues = values;
this.currentDocumentValues = documentValues;
if (type == 3) {
this.permissionsItems = new ArrayList<>();
} else if (type == 7) {
this.views = new SlideView[3];
}
if (this.currentValues == null) {
this.currentValues = new HashMap<>();
}
if (this.currentDocumentValues == null) {
this.currentDocumentValues = new HashMap<>();
}
if (type == 5) {
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).savedPasswordHash != null && UserConfig.getInstance(((BaseFragment) this).currentAccount).savedSaltedPassword != null) {
this.usingSavedPassword = 1;
this.savedPasswordHash = UserConfig.getInstance(((BaseFragment) this).currentAccount).savedPasswordHash;
this.savedSaltedPassword = UserConfig.getInstance(((BaseFragment) this).currentAccount).savedSaltedPassword;
}
TLRPC.account_Password account_password = this.currentPassword;
if (account_password == null) {
loadPasswordInfo();
} else {
TwoStepVerificationActivity.initPasswordNewAlgo(account_password);
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(((BaseFragment) this).currentAccount).sendRequest(tL_help_getPassportConfig, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.lambda$new$1(tLObject, tL_error);
}
});
}
}
public static void lambda$new$1(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.lambda$new$0(tLObject);
}
});
}
public static void lambda$new$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);
} else {
SharedConfig.getCountryLangs();
}
}
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();
}
}, 200L);
}
AndroidUtilities.requestAdjustResize(getParentActivity(), ((BaseFragment) this).classGuid);
}
public void lambda$onResume$2() {
ViewGroup[] viewGroupArr = this.inputFieldContainers;
if (viewGroupArr == null || viewGroupArr[0] == null || viewGroupArr[0].getVisibility() != 0) {
return;
}
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
public void onPause() {
super.onPause();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onPause();
}
}
public boolean onFragmentCreate() {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.fileUploadFailed);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.didRemoveTwoStepPassword);
return super.onFragmentCreate();
}
public void onFragmentDestroy() {
super.onFragmentDestroy();
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.fileUploadFailed);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(((BaseFragment) 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;
}
}
}
public View createView(Context context) {
ChatAttachAlert chatAttachAlert;
((BaseFragment) this).actionBar.setBackButtonImage(R.drawable.ic_ab_back);
((BaseFragment) this).actionBar.setAllowOverlayTitle(true);
((BaseFragment) this).actionBar.setActionBarMenuOnItemClick(new AnonymousClass3());
if (this.currentActivityType == 7) {
ScrollView scrollView = new ScrollView(context) {
@Override
public boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
return false;
}
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
if (PassportActivity.this.currentViewNum == 1 || PassportActivity.this.currentViewNum == 2 || PassportActivity.this.currentViewNum == 4) {
rectangle.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
PassportActivity.this.scrollHeight = View.MeasureSpec.getSize(heightMeasureSpec) - AndroidUtilities.dp(30.0f);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
this.scrollView = scrollView;
((BaseFragment) this).fragmentView = scrollView;
scrollView.setFillViewport(true);
AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor(Theme.key_actionBarDefault));
} else {
FrameLayout frameLayout = new FrameLayout(context);
((BaseFragment) this).fragmentView = frameLayout;
FrameLayout frameLayout2 = frameLayout;
frameLayout.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundGray));
ScrollView scrollView2 = new ScrollView(this, context) {
@Override
public boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
return false;
}
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());
rectangle.top += AndroidUtilities.dp(20.0f);
rectangle.bottom += AndroidUtilities.dp(50.0f);
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
}
};
this.scrollView = scrollView2;
scrollView2.setFillViewport(true);
AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor(Theme.key_actionBarDefault));
frameLayout2.addView(this.scrollView, LayoutHelper.createFrame(-1, -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 = ((BaseFragment) this).actionBar.createMenu().addItemWithWidth(2, R.drawable.ic_ab_done, AndroidUtilities.dp(56.0f), LocaleController.getString("Done", R.string.Done));
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((View) this.progressView, (ViewGroup.LayoutParams) 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 ((BaseFragment) this).fragmentView;
}
public class AnonymousClass3 extends ActionBar.ActionBarMenuOnItemClick {
public AnonymousClass3() {
}
public final boolean onIdentityDone(final java.lang.Runnable r26, final org.telegram.ui.PassportActivity.ErrorRunnable r27) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.AnonymousClass3.onIdentityDone(java.lang.Runnable, org.telegram.ui.PassportActivity$ErrorRunnable):boolean");
}
public void lambda$onIdentityDone$0(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(int i, DialogInterface dialogInterface, int i2) {
PassportActivity passportActivity = PassportActivity.this;
passportActivity.onFieldError(passportActivity.inputFields[i]);
}
public int lambda$onIdentityDone$2(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(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 r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.AnonymousClass3.onItemClick(int):void");
}
public void lambda$onItemClick$4() {
PassportActivity.this.finishFragment();
}
public void lambda$onItemClick$6(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$onItemClick$5(tL_error, runnable, errorRunnable, tL_account_verifyEmail);
}
});
}
public void lambda$onItemClick$5(TLRPC.TL_error tL_error, Runnable runnable, ErrorRunnable errorRunnable, TLRPC.TL_account_verifyEmail tL_account_verifyEmail) {
if (tL_error != null) {
AlertsCreator.processError(((BaseFragment) PassportActivity.this).currentAccount, tL_error, PassportActivity.this, tL_account_verifyEmail, new Object[0]);
errorRunnable.onError(null, null);
} else {
PassportActivity.this.delegate.saveValue(PassportActivity.this.currentType, (String) PassportActivity.this.currentValues.get("email"), null, null, null, null, null, null, null, null, runnable, errorRunnable);
}
}
}
public boolean dismissDialogOnPause(Dialog dialog) {
return dialog != this.chatAttachAlert && super.dismissDialogOnPause(dialog);
}
public void dismissCurrentDialog() {
Dialog dialog = this.chatAttachAlert;
if (dialog != null && ((BaseFragment) this).visibleDialog == dialog) {
dialog.getPhotoLayout().closeCamera(false);
this.chatAttachAlert.dismissInternal();
this.chatAttachAlert.getPhotoLayout().hideCamera(true);
return;
}
super.dismissCurrentDialog();
}
public final String getTranslitString(String value) {
return LocaleController.getInstance().getTranslitString(value, true);
}
public final int getFieldCost(String key) {
key.hashCode();
switch (key) {
case "residence_country_code":
return 26;
case "last_name_native":
case "last_name":
return 22;
case "gender":
return 24;
case "street_line1":
return 29;
case "street_line2":
return 30;
case "first_name":
case "first_name_native":
return 20;
case "city":
return 32;
case "state":
return 33;
case "middle_name":
case "middle_name_native":
return 21;
case "expiry_date":
return 28;
case "document_no":
return 27;
case "birth_date":
return 23;
case "country_code":
return 25;
case "post_code":
return 31;
default:
return 100;
}
}
public final void createPhoneVerificationInterface(Context context) {
((BaseFragment) 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);
View view = this.views[i];
float f = 18.0f;
float f2 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
if (AndroidUtilities.isTablet()) {
f = 26.0f;
}
frameLayout.addView(view, LayoutHelper.createFrame(-1, -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);
}
public final void loadPasswordInfo() {
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$loadPasswordInfo$4(tLObject, tL_error);
}
}), ((BaseFragment) this).classGuid);
}
public void lambda$loadPasswordInfo$4(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$loadPasswordInfo$3(tLObject);
}
});
}
public void lambda$loadPasswordInfo$3(TLObject tLObject) {
if (tLObject != null) {
TLRPC.account_Password account_password = (TLRPC.account_Password) tLObject;
this.currentPassword = account_password;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(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);
}
}
}
public final void createEmailVerificationInterface(Context context) {
((BaseFragment) 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.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i].setBackgroundDrawable(null);
this.inputFields[i].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : 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));
EditText[] editTextArr = this.inputFields;
editTextArr[i].setSelection(editTextArr[i].length());
this.inputFields[i].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
EditText editText = this.inputFields[i];
if (LocaleController.isRTL) {
i2 = 5;
}
editText.setGravity(i2);
frameLayout.addView(this.inputFields[i], LayoutHelper.createFrame(-1, -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) {
boolean lambda$createEmailVerificationInterface$5;
lambda$createEmailVerificationInterface$5 = PassportActivity.this.lambda$createEmailVerificationInterface$5(textView, i3, keyEvent);
return lambda$createEmailVerificationInterface$5;
}
});
this.inputFields[i].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
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.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
this.bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, new Object[]{this.currentValues.get("email")}));
this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
}
public boolean lambda$createEmailVerificationInterface$5(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6 && i != 5) {
return false;
}
this.doneItem.callOnClick();
return true;
}
public final 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 = (TLRPC.User) this.currentForm.users.get(i);
if (currentUser.id == this.currentBotId) {
break;
} else {
i++;
}
}
} else {
currentUser = UserConfig.getInstance(((BaseFragment) this).currentAccount).getCurrentUser();
}
FrameLayout frameLayout = (FrameLayout) ((BaseFragment) this).fragmentView;
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport));
EmptyTextProgressView emptyTextProgressView = new EmptyTextProgressView(context);
this.emptyView = emptyTextProgressView;
emptyTextProgressView.showProgress();
frameLayout.addView((View) this.emptyView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
FrameLayout frameLayout2 = new FrameLayout(context);
this.passwordAvatarContainer = frameLayout2;
this.linearLayout2.addView(frameLayout2, LayoutHelper.createLinear(-1, 100));
View backupImageView = new BackupImageView(context);
backupImageView.setRoundRadius(AndroidUtilities.dp(32.0f));
this.passwordAvatarContainer.addView(backupImageView, LayoutHelper.createFrame(64, 64.0f, 17, 0.0f, 8.0f, 0.0f, 0.0f));
backupImageView.setForUserOrChat(currentUser, new AvatarDrawable(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, new Object[]{UserObject.getFirstName(currentUser)})));
}
((FrameLayout.LayoutParams) this.passwordRequestTextView.getTextView().getLayoutParams()).gravity = 1;
this.linearLayout2.addView(this.passwordRequestTextView, LayoutHelper.createFrame(-2, -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("TelegramPassportCreatePasswordInfo", R.string.TelegramPassportCreatePasswordInfo));
this.linearLayout2.addView(this.noPasswordTextView, LayoutHelper.createFrame(-2, -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.bold());
this.noPasswordSetTextView.setText(LocaleController.getString("TelegramPassportCreatePassword", R.string.TelegramPassportCreatePassword));
this.linearLayout2.addView(this.noPasswordSetTextView, LayoutHelper.createFrame(-1, 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(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.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i2].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i2].setBackgroundDrawable(null);
this.inputFields[i2].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i2].setCursorSize(AndroidUtilities.dp(20.0f));
this.inputFields[i2].setCursorWidth(1.5f);
this.inputFields[i2].setInputType(129);
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, -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) {
boolean lambda$createPasswordInterface$7;
lambda$createPasswordInterface$7 = PassportActivity.this.lambda$createPasswordInterface$7(textView3, i3, keyEvent);
return lambda$createPasswordInterface$7;
}
});
this.inputFields[i2].setCustomSelectionActionModeCallback(new ActionMode.Callback(this) {
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return false;
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
});
}
TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
this.passwordInfoRequestTextView = textInfoPrivacyCell2;
textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, 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(view);
}
});
updatePasswordInterface();
}
public void lambda$createPasswordInterface$6(View view) {
TwoStepVerificationSetupActivity twoStepVerificationSetupActivity = new TwoStepVerificationSetupActivity(((BaseFragment) this).currentAccount, 0, this.currentPassword);
twoStepVerificationSetupActivity.setCloseAfterSet(true);
presentFragment(twoStepVerificationSetupActivity);
}
public boolean lambda$createPasswordInterface$7(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5 && i != 6) {
return false;
}
this.doneItem.callOnClick();
return true;
}
public void lambda$createPasswordInterface$12(View view) {
if (this.currentPassword.has_recovery) {
needShowProgress();
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(new TLRPC.TL_auth_requestPasswordRecovery(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$createPasswordInterface$10(tLObject, tL_error);
}
}, 10), ((BaseFragment) this).classGuid);
return;
}
if (getParentActivity() == null) {
return;
}
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$createPasswordInterface$11(dialogInterface, i);
}
});
builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
builder.setMessage(LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
showDialog(builder.create());
}
public void lambda$createPasswordInterface$10(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$createPasswordInterface$9(tL_error, tLObject);
}
});
}
public void lambda$createPasswordInterface$9(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, new Object[]{tL_auth_passwordRecovery.email_pattern}));
builder.setTitle(LocaleController.getString("RestoreEmailSentTitle", R.string.RestoreEmailSentTitle));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.this.lambda$createPasswordInterface$8(tL_auth_passwordRecovery, dialogInterface, i);
}
});
Dialog showDialog = showDialog(builder.create());
if (showDialog != null) {
showDialog.setCanceledOnTouchOutside(false);
showDialog.setCancelable(false);
return;
}
return;
}
if (tL_error.text.startsWith("FLOOD_WAIT")) {
int intValue = Utilities.parseInt(tL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, new Object[]{formatPluralString}));
return;
}
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
}
public void lambda$createPasswordInterface$8(TLRPC.TL_auth_passwordRecovery tL_auth_passwordRecovery, DialogInterface dialogInterface, int i) {
TLRPC.account_Password account_password = this.currentPassword;
account_password.email_unconfirmed_pattern = tL_auth_passwordRecovery.email_pattern;
presentFragment(new TwoStepVerificationSetupActivity(((BaseFragment) this).currentAccount, 4, account_password));
}
public void lambda$createPasswordInterface$11(DialogInterface dialogInterface, int i) {
Browser.openUrl(getParentActivity(), "https://telegram.org/deactivate?phone=" + UserConfig.getInstance(((BaseFragment) this).currentAccount).getClientPhone());
}
public final void onPasswordDone(final boolean saved) {
final String obj;
if (saved) {
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(saved, obj);
}
});
}
public void lambda$onPasswordDone$13(boolean r11, java.lang.String r12) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.lambda$onPasswordDone$13(boolean, java.lang.String):void");
}
public class AnonymousClass8 implements RequestDelegate {
public final TLRPC.TL_account_getPasswordSettings val$req;
public final boolean val$saved;
public final String val$textPassword;
public final byte[] val$x_bytes;
public AnonymousClass8(final boolean val$saved, final byte[] val$x_bytes, final TLRPC.TL_account_getPasswordSettings val$req, final String val$textPassword) {
this.val$saved = val$saved;
this.val$x_bytes = val$x_bytes;
this.val$req = val$req;
this.val$textPassword = val$textPassword;
}
public final void openRequestInterface() {
if (PassportActivity.this.inputFields == null) {
return;
}
if (!this.val$saved) {
UserConfig.getInstance(((BaseFragment) 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;
((BaseFragment) passportActivity).currentAccount = ((BaseFragment) PassportActivity.this).currentAccount;
passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
passportActivity.secureSecret = PassportActivity.this.secureSecret;
passportActivity.secureSecretId = PassportActivity.this.secureSecretId;
passportActivity.needActivityResult = PassportActivity.this.needActivityResult;
if (((BaseFragment) PassportActivity.this).parentLayout == null || !((BaseFragment) PassportActivity.this).parentLayout.checkTransitionAnimation()) {
PassportActivity.this.presentFragment(passportActivity, true);
} else {
PassportActivity.this.presentAfterAnimation = passportActivity;
}
}
public final 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, PassportActivity.this.currentPassword.current_algo);
}
TLRPC.TL_account_passwordInputSettings tL_account_passwordInputSettings = new TLRPC.TL_account_passwordInputSettings();
tL_account_updatePasswordSettings.new_settings = tL_account_passwordInputSettings;
tL_account_passwordInputSettings.new_secure_settings = new TLRPC.TL_secureSecretSettings();
TLRPC.TL_secureSecretSettings tL_secureSecretSettings = tL_account_updatePasswordSettings.new_settings.new_secure_settings;
tL_secureSecretSettings.secure_secret = new byte[0];
tL_secureSecretSettings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown();
TLRPC.TL_account_passwordInputSettings tL_account_passwordInputSettings2 = tL_account_updatePasswordSettings.new_settings;
tL_account_passwordInputSettings2.new_secure_settings.secure_secret_id = 0L;
tL_account_passwordInputSettings2.flags |= 4;
ConnectionsManager.getInstance(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(this.val$req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$resetSecret$3(tLObject, tL_error);
}
});
}
public void lambda$resetSecret$3(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$resetSecret$2(tL_error);
}
});
}
public void lambda$resetSecret$2(TLRPC.TL_error tL_error) {
if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
ConnectionsManager.getInstance(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass8.this.lambda$resetSecret$1(tLObject, tL_error2);
}
}, 8);
} else {
generateNewSecret();
}
}
public void lambda$resetSecret$1(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$resetSecret$0(tL_error, tLObject);
}
});
}
public void lambda$resetSecret$0(TLRPC.TL_error tL_error, TLObject tLObject) {
if (tL_error == null) {
PassportActivity.this.currentPassword = (TLRPC.account_Password) tLObject;
TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
resetSecret();
}
}
public final 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(bArr, str);
}
});
}
public void lambda$generateNewSecret$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, 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 = 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();
TLRPC.TL_secureSecretSettings tL_secureSecretSettings = tL_account_updatePasswordSettings.new_settings.new_secure_settings;
tL_secureSecretSettings.secure_algo = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000;
tL_secureSecretSettings.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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_account_updatePasswordSettings, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$7(tLObject, tL_error);
}
});
}
public void lambda$generateNewSecret$7(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$6(tL_error);
}
});
}
public void lambda$generateNewSecret$6(TLRPC.TL_error tL_error) {
if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
ConnectionsManager.getInstance(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error2) {
PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$5(tLObject, tL_error2);
}
}, 8);
} else {
if (PassportActivity.this.currentForm == null) {
PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
}
openRequestInterface();
}
}
public void lambda$generateNewSecret$5(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$generateNewSecret$4(tL_error, tLObject);
}
});
}
public void lambda$generateNewSecret$4(TLRPC.TL_error tL_error, TLObject tLObject) {
if (tL_error == null) {
PassportActivity.this.currentPassword = (TLRPC.account_Password) tLObject;
TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
generateNewSecret();
}
}
public void run(final TLObject response, final TLRPC.TL_error error) {
if (error != null && "SRP_ID_INVALID".equals(error.text)) {
TLRPC.TL_account_getPassword tL_account_getPassword = new TLRPC.TL_account_getPassword();
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(((BaseFragment) PassportActivity.this).currentAccount);
final boolean z = this.val$saved;
connectionsManager.sendRequest(tL_account_getPassword, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$run$10(z, tLObject, tL_error);
}
}, 8);
return;
}
if (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(response, str, z2);
}
});
return;
}
final boolean z3 = this.val$saved;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$16(z3, error);
}
});
}
public void lambda$run$10(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$run$9(tL_error, tLObject, z);
}
});
}
public void lambda$run$9(TLRPC.TL_error tL_error, TLObject tLObject, boolean z) {
if (tL_error == null) {
PassportActivity.this.currentPassword = (TLRPC.account_Password) tLObject;
TwoStepVerificationActivity.initPasswordNewAlgo(PassportActivity.this.currentPassword);
PassportActivity.this.onPasswordDone(z);
}
}
public void lambda$run$15(TLObject tLObject, String str, final boolean z) {
final byte[] bArr;
final TLRPC.TL_account_passwordSettings tL_account_passwordSettings = (TLRPC.TL_account_passwordSettings) tLObject;
TLRPC.TL_secureSecretSettings tL_secureSecretSettings = tL_account_passwordSettings.secure_settings;
if (tL_secureSecretSettings != null) {
PassportActivity.this.secureSecret = tL_secureSecretSettings.secure_secret;
PassportActivity.this.secureSecretId = tL_account_passwordSettings.secure_settings.secure_secret_id;
TLRPC.TL_securePasswordKdfAlgoSHA512 tL_securePasswordKdfAlgoSHA512 = tL_account_passwordSettings.secure_settings.secure_algo;
if (tL_securePasswordKdfAlgoSHA512 instanceof TLRPC.TL_securePasswordKdfAlgoSHA512) {
bArr = tL_securePasswordKdfAlgoSHA512.salt;
PassportActivity.this.saltedPassword = Utilities.computeSHA512(bArr, AndroidUtilities.getStringBytes(str), bArr);
} else if (tL_securePasswordKdfAlgoSHA512 instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = (TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) tL_securePasswordKdfAlgoSHA512;
byte[] bArr2 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt;
PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000.salt);
bArr = bArr2;
} else {
if (tL_securePasswordKdfAlgoSHA512 instanceof TLRPC.TL_securePasswordKdfAlgoUnknown) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$11();
}
});
return;
}
bArr = new byte[0];
}
} else {
if (PassportActivity.this.currentPassword.new_secure_algo instanceof TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) {
TLRPC.TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002 = PassportActivity.this.currentPassword.new_secure_algo;
byte[] bArr3 = tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt;
PassportActivity.this.saltedPassword = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), tL_securePasswordKdfAlgoPBKDF2HMACSHA512iter1000002.salt);
bArr = bArr3;
} else {
bArr = new byte[0];
}
PassportActivity.this.secureSecret = null;
PassportActivity.this.secureSecretId = 0L;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$14(tL_account_passwordSettings, z, bArr);
}
});
}
public void lambda$run$11() {
AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
}
public void lambda$run$14(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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(new TLRPC.TL_account_getAllSecureValues(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass8.this.lambda$run$13(tLObject, tL_error);
}
});
return;
} else {
openRequestInterface();
return;
}
}
if (z) {
UserConfig.getInstance(((BaseFragment) PassportActivity.this).currentAccount).resetSavedPassword();
PassportActivity.this.usingSavedPassword = 0;
PassportActivity.this.updatePasswordInterface();
return;
}
if (PassportActivity.this.currentForm != null) {
PassportActivity.this.currentForm.values.clear();
PassportActivity.this.currentForm.errors.clear();
}
if (PassportActivity.this.secureSecret == null || PassportActivity.this.secureSecret.length == 0) {
generateNewSecret();
} else {
resetSecret();
}
}
public void lambda$run$13(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.AnonymousClass8.this.lambda$run$12(tLObject, tL_error);
}
});
}
public void lambda$run$12(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
PassportActivity.this.currentForm = new TLRPC.TL_account_authorizationForm();
TLRPC.Vector vector = (TLRPC.Vector) tLObject;
int size = vector.objects.size();
for (int i = 0; i < size; i++) {
PassportActivity.this.currentForm.values.add((TLRPC.TL_secureValue) vector.objects.get(i));
}
openRequestInterface();
return;
}
if ("APP_VERSION_OUTDATED".equals(tL_error.text)) {
AlertsCreator.showUpdateAppAlert(PassportActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
} else {
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
}
PassportActivity.this.showEditDoneProgress(true, false);
}
public void lambda$run$16(boolean z, TLRPC.TL_error tL_error) {
String formatPluralString;
if (z) {
UserConfig.getInstance(((BaseFragment) 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);
return;
}
if (tL_error.text.startsWith("FLOOD_WAIT")) {
int intValue = Utilities.parseInt(tL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, new Object[]{formatPluralString}));
return;
}
PassportActivity.this.showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
}
}
public final boolean isPersonalDocument(TLRPC.SecureValueType type) {
return (type instanceof TLRPC.TL_secureValueTypeDriverLicense) || (type instanceof TLRPC.TL_secureValueTypePassport) || (type instanceof TLRPC.TL_secureValueTypeInternalPassport) || (type instanceof TLRPC.TL_secureValueTypeIdentityCard);
}
public final boolean isAddressDocument(TLRPC.SecureValueType type) {
return (type instanceof TLRPC.TL_secureValueTypeUtilityBill) || (type instanceof TLRPC.TL_secureValueTypeBankStatement) || (type instanceof TLRPC.TL_secureValueTypePassportRegistration) || (type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) || (type instanceof TLRPC.TL_secureValueTypeRentalAgreement);
}
public final void createRequestInterface(android.content.Context r23) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.createRequestInterface(android.content.Context):void");
}
public class C1ValueToSend {
public boolean selfie_required;
public boolean translation_required;
public TLRPC.TL_secureValue value;
public C1ValueToSend(final PassportActivity this$0, TLRPC.TL_secureValue v, boolean s, boolean t) {
this.value = v;
this.selfie_required = s;
this.translation_required = t;
}
}
public void lambda$createRequestInterface$16(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.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf = (TLRPC.SecureRequiredType) this.currentForm.required_types.get(i2);
if (tL_secureRequiredTypeOneOf instanceof TLRPC.TL_secureRequiredType) {
tL_secureRequiredType = (TLRPC.TL_secureRequiredType) tL_secureRequiredTypeOneOf;
} else {
if (tL_secureRequiredTypeOneOf instanceof TLRPC.TL_secureRequiredTypeOneOf) {
TLRPC.TL_secureRequiredTypeOneOf tL_secureRequiredTypeOneOf2 = tL_secureRequiredTypeOneOf;
if (!tL_secureRequiredTypeOneOf2.types.isEmpty()) {
TLRPC.SecureRequiredType secureRequiredType = (TLRPC.SecureRequiredType) tL_secureRequiredTypeOneOf2.types.get(0);
if (secureRequiredType instanceof TLRPC.TL_secureRequiredType) {
TLRPC.TL_secureRequiredType tL_secureRequiredType2 = (TLRPC.TL_secureRequiredType) secureRequiredType;
int size2 = tL_secureRequiredTypeOneOf2.types.size();
int i3 = 0;
while (true) {
if (i3 >= size2) {
tL_secureRequiredType = tL_secureRequiredType2;
break;
}
TLRPC.SecureRequiredType secureRequiredType2 = (TLRPC.SecureRequiredType) tL_secureRequiredTypeOneOf2.types.get(i3);
if (secureRequiredType2 instanceof TLRPC.TL_secureRequiredType) {
TLRPC.TL_secureRequiredType tL_secureRequiredType3 = (TLRPC.TL_secureRequiredType) secureRequiredType2;
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));
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));
return;
}
arrayList2.add(new C1ValueToSend(this, 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();
TLRPC.TL_securePlainEmail tL_securePlainEmail = tL_secureValue.plain_data;
if (tL_securePlainEmail != null) {
if (!(tL_securePlainEmail instanceof TLRPC.TL_securePlainEmail) && (tL_securePlainEmail instanceof TLRPC.TL_securePlainPhone)) {
}
} else {
try {
JSONObject jSONObject3 = new JSONObject();
TLRPC.TL_secureData tL_secureData = tL_secureValue.data;
if (tL_secureData != null) {
byte[] decryptValueSecret = decryptValueSecret(tL_secureData.secret, tL_secureData.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);
}
TLRPC.TL_secureFile tL_secureFile2 = tL_secureValue.front_side;
if (tL_secureFile2 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile3 = tL_secureFile2;
byte[] decryptValueSecret3 = decryptValueSecret(tL_secureFile3.secret, tL_secureFile3.file_hash);
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("file_hash", Base64.encodeToString(tL_secureFile3.file_hash, 2));
jSONObject5.put("secret", Base64.encodeToString(decryptValueSecret3, 2));
jSONObject3.put("front_side", jSONObject5);
}
TLRPC.TL_secureFile tL_secureFile4 = tL_secureValue.reverse_side;
if (tL_secureFile4 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile5 = tL_secureFile4;
byte[] decryptValueSecret4 = decryptValueSecret(tL_secureFile5.secret, tL_secureFile5.file_hash);
JSONObject jSONObject6 = new JSONObject();
jSONObject6.put("file_hash", Base64.encodeToString(tL_secureFile5.file_hash, 2));
jSONObject6.put("secret", Base64.encodeToString(decryptValueSecret4, 2));
jSONObject3.put("reverse_side", jSONObject6);
}
if (c1ValueToSend.selfie_required) {
TLRPC.TL_secureFile tL_secureFile6 = tL_secureValue.selfie;
if (tL_secureFile6 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile7 = tL_secureFile6;
byte[] decryptValueSecret5 = decryptValueSecret(tL_secureFile7.secret, tL_secureFile7.file_hash);
JSONObject jSONObject7 = new JSONObject();
jSONObject7.put("file_hash", Base64.encodeToString(tL_secureFile7.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_secureFile8 = (TLRPC.TL_secureFile) tL_secureValue.translation.get(i6);
byte[] decryptValueSecret6 = decryptValueSecret(tL_secureFile8.secret, tL_secureFile8.file_hash);
JSONObject jSONObject8 = new JSONObject();
jSONObject8.put("file_hash", Base64.encodeToString(tL_secureFile8.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()));
TLRPC.TL_secureCredentialsEncrypted tL_secureCredentialsEncrypted = new TLRPC.TL_secureCredentialsEncrypted();
tL_account_acceptAuthorization.credentials = tL_secureCredentialsEncrypted;
tL_secureCredentialsEncrypted.hash = encryptData.fileHash;
tL_secureCredentialsEncrypted.data = encryptData.encryptedData;
try {
RSAPublicKey rSAPublicKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decode(this.currentPublicKey.replaceAll("\\n", "").replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", ""), 0)));
Cipher cipher = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding");
cipher.init(1, rSAPublicKey);
tL_account_acceptAuthorization.credentials.secret = cipher.doFinal(encryptData.decrypyedFileSecret);
} catch (Exception e) {
FileLog.e(e);
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).bindRequestToGuid(ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_acceptAuthorization, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$createRequestInterface$15(tLObject, tL_error);
}
}), ((BaseFragment) this).classGuid);
}
public void lambda$createRequestInterface$15(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$createRequestInterface$14(tL_error);
}
});
}
public void lambda$createRequestInterface$14(TLRPC.TL_error tL_error) {
if (tL_error == null) {
this.ignoreOnFailure = true;
callCallback(true);
finishFragment();
} else {
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);
}
}
}
public final void createManageInterface(android.content.Context r20) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.createManageInterface(android.content.Context):void");
}
public void lambda$createManageInterface$17(View view) {
openAddDocumentAlert();
}
public void lambda$createManageInterface$21(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("TelegramPassportDeleteTitle", R.string.TelegramPassportDeleteTitle));
builder.setMessage(LocaleController.getString("TelegramPassportDeleteAlert", R.string.TelegramPassportDeleteAlert));
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PassportActivity.this.lambda$createManageInterface$20(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog create = builder.create();
showDialog(create);
TextView textView = (TextView) create.getButton(-1);
if (textView != null) {
textView.setTextColor(Theme.getColor(Theme.key_text_RedBold));
}
}
public void lambda$createManageInterface$20(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(((TLRPC.TL_secureValue) this.currentForm.values.get(i2)).type);
}
needShowProgress();
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_deleteSecureValue, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$createManageInterface$19(tLObject, tL_error);
}
});
}
public void lambda$createManageInterface$19(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$createManageInterface$18();
}
});
}
public void lambda$createManageInterface$18() {
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(View view) {
openAddDocumentAlert();
}
public final boolean hasNotValueForType(Class<? extends TLRPC.SecureValueType> type) {
int size = this.currentForm.values.size();
for (int i = 0; i < size; i++) {
if (((TLRPC.TL_secureValue) this.currentForm.values.get(i)).type.getClass() == type) {
return false;
}
}
return true;
}
public final 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);
}
public final void openAddDocumentAlert() {
Class<? extends TLRPC.SecureValueType> cls;
Class<? extends TLRPC.SecureValueType> cls2;
ArrayList arrayList = new ArrayList();
final ArrayList arrayList2 = new ArrayList();
if (hasNotValueForType(TLRPC.TL_secureValueTypePhone.class)) {
cls = TLRPC.TL_secureValueTypeRentalAgreement.class;
cls2 = TLRPC.TL_secureValueTypeBankStatement.class;
arrayList.add(LocaleController.getString("ActionBotDocumentPhone", R.string.ActionBotDocumentPhone));
arrayList2.add(TLRPC.TL_secureValueTypePhone.class);
} else {
cls = TLRPC.TL_secureValueTypeRentalAgreement.class;
cls2 = TLRPC.TL_secureValueTypeBankStatement.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);
}
Class<? extends TLRPC.SecureValueType> cls3 = cls2;
if (hasNotValueForType(cls3)) {
arrayList.add(LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement));
arrayList2.add(cls3);
}
Class<? extends TLRPC.SecureValueType> cls4 = cls;
if (hasNotValueForType(cls4)) {
arrayList.add(LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement));
arrayList2.add(cls4);
}
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(arrayList2, dialogInterface, i);
}
});
showDialog(builder.create());
}
public void lambda$openAddDocumentAlert$23(java.util.ArrayList r2, android.content.DialogInterface r3, int r4) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.lambda$openAddDocumentAlert$23(java.util.ArrayList, android.content.DialogInterface, int):void");
}
public final 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 final void callCallback(boolean success) {
int i;
int i2;
if (this.callbackCalled) {
return;
}
if (!TextUtils.isEmpty(this.currentCallbackUrl)) {
if (success) {
Browser.openUrl(getParentActivity(), Uri.parse(this.currentCallbackUrl + "&tg_passport=success"));
} else if (!this.ignoreOnFailure && ((i2 = this.currentActivityType) == 5 || i2 == 0)) {
Browser.openUrl(getParentActivity(), Uri.parse(this.currentCallbackUrl + "&tg_passport=cancel"));
}
this.callbackCalled = true;
return;
}
if (this.needActivityResult) {
if (success || (!this.ignoreOnFailure && ((i = this.currentActivityType) == 5 || i == 0))) {
getParentActivity().setResult(success ? -1 : 0);
}
this.callbackCalled = true;
}
}
public final void createEmailInterface(Context context) {
((BaseFragment) 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, new Object[]{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(view);
}
});
TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
this.bottomCell = textInfoPrivacyCell;
textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, 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.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i].setBackgroundDrawable(null);
this.inputFields[i].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : 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) {
TLRPC.TL_securePlainEmail tL_securePlainEmail = tL_secureValue.plain_data;
if (tL_securePlainEmail instanceof TLRPC.TL_securePlainEmail) {
TLRPC.TL_securePlainEmail tL_securePlainEmail2 = tL_securePlainEmail;
if (!TextUtils.isEmpty(tL_securePlainEmail2.email)) {
this.inputFields[i].setText(tL_securePlainEmail2.email);
}
}
}
EditText[] editTextArr = this.inputFields;
editTextArr[i].setSelection(editTextArr[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, -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) {
boolean lambda$createEmailInterface$25;
lambda$createEmailInterface$25 = PassportActivity.this.lambda$createEmailInterface$25(textView, i2, keyEvent);
return lambda$createEmailInterface$25;
}
});
}
TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
this.bottomCell = textInfoPrivacyCell2;
textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, 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(View view) {
this.useCurrentValue = true;
this.doneItem.callOnClick();
this.useCurrentValue = false;
}
public boolean lambda$createEmailInterface$25(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6 && i != 5) {
return false;
}
this.doneItem.callOnClick();
return true;
}
public final void createPhoneInterface(Context context) {
String str;
String str2;
FrameLayout frameLayout;
((BaseFragment) 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, BoostRepository$$ExternalSyntheticLambda31.INSTANCE);
String str3 = UserConfig.getInstance(((BaseFragment) 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, new Object[]{PhoneFormat.getInstance().format("+" + str3)}), false);
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(view);
}
});
TextInfoPrivacyCell textInfoPrivacyCell = new TextInfoPrivacyCell(context);
this.bottomCell = textInfoPrivacyCell;
textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, 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 i = 0;
while (true) {
str = null;
if (i < 3) {
if (i == 2) {
this.inputFields[i] = new HintEditText(context);
} else {
this.inputFields[i] = new EditTextBoldCursor(context);
}
if (i == 1) {
?? linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
this.linearLayout2.addView(linearLayout, LayoutHelper.createLinear(-1, 50));
linearLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
frameLayout = linearLayout;
} else if (i == 2) {
frameLayout = (ViewGroup) this.inputFields[1].getParent();
} else {
FrameLayout frameLayout2 = new FrameLayout(context);
this.linearLayout2.addView(frameLayout2, LayoutHelper.createLinear(-1, 50));
frameLayout2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
frameLayout = frameLayout2;
}
this.inputFields[i].setTag(Integer.valueOf(i));
this.inputFields[i].setTextSize(1, 16.0f);
this.inputFields[i].setHintTextColor(Theme.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i].setBackgroundDrawable(null);
this.inputFields[i].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i].setCursorSize(AndroidUtilities.dp(20.0f));
this.inputFields[i].setCursorWidth(1.5f);
if (i == 0) {
this.inputFields[i].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean lambda$createPhoneInterface$29;
lambda$createPhoneInterface$29 = PassportActivity.this.lambda$createPhoneInterface$29(view, motionEvent);
return lambda$createPhoneInterface$29;
}
});
this.inputFields[i].setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
this.inputFields[i].setInputType(0);
this.inputFields[i].setFocusable(false);
} else {
this.inputFields[i].setInputType(3);
if (i == 2) {
this.inputFields[i].setImeOptions(268435462);
} else {
this.inputFields[i].setImeOptions(268435461);
}
}
EditText[] editTextArr = this.inputFields;
editTextArr[i].setSelection(editTextArr[i].length());
if (i == 1) {
TextView textView = new TextView(context);
this.plusTextView = textView;
textView.setText("+");
this.plusTextView.setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : 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[i].setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
this.inputFields[i].setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)});
this.inputFields[i].setGravity(19);
frameLayout.addView(this.inputFields[i], LayoutHelper.createLinear(55, -2, 0.0f, 12.0f, 16.0f, 6.0f));
this.inputFields[i].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i2, int i22, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i2, int i22, int i3) {
}
@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 = 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 i2 = 4;
if (stripExceptNumbers.length() > 4) {
while (true) {
if (i2 < 1) {
str4 = null;
z = false;
break;
}
String substring = stripExceptNumbers.substring(0, i2);
if (((String) PassportActivity.this.codesMap.get(substring)) != null) {
String str5 = stripExceptNumbers.substring(i2) + PassportActivity.this.inputFields[2].getText().toString();
PassportActivity.this.inputFields[1].setText(substring);
z = true;
str4 = str5;
stripExceptNumbers = substring;
break;
}
i2--;
}
if (!z) {
str4 = stripExceptNumbers.substring(1) + PassportActivity.this.inputFields[2].getText().toString();
EditText editText = PassportActivity.this.inputFields[1];
stripExceptNumbers = stripExceptNumbers.substring(0, 1);
editText.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', (char) 8211));
hintEditText.setHint(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 (i == 2) {
this.inputFields[i].setPadding(0, 0, 0, 0);
this.inputFields[i].setGravity(19);
this.inputFields[i].setHintText((CharSequence) null);
this.inputFields[i].setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
frameLayout.addView(this.inputFields[i], LayoutHelper.createLinear(-1, -2, 0.0f, 12.0f, 21.0f, 6.0f));
this.inputFields[i].addTextChangedListener(new TextWatcher() {
public int actionPosition;
public int characterAction = -1;
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (count == 0 && after == 1) {
this.characterAction = 1;
return;
}
if (count == 1 && after == 0) {
if (s.charAt(start) == ' ' && start > 0) {
this.characterAction = 3;
this.actionPosition = start - 1;
return;
} else {
this.characterAction = 2;
return;
}
}
this.characterAction = -1;
}
@Override
public void afterTextChanged(Editable s) {
int i2;
int i3;
if (PassportActivity.this.ignoreOnPhoneChange) {
return;
}
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 i4 = 0;
while (i4 < obj.length()) {
int i5 = i4 + 1;
String substring = obj.substring(i4, i5);
if ("0123456789".contains(substring)) {
sb.append(substring);
}
i4 = i5;
}
PassportActivity.this.ignoreOnPhoneChange = true;
String hintText = hintEditText.getHintText();
if (hintText != null) {
int i6 = 0;
while (true) {
if (i6 >= sb.length()) {
break;
}
if (i6 < hintText.length()) {
if (hintText.charAt(i6) == ' ') {
sb.insert(i6, ' ');
i6++;
if (selectionStart == i6 && (i3 = this.characterAction) != 2 && i3 != 3) {
selectionStart++;
}
}
i6++;
} else {
sb.insert(i6, ' ');
if (selectionStart == i6 + 1 && (i2 = this.characterAction) != 2 && i2 != 3) {
selectionStart++;
}
}
}
}
hintEditText.setText(sb);
if (selectionStart >= 0) {
hintEditText.setSelection(Math.min(selectionStart, hintEditText.length()));
}
hintEditText.onTextChange();
PassportActivity.this.ignoreOnPhoneChange = false;
}
});
} else {
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, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
}
this.inputFields[i].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i2, KeyEvent keyEvent) {
boolean lambda$createPhoneInterface$30;
lambda$createPhoneInterface$30 = PassportActivity.this.lambda$createPhoneInterface$30(textView2, i2, keyEvent);
return lambda$createPhoneInterface$30;
}
});
if (i == 2) {
this.inputFields[i].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i2, KeyEvent keyEvent) {
boolean lambda$createPhoneInterface$31;
lambda$createPhoneInterface$31 = PassportActivity.this.lambda$createPhoneInterface$31(view, i2, keyEvent);
return lambda$createPhoneInterface$31;
}
});
}
if (i == 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));
}
i++;
} else {
try {
break;
} catch (Exception e2) {
FileLog.e(e2);
}
}
}
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
if (telephonyManager != null) {
str = telephonyManager.getSimCountryIso().toUpperCase();
}
if (str != null && (str2 = this.languageMap.get(str)) != null && this.countriesArray.indexOf(str2) != -1) {
this.inputFields[1].setText(this.countriesMap.get(str2));
}
TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
this.bottomCell = textInfoPrivacyCell2;
textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, 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(View view) {
this.useCurrentValue = true;
this.doneItem.callOnClick();
this.useCurrentValue = false;
}
public boolean lambda$createPhoneInterface$29(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$createPhoneInterface$28(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$createPhoneInterface$28(CountrySelectActivity.Country country) {
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', (char) 8211) : null);
this.ignoreOnTextChange = false;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$createPhoneInterface$27();
}
}, 300L);
this.inputFields[2].requestFocus();
EditText[] editTextArr = this.inputFields;
editTextArr[2].setSelection(editTextArr[2].length());
}
public void lambda$createPhoneInterface$27() {
AndroidUtilities.showKeyboard(this.inputFields[2]);
}
public boolean lambda$createPhoneInterface$30(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
this.inputFields[2].requestFocus();
return true;
}
if (i != 6) {
return false;
}
this.doneItem.callOnClick();
return true;
}
public boolean lambda$createPhoneInterface$31(View view, int i, KeyEvent keyEvent) {
if (i != 67 || this.inputFields[2].length() != 0) {
return false;
}
this.inputFields[1].requestFocus();
EditText[] editTextArr = this.inputFields;
editTextArr[1].setSelection(editTextArr[1].length());
this.inputFields[1].dispatchKeyEvent(keyEvent);
return true;
}
public final 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;
int i = R.drawable.greydivider_top;
int i2 = Theme.key_windowBackgroundGrayShadow;
textInfoPrivacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i, i2));
this.topErrorCell.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
this.linearLayout2.addView(this.topErrorCell, LayoutHelper.createLinear(-1, -2));
checkTopErrorCell(true);
TLRPC.TL_secureRequiredType tL_secureRequiredType = this.currentDocumentsType;
if (tL_secureRequiredType != null) {
TLRPC.SecureValueType secureValueType = tL_secureRequiredType.type;
if (secureValueType instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement));
} else if (secureValueType instanceof TLRPC.TL_secureValueTypeBankStatement) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement));
} else if (secureValueType instanceof TLRPC.TL_secureValueTypeUtilityBill) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill));
} else if (secureValueType instanceof TLRPC.TL_secureValueTypePassportRegistration) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration));
} else if (secureValueType instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
((BaseFragment) 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));
HeaderCell headerCell2 = this.headerCell;
int i3 = Theme.key_windowBackgroundWhite;
headerCell2.setBackgroundColor(Theme.getColor(i3));
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(view);
}
});
TextInfoPrivacyCell textInfoPrivacyCell2 = new TextInfoPrivacyCell(context);
this.bottomCell = textInfoPrivacyCell2;
int i4 = R.drawable.greydivider;
textInfoPrivacyCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i4, i2));
if (this.currentBotId != 0) {
this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAddressUploadInfo", R.string.PassportAddAddressUploadInfo);
} else {
TLRPC.SecureValueType secureValueType2 = this.currentDocumentsType.type;
if (secureValueType2 instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
this.noAllDocumentsErrorText = LocaleController.getString("PassportAddAgreementInfo", R.string.PassportAddAgreementInfo);
} else if (secureValueType2 instanceof TLRPC.TL_secureValueTypeUtilityBill) {
this.noAllDocumentsErrorText = LocaleController.getString("PassportAddBillInfo", R.string.PassportAddBillInfo);
} else if (secureValueType2 instanceof TLRPC.TL_secureValueTypePassportRegistration) {
this.noAllDocumentsErrorText = LocaleController.getString("PassportAddPassportRegistrationInfo", R.string.PassportAddPassportRegistrationInfo);
} else if (secureValueType2 instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
this.noAllDocumentsErrorText = LocaleController.getString("PassportAddTemporaryRegistrationInfo", R.string.PassportAddTemporaryRegistrationInfo);
} else if (secureValueType2 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;
CharSequence charSequence2 = charSequence;
if (hashMap != null) {
String str2 = hashMap.get("files_all");
charSequence2 = charSequence;
if (str2 != null) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str2);
spannableStringBuilder.append((CharSequence) "\n\n");
spannableStringBuilder.append(this.noAllDocumentsErrorText);
spannableStringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_text_RedRegular)), 0, str2.length(), 33);
this.errorsValues.put("files_all", "");
charSequence2 = spannableStringBuilder;
}
}
this.bottomCell.setText(charSequence2);
this.linearLayout2.addView(this.bottomCell, LayoutHelper.createLinear(-1, -2));
if (this.currentDocumentsType.translation_required) {
HeaderCell headerCell3 = new HeaderCell(context);
this.headerCell = headerCell3;
headerCell3.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
this.headerCell.setBackgroundColor(Theme.getColor(i3));
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(view);
}
});
TextInfoPrivacyCell textInfoPrivacyCell3 = new TextInfoPrivacyCell(context);
this.bottomCellTranslation = textInfoPrivacyCell3;
textInfoPrivacyCell3.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i4, i2));
if (this.currentBotId != 0) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo);
} else {
TLRPC.SecureValueType secureValueType3 = this.currentDocumentsType.type;
if (secureValueType3 instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationAgreementInfo", R.string.PassportAddTranslationAgreementInfo);
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeUtilityBill) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBillInfo", R.string.PassportAddTranslationBillInfo);
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypePassportRegistration) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationPassportRegistrationInfo", R.string.PassportAddTranslationPassportRegistrationInfo);
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationTemporaryRegistrationInfo", R.string.PassportAddTranslationTemporaryRegistrationInfo);
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeBankStatement) {
this.noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationBankInfo", R.string.PassportAddTranslationBankInfo);
} else {
this.noAllTranslationErrorText = "";
}
}
CharSequence charSequence3 = this.noAllTranslationErrorText;
HashMap<String, String> hashMap2 = this.documentsErrors;
CharSequence charSequence4 = charSequence3;
if (hashMap2 != null) {
String str3 = hashMap2.get("translation_all");
charSequence4 = charSequence3;
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_text_RedRegular)), 0, str3.length(), 33);
this.errorsValues.put("translation_all", "");
charSequence4 = spannableStringBuilder2;
}
}
this.bottomCellTranslation.setText(charSequence4);
this.linearLayout2.addView(this.bottomCellTranslation, LayoutHelper.createLinear(-1, -2));
}
} else {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("PassportAddress", R.string.PassportAddress));
}
HeaderCell headerCell4 = new HeaderCell(context);
this.headerCell = headerCell4;
headerCell4.setText(LocaleController.getString("PassportAddressHeader", R.string.PassportAddressHeader));
this.headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
this.linearLayout2.addView(this.headerCell, LayoutHelper.createLinear(-1, -2));
this.inputFields = new EditTextBoldCursor[6];
for (int i5 = 0; i5 < 6; i5++) {
final EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.inputFields[i5] = editTextBoldCursor;
FrameLayout frameLayout = new FrameLayout(this, context) {
public StaticLayout errorLayout;
public float offsetX;
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int size = View.MeasureSpec.getSize(widthMeasureSpec) - 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) {
heightMeasureSpec = 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;
}
if (this.errorLayout.getLineLeft(i6) != 0.0f) {
this.offsetX = 0.0f;
break;
}
f = Math.max(f, this.errorLayout.getLineWidth(i6));
if (i6 == lineCount - 1) {
this.offsetX = size - f;
}
i6++;
}
}
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public 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, -2));
int i6 = Theme.key_windowBackgroundWhite;
frameLayout.setBackgroundColor(Theme.getColor(i6));
if (i5 == 5) {
View view = new View(context);
this.extraBackgroundView = view;
view.setBackgroundColor(Theme.getColor(i6));
this.linearLayout2.addView(this.extraBackgroundView, LayoutHelper.createLinear(-1, 6));
}
if (this.documentOnly && this.currentDocumentsType != null) {
frameLayout.setVisibility(8);
View view2 = this.extraBackgroundView;
if (view2 != null) {
view2.setVisibility(8);
}
}
this.inputFields[i5].setTag(Integer.valueOf(i5));
this.inputFields[i5].setSupportRtlHint(true);
this.inputFields[i5].setTextSize(1, 16.0f);
this.inputFields[i5].setHintColor(Theme.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i5].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
this.inputFields[i5].setTransformHintToHeader(true);
this.inputFields[i5].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i5].setBackgroundDrawable(null);
this.inputFields[i5].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i5].setCursorSize(AndroidUtilities.dp(20.0f));
this.inputFields[i5].setCursorWidth(1.5f);
this.inputFields[i5].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_text_RedRegular));
if (i5 == 5) {
this.inputFields[i5].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
boolean lambda$createAddressInterface$35;
lambda$createAddressInterface$35 = PassportActivity.this.lambda$createAddressInterface$35(view3, motionEvent);
return lambda$createAddressInterface$35;
}
});
this.inputFields[i5].setInputType(0);
this.inputFields[i5].setFocusable(false);
} else {
this.inputFields[i5].setInputType(16385);
this.inputFields[i5].setImeOptions(268435461);
}
if (i5 == 0) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportStreet1", R.string.PassportStreet1));
str = "street_line1";
} else if (i5 == 1) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportStreet2", R.string.PassportStreet2));
str = "street_line2";
} else if (i5 == 2) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportPostcode", R.string.PassportPostcode));
str = "post_code";
} else if (i5 == 3) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportCity", R.string.PassportCity));
str = "city";
} else if (i5 == 4) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportState", R.string.PassportState));
str = "state";
} else if (i5 == 5) {
this.inputFields[i5].setHintText(LocaleController.getString("PassportCountry", R.string.PassportCountry));
str = "country_code";
}
setFieldValues(this.currentValues, this.inputFields[i5], str);
if (i5 == 2) {
this.inputFields[i5].addTextChangedListener(new TextWatcher() {
public boolean ignore;
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (this.ignore) {
return;
}
boolean z = true;
this.ignore = true;
int i7 = 0;
while (true) {
if (i7 >= s.length()) {
z = false;
break;
}
char charAt = s.charAt(i7);
if ((charAt < 'a' || charAt > 'z') && ((charAt < 'A' || charAt > 'Z') && !((charAt >= '0' && charAt <= '9') || charAt == '-' || charAt == ' '))) {
break;
} else {
i7++;
}
}
this.ignore = false;
if (z) {
editTextBoldCursor.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
} else {
PassportActivity.this.checkFieldForError(editTextBoldCursor, str, s, false);
}
}
});
this.inputFields[i5].setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
} else {
this.inputFields[i5].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
PassportActivity.this.checkFieldForError(editTextBoldCursor, str, s, false);
}
});
}
EditText[] editTextArr = this.inputFields;
editTextArr[i5].setSelection(editTextArr[i5].length());
this.inputFields[i5].setPadding(0, 0, 0, 0);
this.inputFields[i5].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
frameLayout.addView(this.inputFields[i5], LayoutHelper.createFrame(-1, 64.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
this.inputFields[i5].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i7, KeyEvent keyEvent) {
boolean lambda$createAddressInterface$36;
lambda$createAddressInterface$36 = PassportActivity.this.lambda$createAddressInterface$36(textView, i7, keyEvent);
return lambda$createAddressInterface$36;
}
});
}
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);
}
ShadowSectionCell shadowSectionCell2 = this.sectionCell;
int i7 = R.drawable.greydivider;
int i8 = Theme.key_windowBackgroundGrayShadow;
shadowSectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i7, i8));
TextSettingsCell textSettingsCell3 = new TextSettingsCell(context);
textSettingsCell3.setTextColor(Theme.getColor(Theme.key_text_RedRegular));
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(view3);
}
});
ShadowSectionCell shadowSectionCell3 = new ShadowSectionCell(context);
this.sectionCell = shadowSectionCell3;
shadowSectionCell3.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, i8));
this.linearLayout2.addView(this.sectionCell, LayoutHelper.createLinear(-1, -2));
} else {
ShadowSectionCell shadowSectionCell4 = this.sectionCell;
int i9 = R.drawable.greydivider_bottom;
int i10 = Theme.key_windowBackgroundGrayShadow;
shadowSectionCell4.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i9, i10));
if (this.documentOnly && this.currentDocumentsType != null) {
this.bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i9, i10));
}
}
updateUploadText(0);
updateUploadText(4);
}
public void lambda$createAddressInterface$32(View view) {
this.uploadingFileType = 0;
openAttachMenu();
}
public void lambda$createAddressInterface$33(View view) {
this.uploadingFileType = 4;
openAttachMenu();
}
public boolean lambda$createAddressInterface$35(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$createAddressInterface$34(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$createAddressInterface$34(CountrySelectActivity.Country country) {
this.inputFields[5].setText(country.name);
this.currentCitizeship = country.shortname;
}
public boolean lambda$createAddressInterface$36(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditText[] editTextArr = this.inputFields;
if (intValue < editTextArr.length) {
if (editTextArr[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;
}
public void lambda$createAddressInterface$37(View view) {
createDocumentDeleteAlert();
}
public final 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(zArr, dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
boolean z = this.documentOnly;
if (z && this.currentDocumentsType == null && (this.currentType.type instanceof TLRPC.TL_secureValueTypeAddress)) {
builder.setMessage(LocaleController.getString("PassportDeleteAddressAlert", R.string.PassportDeleteAddressAlert));
} else if (z && 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));
TLRPC.SecureValueType secureValueType = this.currentType.type;
if (secureValueType instanceof TLRPC.TL_secureValueTypeAddress) {
checkBoxCell.setText(LocaleController.getString("PassportDeleteDocumentAddress", R.string.PassportDeleteDocumentAddress), "", true, false);
} else if (secureValueType 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(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 final void onFieldError(View field) {
if (field == null) {
return;
}
Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
AndroidUtilities.shakeView(field);
scrollToField(field);
}
public final void scrollToField(View field) {
while (field != null && this.linearLayout2.indexOfChild(field) < 0) {
field = (View) field.getParent();
}
if (field != null) {
this.scrollView.smoothScrollTo(0, field.getTop() - ((this.scrollView.getMeasuredHeight() - field.getMeasuredHeight()) / 2));
}
}
public final String getDocumentHash(SecureDocument document) {
byte[] bArr;
if (document == null) {
return "";
}
TLRPC.TL_secureFile tL_secureFile = document.secureFile;
if (tL_secureFile != null && (bArr = tL_secureFile.file_hash) != null) {
return Base64.encodeToString(bArr, 2);
}
byte[] bArr2 = document.fileHash;
return bArr2 != null ? Base64.encodeToString(bArr2, 2) : "";
}
public final void checkFieldForError(EditTextBoldCursor field, String key, Editable s, boolean document) {
String str;
String str2;
String str3;
HashMap<String, String> hashMap = this.errorsValues;
if (hashMap != null && (str = hashMap.get(key)) != null) {
if (TextUtils.equals(str, s)) {
HashMap<String, String> hashMap2 = this.fieldsErrors;
if (hashMap2 != null && (str3 = hashMap2.get(key)) != null) {
field.setErrorText(str3);
} else {
HashMap<String, String> hashMap3 = this.documentsErrors;
if (hashMap3 != null && (str2 = hashMap3.get(key)) != null) {
field.setErrorText(str2);
}
}
} else {
field.setErrorText((CharSequence) null);
}
} else {
field.setErrorText((CharSequence) null);
}
String str4 = document ? "error_document_all" : "error_all";
HashMap<String, String> hashMap4 = this.errorsValues;
if (hashMap4 == null || !hashMap4.containsKey(str4)) {
return;
}
this.errorsValues.remove(str4);
checkTopErrorCell(false);
}
public final boolean checkFieldsForError() {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.checkFieldsForError():boolean");
}
public final void createIdentityInterface(final android.content.Context r26) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.createIdentityInterface(android.content.Context):void");
}
public void lambda$createIdentityInterface$40(View view) {
this.uploadingFileType = 2;
openAttachMenu();
}
public void lambda$createIdentityInterface$41(View view) {
this.uploadingFileType = 3;
openAttachMenu();
}
public void lambda$createIdentityInterface$42(View view) {
this.uploadingFileType = 1;
openAttachMenu();
}
public void lambda$createIdentityInterface$43(View view) {
this.uploadingFileType = 4;
openAttachMenu();
}
public void lambda$createIdentityInterface$44(View view) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.CAMERA") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.CAMERA"}, 22);
return;
}
CameraScanActivity cameraScanActivity = new CameraScanActivity(0);
cameraScanActivity.setDelegate(new CameraScanActivity.CameraScanActivityDelegate() {
@Override
public void didFindQr(String str) {
CameraScanActivity.CameraScanActivityDelegate.CC.$default$didFindQr(this, str);
}
@Override
public String getSubtitleText() {
return CameraScanActivity.CameraScanActivityDelegate.CC.$default$getSubtitleText(this);
}
@Override
public void onDismiss() {
CameraScanActivity.CameraScanActivityDelegate.CC.$default$onDismiss(this);
}
@Override
public boolean processQr(String str, Runnable runnable) {
return CameraScanActivity.CameraScanActivityDelegate.CC.$default$processQr(this, str, runnable);
}
@Override
public void didFindMrzInfo(MrzRecognizer.Result result) {
if (!TextUtils.isEmpty(result.firstName)) {
PassportActivity.this.inputFields[0].setText(result.firstName);
}
if (!TextUtils.isEmpty(result.middleName)) {
PassportActivity.this.inputFields[1].setText(result.middleName);
}
if (!TextUtils.isEmpty(result.lastName)) {
PassportActivity.this.inputFields[2].setText(result.lastName);
}
int i = result.gender;
if (i != 0) {
if (i == 1) {
PassportActivity.this.currentGender = "male";
PassportActivity.this.inputFields[4].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
} else if (i == 2) {
PassportActivity.this.currentGender = "female";
PassportActivity.this.inputFields[4].setText(LocaleController.getString("PassportFemale", R.string.PassportFemale));
}
}
if (!TextUtils.isEmpty(result.nationality)) {
PassportActivity.this.currentCitizeship = result.nationality;
String str = (String) PassportActivity.this.languageMap.get(PassportActivity.this.currentCitizeship);
if (str != null) {
PassportActivity.this.inputFields[5].setText(str);
}
}
if (!TextUtils.isEmpty(result.issuingCountry)) {
PassportActivity.this.currentResidence = result.issuingCountry;
String str2 = (String) PassportActivity.this.languageMap.get(PassportActivity.this.currentResidence);
if (str2 != null) {
PassportActivity.this.inputFields[6].setText(str2);
}
}
if (result.birthDay <= 0 || result.birthMonth <= 0 || result.birthYear <= 0) {
return;
}
PassportActivity.this.inputFields[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.birthDay), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
}
});
presentFragment(cameraScanActivity);
}
public boolean lambda$createIdentityInterface$46(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$createIdentityInterface$45(view, country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$createIdentityInterface$45(View view, CountrySelectActivity.Country country) {
int intValue = ((Integer) view.getTag()).intValue();
EditText editText = this.inputFields[intValue];
if (intValue == 5) {
this.currentCitizeship = country.shortname;
} else {
this.currentResidence = country.shortname;
}
editText.setText(country.name);
}
public boolean lambda$createIdentityInterface$49(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() {
public final void didSelectDate(int i7, int i8, int i9) {
PassportActivity.this.lambda$createIdentityInterface$47(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$createIdentityInterface$48(editTextBoldCursor, dialogInterface, i7);
}
});
}
showDialog(createDatePickerDialog.create());
} catch (Exception e) {
FileLog.e(e);
}
}
return true;
}
public void lambda$createIdentityInterface$47(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$createIdentityInterface$48(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$51(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$createIdentityInterface$50(dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
return true;
}
public void lambda$createIdentityInterface$50(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$52(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditText[] editTextArr = this.inputFields;
if (intValue < editTextArr.length) {
if (editTextArr[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;
}
public boolean lambda$createIdentityInterface$53(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditText[] editTextArr = this.inputExtraFields;
if (intValue < editTextArr.length) {
if (editTextArr[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;
}
public void lambda$createIdentityInterface$54(View view) {
createDocumentDeleteAlert();
}
public final void updateInterfaceStringsForDocumentType() {
TLRPC.TL_secureRequiredType tL_secureRequiredType = this.currentDocumentsType;
if (tL_secureRequiredType != null) {
((BaseFragment) this).actionBar.setTitle(getTextForType(tL_secureRequiredType.type));
} else {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("PassportPersonal", R.string.PassportPersonal));
}
updateUploadText(2);
updateUploadText(3);
updateUploadText(1);
updateUploadText(4);
}
public final void updateUploadText(int r7) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.updateUploadText(int):void");
}
public final void checkTopErrorCell(boolean init) {
String str;
String str2;
if (this.topErrorCell == null) {
return;
}
SpannableStringBuilder spannableStringBuilder = null;
if (this.fieldsErrors != null && ((init || this.errorsValues.containsKey("error_all")) && (str2 = this.fieldsErrors.get("error_all")) != null)) {
spannableStringBuilder = new SpannableStringBuilder(str2);
if (init) {
this.errorsValues.put("error_all", "");
}
}
if (this.documentsErrors != null && ((init || 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 (init) {
this.errorsValues.put("error_document_all", "");
}
}
if (spannableStringBuilder != null) {
spannableStringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_text_RedRegular)), 0, spannableStringBuilder.length(), 33);
this.topErrorCell.setText(spannableStringBuilder);
this.topErrorCell.setVisibility(0);
} else if (this.topErrorCell.getVisibility() != 8) {
this.topErrorCell.setVisibility(8);
}
}
public final void addDocumentViewInternal(TLRPC.TL_secureFile f, int uploadingType) {
addDocumentView(new SecureDocument(getSecureDocumentKey(f.secret, f.file_hash), f, (String) null, (byte[]) null, (byte[]) null), uploadingType);
}
public final void addDocumentViews(ArrayList<TLRPC.SecureFile> files) {
this.documents.clear();
int size = files.size();
for (int i = 0; i < size; i++) {
TLRPC.SecureFile secureFile = files.get(i);
if (secureFile instanceof TLRPC.TL_secureFile) {
addDocumentViewInternal((TLRPC.TL_secureFile) secureFile, 0);
}
}
}
public final void addTranslationDocumentViews(ArrayList<TLRPC.SecureFile> files) {
this.translationDocuments.clear();
int size = files.size();
for (int i = 0; i < size; i++) {
TLRPC.SecureFile secureFile = files.get(i);
if (secureFile instanceof TLRPC.TL_secureFile) {
addDocumentViewInternal((TLRPC.TL_secureFile) secureFile, 4);
}
}
}
public final void setFieldValues(java.util.HashMap<java.lang.String, java.lang.String> r7, org.telegram.ui.Components.EditTextBoldCursor r8, java.lang.String r9) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.setFieldValues(java.util.HashMap, org.telegram.ui.Components.EditTextBoldCursor, java.lang.String):void");
}
public final void addDocumentView(final SecureDocument document, final int type) {
String string;
String str;
String formatDateForBan;
HashMap<String, String> hashMap;
if (type == 1) {
this.selfieDocument = document;
if (this.selfieLayout == null) {
return;
}
} else if (type == 4) {
this.translationDocuments.add(document);
if (this.translationLayout == null) {
return;
}
} else if (type == 2) {
this.frontDocument = document;
if (this.frontLayout == null) {
return;
}
} else if (type == 3) {
this.reverseDocument = document;
if (this.reverseLayout == null) {
return;
}
} else {
this.documents.add(document);
if (this.documentsLayout == null) {
return;
}
}
if (getParentActivity() == null) {
return;
}
final SecureDocumentCell secureDocumentCell = new SecureDocumentCell(getParentActivity());
secureDocumentCell.setTag(document);
secureDocumentCell.setBackgroundDrawable(Theme.getSelectorDrawable(true));
this.documentsCells.put(document, secureDocumentCell);
String documentHash = getDocumentHash(document);
if (type == 1) {
string = LocaleController.getString("PassportSelfie", R.string.PassportSelfie);
this.selfieLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
str = "selfie" + documentHash;
} else if (type == 4) {
string = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
this.translationLayout.addView(secureDocumentCell, LayoutHelper.createLinear(-1, -2));
str = "translation" + documentHash;
} else if (type == 2) {
TLRPC.SecureValueType secureValueType = this.currentDocumentsType.type;
if ((secureValueType instanceof TLRPC.TL_secureValueTypePassport) || (secureValueType 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 (type == 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) {
formatDateForBan = LocaleController.formatDateForBan(document.secureFile.date);
} else {
secureDocumentCell.valueTextView.setTextColor(Theme.getColor(Theme.key_text_RedRegular));
this.errorsValues.put(str2, "");
}
secureDocumentCell.setTextAndValueAndImage(string, formatDateForBan, document);
secureDocumentCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PassportActivity.this.lambda$addDocumentView$55(type, view);
}
});
secureDocumentCell.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
boolean lambda$addDocumentView$57;
lambda$addDocumentView$57 = PassportActivity.this.lambda$addDocumentView$57(type, document, secureDocumentCell, str2, view);
return lambda$addDocumentView$57;
}
});
}
public void lambda$addDocumentView$55(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(this);
if (i == 1) {
ArrayList<SecureDocument> arrayList = new ArrayList<>();
arrayList.add(this.selfieDocument);
PhotoViewer.getInstance().openPhoto(arrayList, 0, this.provider);
return;
}
if (i == 2) {
ArrayList<SecureDocument> arrayList2 = new ArrayList<>();
arrayList2.add(this.frontDocument);
PhotoViewer.getInstance().openPhoto(arrayList2, 0, this.provider);
} else if (i == 3) {
ArrayList<SecureDocument> arrayList3 = new ArrayList<>();
arrayList3.add(this.reverseDocument);
PhotoViewer.getInstance().openPhoto(arrayList3, 0, this.provider);
} else if (i == 0) {
PhotoViewer photoViewer = PhotoViewer.getInstance();
ArrayList<SecureDocument> arrayList4 = this.documents;
photoViewer.openPhoto(arrayList4, arrayList4.indexOf(secureDocument), this.provider);
} else {
PhotoViewer photoViewer2 = PhotoViewer.getInstance();
ArrayList<SecureDocument> arrayList5 = this.translationDocuments;
photoViewer2.openPhoto(arrayList5, arrayList5.indexOf(secureDocument), this.provider);
}
}
public boolean lambda$addDocumentView$57(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$addDocumentView$56(secureDocument, i, secureDocumentCell, str, dialogInterface, i2);
}
});
showDialog(builder.create());
return true;
}
public void lambda$addDocumentView$56(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);
String str2 = secureDocument.path;
if (str2 == null || this.uploadingDocuments.remove(str2) == null) {
return;
}
if (this.uploadingDocuments.isEmpty()) {
this.doneItem.setEnabled(true);
this.doneItem.setAlpha(1.0f);
}
FileLoader.getInstance(((BaseFragment) this).currentAccount).cancelFileUpload(secureDocument.path, false);
}
public final String getNameForType(TLRPC.SecureValueType type) {
return type instanceof TLRPC.TL_secureValueTypePersonalDetails ? "personal_details" : type instanceof TLRPC.TL_secureValueTypePassport ? "passport" : type instanceof TLRPC.TL_secureValueTypeInternalPassport ? "internal_passport" : type instanceof TLRPC.TL_secureValueTypeDriverLicense ? "driver_license" : type instanceof TLRPC.TL_secureValueTypeIdentityCard ? "identity_card" : type instanceof TLRPC.TL_secureValueTypeUtilityBill ? "utility_bill" : type instanceof TLRPC.TL_secureValueTypeAddress ? "address" : type instanceof TLRPC.TL_secureValueTypeBankStatement ? "bank_statement" : type instanceof TLRPC.TL_secureValueTypeRentalAgreement ? "rental_agreement" : type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration ? "temporary_registration" : type instanceof TLRPC.TL_secureValueTypePassportRegistration ? "passport_registration" : type instanceof TLRPC.TL_secureValueTypeEmail ? "email" : type instanceof TLRPC.TL_secureValueTypePhone ? "phone" : "";
}
public final TextDetailSecureCell getViewByType(TLRPC.TL_secureRequiredType requiredType) {
TLRPC.TL_secureRequiredType tL_secureRequiredType;
TextDetailSecureCell textDetailSecureCell = this.typesViews.get(requiredType);
return (textDetailSecureCell != null || (tL_secureRequiredType = this.documentsToTypesLink.get(requiredType)) == null) ? textDetailSecureCell : this.typesViews.get(tL_secureRequiredType);
}
public final String getTextForType(TLRPC.SecureValueType type) {
if (type instanceof TLRPC.TL_secureValueTypePassport) {
return LocaleController.getString("ActionBotDocumentPassport", R.string.ActionBotDocumentPassport);
}
if (type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
return LocaleController.getString("ActionBotDocumentDriverLicence", R.string.ActionBotDocumentDriverLicence);
}
if (type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
return LocaleController.getString("ActionBotDocumentIdentityCard", R.string.ActionBotDocumentIdentityCard);
}
if (type instanceof TLRPC.TL_secureValueTypeUtilityBill) {
return LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill);
}
if (type instanceof TLRPC.TL_secureValueTypeBankStatement) {
return LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement);
}
if (type instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
return LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement);
}
if (type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
return LocaleController.getString("ActionBotDocumentInternalPassport", R.string.ActionBotDocumentInternalPassport);
}
if (type instanceof TLRPC.TL_secureValueTypePassportRegistration) {
return LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration);
}
if (type instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
return LocaleController.getString("ActionBotDocumentTemporaryRegistration", R.string.ActionBotDocumentTemporaryRegistration);
}
if (type instanceof TLRPC.TL_secureValueTypePhone) {
return LocaleController.getString("ActionBotDocumentPhone", R.string.ActionBotDocumentPhone);
}
return type instanceof TLRPC.TL_secureValueTypeEmail ? LocaleController.getString("ActionBotDocumentEmail", R.string.ActionBotDocumentEmail) : "";
}
public final void setTypeValue(org.telegram.tgnet.TLRPC.TL_secureRequiredType r32, java.lang.String r33, java.lang.String r34, org.telegram.tgnet.TLRPC.TL_secureRequiredType r35, java.lang.String r36, boolean r37, int r38) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.setTypeValue(org.telegram.tgnet.TLRPC$TL_secureRequiredType, java.lang.String, java.lang.String, org.telegram.tgnet.TLRPC$TL_secureRequiredType, java.lang.String, boolean, int):void");
}
public final void checkNativeFields(boolean byEdit) {
EditText[] editTextArr;
if (this.inputExtraFields == null) {
return;
}
String str = this.languageMap.get(this.currentResidence);
String str2 = (String) 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) {
EditText[] editTextArr2 = this.inputExtraFields;
if (i >= editTextArr2.length) {
break;
}
((View) editTextArr2[i].getParent()).setVisibility(8);
i++;
}
if (((this.currentBotId != 0 || this.currentDocumentsType == null) && this.currentTypeValue != null && !this.documentOnly) || this.currentDocumentsTypeValue != null) {
this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
return;
} else {
this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), 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) {
editTextArr = this.inputExtraFields;
if (i2 >= editTextArr.length) {
break;
}
((View) editTextArr[i2].getParent()).setVisibility(0);
i2++;
}
if (editTextArr[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;
}
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;
}
i3++;
}
}
this.sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
}
this.nativeInfoCell.setText(LocaleController.formatString("PassportNativeInfo", R.string.PassportNativeInfo, new Object[]{str}));
String serverString = str2 != null ? LocaleController.getServerString("PassportLanguage_" + str2) : null;
if (serverString != null) {
this.headerCell.setText(LocaleController.formatString("PassportNativeHeaderLang", R.string.PassportNativeHeaderLang, new Object[]{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, new Object[]{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, new Object[]{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, new Object[]{str}));
}
}
if (byEdit) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$checkNativeFields$58();
}
});
}
}
public void lambda$checkNativeFields$58() {
View[] viewArr = this.inputExtraFields;
if (viewArr != null) {
scrollToField(viewArr[0]);
}
}
public final TLRPC.TL_secureValue getValueByType(TLRPC.TL_secureRequiredType requiredType, boolean check) {
String[] strArr;
JSONObject jSONObject;
int i;
if (requiredType == null) {
return null;
}
int size = this.currentForm.values.size();
for (int i2 = 0; i2 < size; i2++) {
TLRPC.TL_secureValue tL_secureValue = (TLRPC.TL_secureValue) this.currentForm.values.get(i2);
if (requiredType.type.getClass() == tL_secureValue.type.getClass()) {
if (check) {
if (requiredType.selfie_required && !(tL_secureValue.selfie instanceof TLRPC.TL_secureFile)) {
return null;
}
if (requiredType.translation_required && tL_secureValue.translation.isEmpty()) {
return null;
}
if (isAddressDocument(requiredType.type) && tL_secureValue.files.isEmpty()) {
return null;
}
if (isPersonalDocument(requiredType.type) && !(tL_secureValue.front_side instanceof TLRPC.TL_secureFile)) {
return null;
}
TLRPC.SecureValueType secureValueType = requiredType.type;
if (((secureValueType instanceof TLRPC.TL_secureValueTypeDriverLicense) || (secureValueType instanceof TLRPC.TL_secureValueTypeIdentityCard)) && !(tL_secureValue.reverse_side instanceof TLRPC.TL_secureFile)) {
return null;
}
if ((secureValueType instanceof TLRPC.TL_secureValueTypePersonalDetails) || (secureValueType instanceof TLRPC.TL_secureValueTypeAddress)) {
if (secureValueType instanceof TLRPC.TL_secureValueTypePersonalDetails) {
if (requiredType.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", "state", "country_code"};
}
try {
TLRPC.TL_secureData tL_secureData = tL_secureValue.data;
jSONObject = new JSONObject(decryptData(tL_secureData.data, decryptValueSecret(tL_secureData.secret, tL_secureData.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;
}
public final void openTypeActivity(TLRPC.TL_secureRequiredType requiredType, TLRPC.TL_secureRequiredType documentRequiredType, ArrayList<TLRPC.TL_secureRequiredType> availableDocumentTypes, final boolean documentOnly) {
int i;
TLRPC.account_Password account_password;
HashMap<String, String> hashMap;
final int size = availableDocumentTypes != null ? availableDocumentTypes.size() : 0;
final TLRPC.SecureValueType secureValueType = requiredType.type;
TLRPC.SecureValueType secureValueType2 = documentRequiredType != null ? documentRequiredType.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 = !documentOnly ? this.errorsMap.get(getNameForType(secureValueType)) : null;
HashMap<String, String> hashMap3 = this.errorsMap.get(getNameForType(secureValueType2));
TLRPC.TL_secureValue valueByType = getValueByType(requiredType, false);
TLRPC.TL_secureValue valueByType2 = getValueByType(documentRequiredType, false);
TLRPC.TL_account_authorizationForm tL_account_authorizationForm = this.currentForm;
TLRPC.account_Password account_password2 = this.currentPassword;
HashMap<String, String> hashMap4 = this.typesValues.get(requiredType);
if (documentRequiredType != null) {
account_password = account_password2;
hashMap = this.typesValues.get(documentRequiredType);
} else {
account_password = account_password2;
hashMap = null;
}
int i2 = i;
PassportActivity passportActivity = new PassportActivity(i, tL_account_authorizationForm, account_password, requiredType, valueByType, documentRequiredType, valueByType2, hashMap4, hashMap);
passportActivity.delegate = new PassportActivityDelegate() {
public final TLRPC.InputSecureFile getInputSecureFile(SecureDocument document) {
if (document.inputFile != null) {
TLRPC.TL_inputSecureFileUploaded tL_inputSecureFileUploaded = new TLRPC.TL_inputSecureFileUploaded();
TLRPC.TL_inputFile tL_inputFile = document.inputFile;
tL_inputSecureFileUploaded.id = ((TLRPC.InputFile) tL_inputFile).id;
tL_inputSecureFileUploaded.parts = ((TLRPC.InputFile) tL_inputFile).parts;
tL_inputSecureFileUploaded.md5_checksum = ((TLRPC.InputFile) tL_inputFile).md5_checksum;
tL_inputSecureFileUploaded.file_hash = document.fileHash;
tL_inputSecureFileUploaded.secret = document.fileSecret;
return tL_inputSecureFileUploaded;
}
TLRPC.TL_inputSecureFile tL_inputSecureFile = new TLRPC.TL_inputSecureFile();
TLRPC.TL_secureFile tL_secureFile = document.secureFile;
tL_inputSecureFile.id = tL_secureFile.id;
tL_inputSecureFile.access_hash = tL_secureFile.access_hash;
return tL_inputSecureFile;
}
public final void renameFile(SecureDocument oldDocument, TLRPC.TL_secureFile newSecureFile) {
File pathToAttach = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(oldDocument);
String str = oldDocument.secureFile.dc_id + "_" + oldDocument.secureFile.id;
File pathToAttach2 = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(newSecureFile);
String str2 = newSecureFile.dc_id + "_" + newSecureFile.id;
pathToAttach.renameTo(pathToAttach2);
ImageLoader.getInstance().replaceImageInCache(str, str2, (ImageLocation) null, false);
}
@Override
public void saveValue(final TLRPC.TL_secureRequiredType requiredType2, final String text, final String json, final TLRPC.TL_secureRequiredType documentRequiredType2, final String documentsJson, final ArrayList<SecureDocument> documents, final SecureDocument selfie, final ArrayList<SecureDocument> translationDocuments, final SecureDocument front, final SecureDocument reverse, final Runnable finishRunnable, final ErrorRunnable errorRunnable) {
TLRPC.TL_inputSecureValue tL_inputSecureValue;
TLRPC.TL_securePlainEmail tL_securePlainPhone;
TLRPC.TL_inputSecureValue tL_inputSecureValue2;
if (!TextUtils.isEmpty(json)) {
tL_inputSecureValue = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue.type = requiredType2.type;
tL_inputSecureValue.flags |= 1;
EncryptionResult encryptData = PassportActivity.this.encryptData(AndroidUtilities.getStringBytes(json));
TLRPC.TL_secureData tL_secureData = new TLRPC.TL_secureData();
tL_inputSecureValue.data = tL_secureData;
tL_secureData.data = encryptData.encryptedData;
tL_secureData.data_hash = encryptData.fileHash;
tL_secureData.secret = encryptData.fileSecret;
} else if (TextUtils.isEmpty(text)) {
tL_inputSecureValue = null;
} else {
TLRPC.SecureValueType secureValueType3 = secureValueType;
if (secureValueType3 instanceof TLRPC.TL_secureValueTypeEmail) {
tL_securePlainPhone = new TLRPC.TL_securePlainEmail();
tL_securePlainPhone.email = text;
} else {
if (!(secureValueType3 instanceof TLRPC.TL_secureValueTypePhone)) {
return;
}
tL_securePlainPhone = new TLRPC.TL_securePlainPhone();
((TLRPC.TL_securePlainPhone) tL_securePlainPhone).phone = text;
}
TLRPC.TL_inputSecureValue tL_inputSecureValue3 = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue3.type = requiredType2.type;
tL_inputSecureValue3.flags |= 32;
tL_inputSecureValue3.plain_data = tL_securePlainPhone;
tL_inputSecureValue = tL_inputSecureValue3;
}
if (!documentOnly && tL_inputSecureValue == null) {
if (errorRunnable != null) {
errorRunnable.onError(null, null);
return;
}
return;
}
if (documentRequiredType2 != null) {
TLRPC.TL_inputSecureValue tL_inputSecureValue4 = new TLRPC.TL_inputSecureValue();
tL_inputSecureValue4.type = documentRequiredType2.type;
if (!TextUtils.isEmpty(documentsJson)) {
tL_inputSecureValue4.flags |= 1;
EncryptionResult encryptData2 = PassportActivity.this.encryptData(AndroidUtilities.getStringBytes(documentsJson));
TLRPC.TL_secureData tL_secureData2 = new TLRPC.TL_secureData();
tL_inputSecureValue4.data = tL_secureData2;
tL_secureData2.data = encryptData2.encryptedData;
tL_secureData2.data_hash = encryptData2.fileHash;
tL_secureData2.secret = encryptData2.fileSecret;
}
if (front != null) {
tL_inputSecureValue4.front_side = getInputSecureFile(front);
tL_inputSecureValue4.flags |= 2;
}
if (reverse != null) {
tL_inputSecureValue4.reverse_side = getInputSecureFile(reverse);
tL_inputSecureValue4.flags |= 4;
}
if (selfie != null) {
tL_inputSecureValue4.selfie = getInputSecureFile(selfie);
tL_inputSecureValue4.flags |= 8;
}
if (translationDocuments != null && !translationDocuments.isEmpty()) {
tL_inputSecureValue4.flags |= 64;
int size2 = translationDocuments.size();
for (int i3 = 0; i3 < size2; i3++) {
tL_inputSecureValue4.translation.add(getInputSecureFile(translationDocuments.get(i3)));
}
}
if (documents != null && !documents.isEmpty()) {
tL_inputSecureValue4.flags |= 16;
int size3 = documents.size();
for (int i4 = 0; i4 < size3; i4++) {
tL_inputSecureValue4.files.add(getInputSecureFile(documents.get(i4)));
}
}
if (!documentOnly) {
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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_account_saveSecureValue, new AnonymousClass1(errorRunnable, text, tL_account_saveSecureValue, documentRequiredType2, requiredType2, documents, selfie, front, reverse, translationDocuments, json, documentsJson, finishRunnable, 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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_account_saveSecureValue2, new AnonymousClass1(errorRunnable, text, tL_account_saveSecureValue2, documentRequiredType2, requiredType2, documents, selfie, front, reverse, translationDocuments, json, documentsJson, finishRunnable, this, tL_inputSecureValue2));
}
public class AnonymousClass1 implements RequestDelegate {
public final PassportActivityDelegate val$currentDelegate;
public final TLRPC.TL_secureRequiredType val$documentRequiredType;
public final ArrayList val$documents;
public final String val$documentsJson;
public final ErrorRunnable val$errorRunnable;
public final TLRPC.TL_inputSecureValue val$finalFileInputSecureValue;
public final Runnable val$finishRunnable;
public final SecureDocument val$front;
public final String val$json;
public final TLRPC.TL_account_saveSecureValue val$req;
public final TLRPC.TL_secureRequiredType val$requiredType;
public final SecureDocument val$reverse;
public final SecureDocument val$selfie;
public final String val$text;
public final ArrayList val$translationDocuments;
public AnonymousClass1(final ErrorRunnable val$errorRunnable, final String val$text, final TLRPC.TL_account_saveSecureValue val$req, final TLRPC.TL_secureRequiredType val$documentRequiredType, final TLRPC.TL_secureRequiredType val$requiredType, final ArrayList val$documents, final SecureDocument val$selfie, final SecureDocument val$front, final SecureDocument val$reverse, final ArrayList val$translationDocuments, final String val$json, final String val$documentsJson, final Runnable val$finishRunnable, final PassportActivityDelegate val$currentDelegate, final TLRPC.TL_inputSecureValue val$finalFileInputSecureValue) {
this.val$errorRunnable = val$errorRunnable;
this.val$text = val$text;
this.val$req = val$req;
this.val$documentRequiredType = val$documentRequiredType;
this.val$requiredType = val$requiredType;
this.val$documents = val$documents;
this.val$selfie = val$selfie;
this.val$front = val$front;
this.val$reverse = val$reverse;
this.val$translationDocuments = val$translationDocuments;
this.val$json = val$json;
this.val$documentsJson = val$documentsJson;
this.val$finishRunnable = val$finishRunnable;
this.val$currentDelegate = val$currentDelegate;
this.val$finalFileInputSecureValue = val$finalFileInputSecureValue;
}
public final void lambda$run$4(final TLRPC.TL_error error, final TLRPC.TL_secureValue newValue, final TLRPC.TL_secureValue newPendingValue) {
final ErrorRunnable errorRunnable = this.val$errorRunnable;
final String str = this.val$text;
final TLRPC.TL_account_saveSecureValue tL_account_saveSecureValue = this.val$req;
AnonymousClass20 anonymousClass20 = AnonymousClass20.this;
final boolean z = documentOnly;
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.AnonymousClass20.AnonymousClass1.this.lambda$onResult$0(error, errorRunnable, str, tL_account_saveSecureValue, z, tL_secureRequiredType, tL_secureRequiredType2, newValue, newPendingValue, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, i, runnable);
}
});
}
public void lambda$onResult$0(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(((BaseFragment) PassportActivity.this).currentAccount, tL_error, PassportActivity.this, tL_account_saveSecureValue, new Object[]{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.TL_secureFile tL_secureFile = (TLRPC.SecureFile) tL_secureValue.files.get(i4);
i2 = size;
if (tL_secureFile instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile2 = tL_secureFile;
if (Utilities.arraysEquals(secureDocument4.fileSecret, 0, tL_secureFile2.secret, 0)) {
renameFile(secureDocument4, tL_secureFile2);
break;
}
}
i4++;
size = i2;
}
}
i2 = size;
i3++;
size = i2;
}
}
if (secureDocument != null && secureDocument.inputFile != null) {
TLRPC.TL_secureFile tL_secureFile3 = tL_secureValue.selfie;
if (tL_secureFile3 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile4 = tL_secureFile3;
if (Utilities.arraysEquals(secureDocument.fileSecret, 0, tL_secureFile4.secret, 0)) {
renameFile(secureDocument, tL_secureFile4);
}
}
}
if (secureDocument2 != null && secureDocument2.inputFile != null) {
TLRPC.TL_secureFile tL_secureFile5 = tL_secureValue.front_side;
if (tL_secureFile5 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile6 = tL_secureFile5;
if (Utilities.arraysEquals(secureDocument2.fileSecret, 0, tL_secureFile6.secret, 0)) {
renameFile(secureDocument2, tL_secureFile6);
}
}
}
if (secureDocument3 != null && secureDocument3.inputFile != null) {
TLRPC.TL_secureFile tL_secureFile7 = tL_secureValue.reverse_side;
if (tL_secureFile7 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile8 = tL_secureFile7;
if (Utilities.arraysEquals(secureDocument3.fileSecret, 0, tL_secureFile8.secret, 0)) {
renameFile(secureDocument3, tL_secureFile8);
}
}
}
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.TL_secureFile tL_secureFile9 = (TLRPC.SecureFile) tL_secureValue.translation.get(i6);
if (tL_secureFile9 instanceof TLRPC.TL_secureFile) {
TLRPC.TL_secureFile tL_secureFile10 = tL_secureFile9;
if (Utilities.arraysEquals(secureDocument5.fileSecret, 0, tL_secureFile10.secret, 0)) {
renameFile(secureDocument5, tL_secureFile10);
break;
}
}
}
}
}
}
PassportActivity.this.setTypeValue(tL_secureRequiredType2, str, str2, tL_secureRequiredType, str3, z, i);
if (runnable != null) {
runnable.run();
}
}
public void run(final TLObject response, final TLRPC.TL_error error) {
if (error != null) {
if (error.text.equals("EMAIL_VERIFICATION_NEEDED")) {
TLRPC.TL_account_sendVerifyEmailCode tL_account_sendVerifyEmailCode = new TLRPC.TL_account_sendVerifyEmailCode();
tL_account_sendVerifyEmailCode.purpose = new TLRPC.TL_emailVerifyPurposePassport();
tL_account_sendVerifyEmailCode.email = this.val$text;
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(((BaseFragment) 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() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass20.AnonymousClass1.this.lambda$run$2(str, tL_secureRequiredType, passportActivityDelegate, errorRunnable, tLObject, tL_error);
}
});
return;
}
if (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.AnonymousClass20.AnonymousClass1.lambda$run$3(PassportActivity.ErrorRunnable.this, error, str2);
}
});
return;
}
}
if (error == null && this.val$finalFileInputSecureValue != null) {
final TLRPC.TL_secureValue tL_secureValue = (TLRPC.TL_secureValue) response;
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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_account_saveSecureValue, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.AnonymousClass20.AnonymousClass1.this.lambda$run$4(tL_secureValue, tLObject, tL_error);
}
});
return;
}
lambda$run$4(error, (TLRPC.TL_secureValue) response, null);
}
public void lambda$run$2(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.AnonymousClass20.AnonymousClass1.this.lambda$run$1(tLObject, str, tL_secureRequiredType, passportActivityDelegate, tL_error, errorRunnable);
}
});
}
public void lambda$run$1(TLObject tLObject, String str, TLRPC.TL_secureRequiredType tL_secureRequiredType, PassportActivityDelegate passportActivityDelegate, TLRPC.TL_error tL_error, ErrorRunnable errorRunnable) {
if (tLObject != null) {
TLRPC.TL_account_sentEmailCode tL_account_sentEmailCode = (TLRPC.TL_account_sentEmailCode) tLObject;
HashMap hashMap = new HashMap();
hashMap.put("email", str);
hashMap.put("pattern", tL_account_sentEmailCode.email_pattern);
PassportActivity passportActivity = new PassportActivity(6, PassportActivity.this.currentForm, PassportActivity.this.currentPassword, tL_secureRequiredType, (TLRPC.TL_secureValue) null, (TLRPC.TL_secureRequiredType) null, (TLRPC.TL_secureValue) null, (HashMap<String, String>) hashMap, (HashMap<String, String>) null);
((BaseFragment) passportActivity).currentAccount = ((BaseFragment) PassportActivity.this).currentAccount;
passportActivity.emailCodeLength = tL_account_sentEmailCode.length;
passportActivity.saltedPassword = PassportActivity.this.saltedPassword;
passportActivity.secureSecret = PassportActivity.this.secureSecret;
passportActivity.delegate = passportActivityDelegate;
PassportActivity.this.presentFragment(passportActivity, true);
return;
}
PassportActivity.this.showAlertWithText(LocaleController.getString("PassportEmail", R.string.PassportEmail), tL_error.text);
if (errorRunnable != null) {
errorRunnable.onError(tL_error.text, str);
}
}
public static void lambda$run$3(ErrorRunnable errorRunnable, TLRPC.TL_error tL_error, String str) {
errorRunnable.onError(tL_error.text, str);
}
}
@Override
public SecureDocument saveFile(TLRPC.TL_secureFile secureFile) {
String str = FileLoader.getDirectory(4) + "/" + secureFile.dc_id + "_" + secureFile.id + ".jpg";
EncryptionResult createSecureDocument = PassportActivity.this.createSecureDocument(str);
return new SecureDocument(createSecureDocument.secureDocumentKey, secureFile, str, createSecureDocument.fileHash, createSecureDocument.fileSecret);
}
@Override
public void deleteValue(TLRPC.TL_secureRequiredType requiredType2, TLRPC.TL_secureRequiredType documentRequiredType2, ArrayList<TLRPC.TL_secureRequiredType> documentRequiredTypes, boolean deleteType, Runnable finishRunnable, ErrorRunnable errorRunnable) {
PassportActivity.this.deleteValueInternal(requiredType2, documentRequiredType2, documentRequiredTypes, deleteType, finishRunnable, errorRunnable, documentOnly);
}
};
((BaseFragment) passportActivity).currentAccount = ((BaseFragment) this).currentAccount;
passportActivity.saltedPassword = this.saltedPassword;
passportActivity.secureSecret = this.secureSecret;
passportActivity.currentBotId = this.currentBotId;
passportActivity.fieldsErrors = hashMap2;
passportActivity.documentOnly = documentOnly;
passportActivity.documentsErrors = hashMap3;
passportActivity.availableDocumentTypes = availableDocumentTypes;
if (i2 == 4) {
passportActivity.currentEmail = this.currentEmail;
}
presentFragment(passportActivity);
}
}
public final TLRPC.TL_secureValue removeValue(TLRPC.TL_secureRequiredType requiredType) {
if (requiredType == null) {
return null;
}
int size = this.currentForm.values.size();
for (int i = 0; i < size; i++) {
if (requiredType.type.getClass() == ((TLRPC.TL_secureValue) this.currentForm.values.get(i)).type.getClass()) {
return (TLRPC.TL_secureValue) this.currentForm.values.remove(i);
}
}
return null;
}
public final void deleteValueInternal(final TLRPC.TL_secureRequiredType requiredType, final TLRPC.TL_secureRequiredType documentRequiredType, final ArrayList<TLRPC.TL_secureRequiredType> documentRequiredTypes, final boolean deleteType, final Runnable finishRunnable, final ErrorRunnable errorRunnable, final boolean documentOnly) {
if (requiredType == null) {
return;
}
TLRPC.TL_account_deleteSecureValue tL_account_deleteSecureValue = new TLRPC.TL_account_deleteSecureValue();
if (!documentOnly || documentRequiredType == null) {
if (deleteType) {
tL_account_deleteSecureValue.types.add(requiredType.type);
}
if (documentRequiredType != null) {
tL_account_deleteSecureValue.types.add(documentRequiredType.type);
}
} else {
tL_account_deleteSecureValue.types.add(documentRequiredType.type);
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_deleteSecureValue, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$deleteValueInternal$60(errorRunnable, documentOnly, documentRequiredType, requiredType, deleteType, documentRequiredTypes, finishRunnable, tLObject, tL_error);
}
});
}
public void lambda$deleteValueInternal$60(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$deleteValueInternal$59(tL_error, errorRunnable, z, tL_secureRequiredType, tL_secureRequiredType2, z2, arrayList, runnable);
}
});
}
public void lambda$deleteValueInternal$59(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;
TLRPC.TL_secureData tL_secureData;
String str2;
String str3 = null;
if (tL_error != null) {
if (errorRunnable != null) {
errorRunnable.onError(tL_error.text, null);
}
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
return;
}
if (!z) {
if (z2) {
removeValue(tL_secureRequiredType2);
}
removeValue(tL_secureRequiredType);
} else if (tL_secureRequiredType != null) {
removeValue(tL_secureRequiredType);
} else {
removeValue(tL_secureRequiredType2);
}
if (this.currentActivityType == 8) {
TextDetailSecureCell remove = this.typesViews.remove(tL_secureRequiredType2);
if (remove != null) {
this.linearLayout2.removeView(remove);
View childAt = this.linearLayout2.getChildAt(r0.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) {
TLRPC.TL_secureData tL_secureData2 = valueByType.data;
if (tL_secureData2 != null) {
str2 = decryptData(tL_secureData2.data, decryptValueSecret(tL_secureData2.secret, tL_secureData2.data_hash), valueByType.data.data_hash);
}
} else {
i++;
}
}
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 && (tL_secureData = valueByType2.data) != null) {
str3 = decryptData(tL_secureData.data, decryptValueSecret(tL_secureData.secret, tL_secureData.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();
}
}
public final org.telegram.ui.PassportActivity.TextDetailSecureCell addField(android.content.Context r17, final org.telegram.tgnet.TLRPC.TL_secureRequiredType r18, final java.util.ArrayList<org.telegram.tgnet.TLRPC.TL_secureRequiredType> r19, final boolean r20, boolean r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.addField(android.content.Context, org.telegram.tgnet.TLRPC$TL_secureRequiredType, java.util.ArrayList, boolean, boolean):org.telegram.ui.PassportActivity$TextDetailSecureCell");
}
public void lambda$addField$64(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;
TLRPC.SecureValueType secureValueType = tL_secureRequiredType.type;
if ((secureValueType instanceof TLRPC.TL_secureValueTypePersonalDetails) || (secureValueType 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);
TLRPC.SecureValueType secureValueType2 = tL_secureRequiredType.type;
if (secureValueType2 instanceof TLRPC.TL_secureValueTypePersonalDetails) {
builder.setTitle(LocaleController.getString("PassportIdentityDocument", R.string.PassportIdentityDocument));
} else if (secureValueType2 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.SecureValueType secureValueType3 = ((TLRPC.TL_secureRequiredType) arrayList.get(i3)).type;
if (secureValueType3 instanceof TLRPC.TL_secureValueTypeDriverLicense) {
arrayList2.add(LocaleController.getString("PassportAddLicence", R.string.PassportAddLicence));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypePassport) {
arrayList2.add(LocaleController.getString("PassportAddPassport", R.string.PassportAddPassport));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeInternalPassport) {
arrayList2.add(LocaleController.getString("PassportAddInternalPassport", R.string.PassportAddInternalPassport));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeIdentityCard) {
arrayList2.add(LocaleController.getString("PassportAddCard", R.string.PassportAddCard));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeUtilityBill) {
arrayList2.add(LocaleController.getString("PassportAddBill", R.string.PassportAddBill));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeBankStatement) {
arrayList2.add(LocaleController.getString("PassportAddBank", R.string.PassportAddBank));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeRentalAgreement) {
arrayList2.add(LocaleController.getString("PassportAddAgreement", R.string.PassportAddAgreement));
} else if (secureValueType3 instanceof TLRPC.TL_secureValueTypeTemporaryRegistration) {
arrayList2.add(LocaleController.getString("PassportAddTemporaryRegistration", R.string.PassportAddTemporaryRegistration));
} else if (secureValueType3 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$addField$61(tL_secureRequiredType, arrayList, z, dialogInterface, i4);
}
});
showDialog(builder.create());
return;
}
} else {
boolean z2 = secureValueType instanceof TLRPC.TL_secureValueTypePhone;
if ((z2 || (secureValueType 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$addField$63(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$addField$61(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$addField$63(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$addField$62(str, str2);
}
}, z);
}
public void lambda$addField$62(String str, String str2) {
needHideProgress();
}
public static class EncryptionResult {
public byte[] decrypyedFileSecret;
public byte[] encryptedData;
public byte[] fileHash;
public byte[] fileSecret;
public SecureDocumentKey secureDocumentKey;
public EncryptionResult(byte[] d, byte[] fs, byte[] dfs, byte[] fh, byte[] fk, byte[] fi) {
this.encryptedData = d;
this.fileSecret = fs;
this.fileHash = fh;
this.decrypyedFileSecret = dfs;
this.secureDocumentKey = new SecureDocumentKey(fk, fi);
}
}
public final SecureDocumentKey getSecureDocumentKey(byte[] file_secret, byte[] file_hash) {
byte[] computeSHA512 = Utilities.computeSHA512(decryptValueSecret(file_secret, file_hash), file_hash);
byte[] bArr = new byte[32];
System.arraycopy(computeSHA512, 0, bArr, 0, 32);
byte[] bArr2 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr2, 0, 16);
return new SecureDocumentKey(bArr, bArr2);
}
public final byte[] decryptSecret(byte[] secret, byte[] passwordHash) {
if (secret == null || secret.length != 32) {
return null;
}
byte[] bArr = new byte[32];
System.arraycopy(passwordHash, 0, bArr, 0, 32);
byte[] bArr2 = new byte[16];
System.arraycopy(passwordHash, 32, bArr2, 0, 16);
byte[] bArr3 = new byte[32];
System.arraycopy(secret, 0, bArr3, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr3, bArr, bArr2, 0, 32, 0, 0);
return bArr3;
}
public final byte[] decryptValueSecret(byte[] encryptedSecureValueSecret, byte[] hash) {
if (encryptedSecureValueSecret == null || encryptedSecureValueSecret.length != 32 || hash == null || hash.length != 32) {
return null;
}
byte[] bArr = new byte[32];
System.arraycopy(this.saltedPassword, 0, bArr, 0, 32);
byte[] bArr2 = new byte[16];
System.arraycopy(this.saltedPassword, 32, bArr2, 0, 16);
byte[] bArr3 = new byte[32];
System.arraycopy(this.secureSecret, 0, bArr3, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr3, bArr, bArr2, 0, 32, 0, 0);
if (!checkSecret(bArr3, null)) {
return null;
}
byte[] computeSHA512 = Utilities.computeSHA512(bArr3, hash);
byte[] bArr4 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr4, 0, 32);
byte[] bArr5 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr5, 0, 16);
byte[] bArr6 = new byte[32];
System.arraycopy(encryptedSecureValueSecret, 0, bArr6, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr6, bArr4, bArr5, 0, 32, 0, 0);
return bArr6;
}
public final org.telegram.ui.PassportActivity.EncryptionResult createSecureDocument(java.lang.String r5) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PassportActivity.createSecureDocument(java.lang.String):org.telegram.ui.PassportActivity$EncryptionResult");
}
public final String decryptData(byte[] data, byte[] file_secret, byte[] file_hash) {
if (data == null || file_secret == null || file_secret.length != 32 || file_hash == null || file_hash.length != 32) {
return null;
}
byte[] computeSHA512 = Utilities.computeSHA512(file_secret, file_hash);
byte[] bArr = new byte[32];
System.arraycopy(computeSHA512, 0, bArr, 0, 32);
byte[] bArr2 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr2, 0, 16);
int length = data.length;
byte[] bArr3 = new byte[length];
System.arraycopy(data, 0, bArr3, 0, data.length);
Utilities.aesCbcEncryptionByteArraySafe(bArr3, bArr, bArr2, 0, length, 0, 0);
if (!Arrays.equals(Utilities.computeSHA256(bArr3), file_hash)) {
return null;
}
int i = bArr3[0] & 255;
return new String(bArr3, i, length - i);
}
public static boolean checkSecret(byte[] secret, Long id) {
if (secret == null || secret.length != 32) {
return false;
}
int i = 0;
for (byte b : secret) {
i += b & 255;
}
if (i % 255 != 239) {
return false;
}
return id == null || Utilities.bytesToLong(Utilities.computeSHA256(secret)) == id.longValue();
}
public final 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] & 255) + (239 - i3);
if (i4 < 255) {
i4 += 255;
}
bArr[nextInt] = (byte) (i4 % 255);
}
return bArr;
}
public final EncryptionResult encryptData(byte[] data) {
byte[] randomSecret = getRandomSecret();
int nextInt = Utilities.random.nextInt(208) + 32;
while ((data.length + nextInt) % 16 != 0) {
nextInt++;
}
byte[] bArr = new byte[nextInt];
Utilities.random.nextBytes(bArr);
bArr[0] = (byte) nextInt;
int length = nextInt + data.length;
byte[] bArr2 = new byte[length];
System.arraycopy(bArr, 0, bArr2, 0, nextInt);
System.arraycopy(data, 0, bArr2, nextInt, data.length);
byte[] computeSHA256 = Utilities.computeSHA256(bArr2);
byte[] computeSHA512 = Utilities.computeSHA512(randomSecret, computeSHA256);
byte[] bArr3 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr3, 0, 32);
byte[] bArr4 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr4, 0, 16);
Utilities.aesCbcEncryptionByteArraySafe(bArr2, bArr3, bArr4, 0, length, 0, 1);
byte[] bArr5 = new byte[32];
System.arraycopy(this.saltedPassword, 0, bArr5, 0, 32);
byte[] bArr6 = new byte[16];
System.arraycopy(this.saltedPassword, 32, bArr6, 0, 16);
byte[] bArr7 = new byte[32];
System.arraycopy(this.secureSecret, 0, bArr7, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr7, bArr5, bArr6, 0, 32, 0, 0);
byte[] computeSHA5122 = Utilities.computeSHA512(bArr7, computeSHA256);
byte[] bArr8 = new byte[32];
System.arraycopy(computeSHA5122, 0, bArr8, 0, 32);
byte[] bArr9 = new byte[16];
System.arraycopy(computeSHA5122, 32, bArr9, 0, 16);
byte[] bArr10 = new byte[32];
System.arraycopy(randomSecret, 0, bArr10, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr10, bArr8, bArr9, 0, 32, 0, 1);
return new EncryptionResult(bArr2, bArr10, randomSecret, computeSHA256, bArr3, bArr4);
}
public final void showAlertWithText(String title, String text) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setTitle(title);
builder.setMessage(text);
showDialog(builder.create());
}
public final void onPasscodeError(boolean clear) {
if (getParentActivity() == null) {
return;
}
Vibrator vibrator = (Vibrator) getParentActivity().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
if (clear) {
this.inputFields[0].setText("");
}
AndroidUtilities.shakeView(this.inputFields[0]);
}
public final void startPhoneVerification(boolean checkPermissions, final String phone, Runnable finishRunnable, ErrorRunnable errorRunnable, final PassportActivityDelegate delegate) {
boolean z;
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
boolean z2 = (telephonyManager.getSimState() == 1 || telephonyManager.getPhoneType() == 0) ? false : true;
if (getParentActivity() == null || Build.VERSION.SDK_INT < 23 || !z2) {
z = true;
} else {
z = getParentActivity().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
if (checkPermissions) {
this.permissionsItems.clear();
if (!z) {
this.permissionsItems.add("android.permission.READ_PHONE_STATE");
}
if (!this.permissionsItems.isEmpty()) {
if (getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE")) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setMessage(LocaleController.getString("AllowReadCall", R.string.AllowReadCall));
this.permissionsDialog = showDialog(builder.create());
} else {
getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
}
this.pendingPhone = phone;
this.pendingErrorRunnable = errorRunnable;
this.pendingFinishRunnable = finishRunnable;
this.pendingDelegate = delegate;
return;
}
}
}
final TLRPC.TL_account_sendVerifyPhoneCode tL_account_sendVerifyPhoneCode = new TLRPC.TL_account_sendVerifyPhoneCode();
tL_account_sendVerifyPhoneCode.phone_number = phone;
TLRPC.TL_codeSettings tL_codeSettings = new TLRPC.TL_codeSettings();
tL_account_sendVerifyPhoneCode.settings = tL_codeSettings;
tL_codeSettings.allow_flashcall = z2 && z;
tL_codeSettings.allow_app_hash = PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices();
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
if (tL_account_sendVerifyPhoneCode.settings.allow_app_hash) {
sharedPreferences.edit().putString("sms_hash", BuildVars.getSmsHash()).commit();
} else {
sharedPreferences.edit().remove("sms_hash").commit();
}
if (tL_account_sendVerifyPhoneCode.settings.allow_flashcall) {
try {
String line1Number = telephonyManager.getLine1Number();
if (!TextUtils.isEmpty(line1Number)) {
tL_account_sendVerifyPhoneCode.settings.current_number = PhoneNumberUtils.compare(phone, line1Number);
TLRPC.TL_codeSettings tL_codeSettings2 = tL_account_sendVerifyPhoneCode.settings;
if (!tL_codeSettings2.current_number) {
tL_codeSettings2.allow_flashcall = false;
}
} else {
TLRPC.TL_codeSettings tL_codeSettings3 = tL_account_sendVerifyPhoneCode.settings;
tL_codeSettings3.unknown_number = true;
tL_codeSettings3.current_number = false;
}
} catch (Exception e) {
tL_account_sendVerifyPhoneCode.settings.allow_flashcall = false;
FileLog.e(e);
}
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_sendVerifyPhoneCode, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.this.lambda$startPhoneVerification$66(phone, delegate, tL_account_sendVerifyPhoneCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$startPhoneVerification$66(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$startPhoneVerification$65(tL_error, str, passportActivityDelegate, tLObject, tL_account_sendVerifyPhoneCode);
}
});
}
public void lambda$startPhoneVerification$65(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<String, String>) hashMap, (HashMap<String, String>) null);
((BaseFragment) passportActivity).currentAccount = ((BaseFragment) 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(((BaseFragment) this).currentAccount, tL_error, this, tL_account_sendVerifyPhoneCode, new Object[]{str});
}
public final void updatePasswordInterface() {
ImageView imageView = this.noPasswordImageView;
if (imageView == null) {
return;
}
TLRPC.account_Password account_password = this.currentPassword;
if (account_password == null || this.usingSavedPassword != 0) {
imageView.setVisibility(8);
this.noPasswordTextView.setVisibility(8);
this.noPasswordSetTextView.setVisibility(8);
this.passwordAvatarContainer.setVisibility(8);
this.inputFieldContainers[0].setVisibility(8);
this.doneItem.setVisibility(8);
this.passwordForgotButton.setVisibility(8);
this.passwordInfoRequestTextView.setVisibility(8);
this.passwordRequestTextView.setVisibility(8);
this.emptyView.setVisibility(0);
return;
}
if (!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);
return;
}
this.passwordRequestTextView.setVisibility(0);
this.noPasswordImageView.setVisibility(8);
this.noPasswordTextView.setVisibility(8);
this.noPasswordSetTextView.setVisibility(8);
this.emptyView.setVisibility(8);
this.passwordAvatarContainer.setVisibility(0);
this.inputFieldContainers[0].setVisibility(0);
this.doneItem.setVisibility(0);
this.passwordForgotButton.setVisibility(0);
this.passwordInfoRequestTextView.setVisibility(0);
this.passwordRequestTextView.setLayoutParams(LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 0.0f));
if (this.inputFields != null) {
TLRPC.account_Password account_password2 = this.currentPassword;
if (account_password2 != null && !TextUtils.isEmpty(account_password2.hint)) {
this.inputFields[0].setHint(this.currentPassword.hint);
} else {
this.inputFields[0].setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
}
}
}
public final void showEditDoneProgress(final boolean animateDoneItem, final boolean show) {
AnimatorSet animatorSet = this.doneItemAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
if (animateDoneItem && this.doneItem != null) {
this.doneItemAnimation = new AnimatorSet();
if (show) {
this.progressView.setVisibility(0);
this.doneItem.setEnabled(false);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.ALPHA, 1.0f));
} else {
this.doneItem.getContentView().setVisibility(0);
this.doneItem.setEnabled(true);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressView, (Property<ContextProgressView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, 1.0f));
}
this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animation)) {
return;
}
if (!show) {
PassportActivity.this.progressView.setVisibility(4);
} else {
PassportActivity.this.doneItem.getContentView().setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animation)) {
return;
}
PassportActivity.this.doneItemAnimation = null;
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
return;
}
if (this.acceptTextView != null) {
this.doneItemAnimation = new AnimatorSet();
if (show) {
this.progressViewButton.setVisibility(0);
this.bottomLayout.setEnabled(false);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.ALPHA, 1.0f));
} else {
this.acceptTextView.setVisibility(0);
this.bottomLayout.setEnabled(true);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.progressViewButton, (Property<ContextProgressView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.acceptTextView, (Property<TextView, Float>) View.ALPHA, 1.0f));
}
this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animation)) {
return;
}
if (!show) {
PassportActivity.this.progressViewButton.setVisibility(4);
} else {
PassportActivity.this.acceptTextView.setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (PassportActivity.this.doneItemAnimation == null || !PassportActivity.this.doneItemAnimation.equals(animation)) {
return;
}
PassportActivity.this.doneItemAnimation = null;
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
}
}
public void didReceivedNotification(int id, int account, Object... args) {
SecureDocumentCell secureDocumentCell;
ActionBarMenuItem actionBarMenuItem;
if (id == NotificationCenter.fileUploaded) {
String str = (String) args[0];
SecureDocument secureDocument = this.uploadingDocuments.get(str);
if (secureDocument != null) {
secureDocument.inputFile = (TLRPC.TL_inputFile) args[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);
}
int i = secureDocument.type;
if (i == 0) {
if (this.bottomCell != null && !TextUtils.isEmpty(this.noAllDocumentsErrorText)) {
this.bottomCell.setText(this.noAllDocumentsErrorText);
}
this.errorsValues.remove("files_all");
return;
}
if (i == 4) {
if (this.bottomCellTranslation != null && !TextUtils.isEmpty(this.noAllTranslationErrorText)) {
this.bottomCellTranslation.setText(this.noAllTranslationErrorText);
}
this.errorsValues.remove("translation_all");
return;
}
return;
}
return;
}
if (id == NotificationCenter.fileUploadFailed) {
return;
}
if (id == NotificationCenter.twoStepPasswordChanged) {
if (args != null && args.length > 0) {
if (args[7] != null) {
EditText[] editTextArr = this.inputFields;
if (editTextArr[0] != null) {
editTextArr[0].setText((String) args[7]);
}
}
if (args[6] == null) {
TLRPC.TL_account_password tL_account_password = new TLRPC.TL_account_password();
this.currentPassword = tL_account_password;
((TLRPC.account_Password) tL_account_password).current_algo = (TLRPC.PasswordKdfAlgo) args[1];
((TLRPC.account_Password) tL_account_password).new_secure_algo = (TLRPC.SecurePasswordKdfAlgo) args[2];
((TLRPC.account_Password) tL_account_password).secure_random = (byte[]) args[3];
((TLRPC.account_Password) tL_account_password).has_recovery = !TextUtils.isEmpty((String) args[4]);
TLRPC.account_Password account_password = this.currentPassword;
account_password.hint = (String) args[5];
account_password.srp_id = -1L;
byte[] bArr = new byte[256];
account_password.srp_B = bArr;
Utilities.random.nextBytes(bArr);
EditText[] editTextArr2 = this.inputFields;
if (editTextArr2[0] != null && editTextArr2[0].length() > 0) {
this.usingSavedPassword = 2;
}
}
} else {
this.currentPassword = null;
loadPasswordInfo();
}
updatePasswordInterface();
return;
}
int i2 = NotificationCenter.didRemoveTwoStepPassword;
}
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
if (this.presentAfterAnimation != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.this.lambda$onTransitionAnimationEnd$67();
}
});
}
int i = this.currentActivityType;
if (i == 5) {
if (isOpen) {
if (this.inputFieldContainers[0].getVisibility() == 0) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
if (this.usingSavedPassword == 2) {
onPasswordDone(false);
return;
}
return;
}
return;
}
if (i == 7) {
if (isOpen) {
this.views[this.currentViewNum].onShow();
return;
}
return;
}
if (i == 4) {
if (isOpen) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
return;
}
return;
}
if (i == 6) {
if (isOpen) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
return;
}
return;
}
if ((i == 2 || i == 1) && Build.VERSION.SDK_INT >= 21) {
createChatAttachView();
}
}
public void lambda$onTransitionAnimationEnd$67() {
presentFragment(this.presentAfterAnimation, true);
this.presentAfterAnimation = null;
}
public final void showAttachmentError() {
if (getParentActivity() == null) {
return;
}
Toast.makeText(getParentActivity(), LocaleController.getString("UnsupportedAttachment", R.string.UnsupportedAttachment), 0).show();
}
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
if (resultCode == -1) {
if (requestCode == 0 || requestCode == 2) {
createChatAttachView();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onActivityResultFragment(requestCode, data, this.currentPicturePath);
}
this.currentPicturePath = null;
return;
}
if (requestCode == 1) {
if (data == null || data.getData() == null) {
showAttachmentError();
return;
}
ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList = new ArrayList<>();
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
sendingMediaInfo.uri = data.getData();
arrayList.add(sendingMediaInfo);
processSelectedFiles(arrayList);
}
}
}
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
ChatAttachAlert chatAttachAlert;
TextSettingsCell textSettingsCell;
int i = this.currentActivityType;
if ((i != 1 && i != 2) || (chatAttachAlert = this.chatAttachAlert) == null) {
if (i == 3 && requestCode == 6) {
startPhoneVerification(false, this.pendingPhone, this.pendingFinishRunnable, this.pendingErrorRunnable, this.pendingDelegate);
return;
}
return;
}
if (requestCode == 17) {
chatAttachAlert.getPhotoLayout().checkCamera(false);
return;
}
if (requestCode == 21) {
if (getParentActivity() == null || grantResults == null || grantResults.length == 0 || grantResults[0] == 0) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("PermissionNoAudioVideoWithHint", R.string.PermissionNoAudioVideoWithHint));
builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
PassportActivity.this.lambda$onRequestPermissionsResultFragment$68(dialogInterface, i2);
}
});
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.show();
return;
}
if (requestCode == 19 && grantResults != null && grantResults.length > 0 && grantResults[0] == 0) {
processSelectedAttach(0);
return;
}
if (requestCode != 22 || grantResults == null || grantResults.length <= 0 || grantResults[0] != 0 || (textSettingsCell = this.scanDocumentCell) == null) {
return;
}
textSettingsCell.callOnClick();
}
public void lambda$onRequestPermissionsResultFragment$68(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);
}
}
public void saveSelfArgs(Bundle args) {
String str = this.currentPicturePath;
if (str != null) {
args.putString("path", str);
}
}
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;
}
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 page, boolean animated, Bundle params) {
if (page == 3) {
this.doneItem.setVisibility(8);
}
SlideView[] slideViewArr = this.views;
final SlideView slideView = slideViewArr[this.currentViewNum];
final SlideView slideView2 = slideViewArr[page];
this.currentViewNum = page;
slideView2.setParams(params, false);
slideView2.onShow();
if (animated) {
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(this) {
@Override
public void onAnimationStart(Animator animation) {
slideView2.setVisibility(0);
}
@Override
public void onAnimationEnd(Animator animation) {
slideView.setVisibility(8);
slideView.setX(0.0f);
}
});
animatorSet.start();
return;
}
slideView2.setTranslationX(0.0f);
slideView2.setVisibility(0);
if (slideView != slideView2) {
slideView.setVisibility(8);
}
}
public final void fillNextCodeParams(Bundle params, TLRPC.TL_auth_sentCode res, boolean animated) {
params.putString("phoneHash", ((TLRPC.auth_SentCode) res).phone_code_hash);
TLRPC.auth_CodeType auth_codetype = ((TLRPC.auth_SentCode) res).next_type;
if (auth_codetype instanceof TLRPC.TL_auth_codeTypeCall) {
params.putInt("nextType", 4);
} else if (auth_codetype instanceof TLRPC.TL_auth_codeTypeFlashCall) {
params.putInt("nextType", 3);
} else if (auth_codetype instanceof TLRPC.TL_auth_codeTypeSms) {
params.putInt("nextType", 2);
}
if (((TLRPC.auth_SentCode) res).timeout == 0) {
((TLRPC.auth_SentCode) res).timeout = 60;
}
params.putInt("timeout", ((TLRPC.auth_SentCode) res).timeout * 1000);
TLRPC.auth_SentCodeType auth_sentcodetype = ((TLRPC.auth_SentCode) res).type;
if (auth_sentcodetype instanceof TLRPC.TL_auth_sentCodeTypeCall) {
params.putInt("type", 4);
params.putInt("length", ((TLRPC.auth_SentCode) res).type.length);
setPage(2, animated, params);
} else if (auth_sentcodetype instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
params.putInt("type", 3);
params.putString("pattern", ((TLRPC.auth_SentCode) res).type.pattern);
setPage(1, animated, params);
} else if (auth_sentcodetype instanceof TLRPC.TL_auth_sentCodeTypeSms) {
params.putInt("type", 2);
params.putInt("length", ((TLRPC.auth_SentCode) res).type.length);
setPage(0, animated, params);
}
}
public final 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, new Object[]{LocaleController.formatPluralString("Files", 20, new Object[0])}));
return;
}
createChatAttachView();
this.chatAttachAlert.setOpenWithFrontFaceCamera(this.uploadingFileType == 1);
this.chatAttachAlert.setMaxSelectedPhotos(getMaxSelectedDocuments(), false);
this.chatAttachAlert.getPhotoLayout().loadGalleryPhotos();
int i = Build.VERSION.SDK_INT;
if (i == 21 || i == 22) {
AndroidUtilities.hideKeyboard(((BaseFragment) this).fragmentView.findFocus());
}
this.chatAttachAlert.init();
showDialog(this.chatAttachAlert);
}
public final void createChatAttachView() {
if (getParentActivity() != null && this.chatAttachAlert == null) {
ChatAttachAlert chatAttachAlert = new ChatAttachAlert(getParentActivity(), this, false, false);
this.chatAttachAlert = chatAttachAlert;
chatAttachAlert.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() {
public void didSelectBot(TLRPC.User user) {
ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$didSelectBot(this, user);
}
public void doOnIdle(Runnable runnable) {
ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$doOnIdle(this, runnable);
}
public boolean needEnterComment() {
return ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$needEnterComment(this);
}
public void onWallpaperSelected(Object obj) {
ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$onWallpaperSelected(this, obj);
}
public void openAvatarsSearch() {
ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$openAvatarsSearch(this);
}
public boolean selectItemOnClicking() {
return ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$selectItemOnClicking(this);
}
public void sendAudio(ArrayList arrayList, CharSequence charSequence, boolean z, int i, long j, boolean z2) {
ChatAttachAlert.ChatAttachViewDelegate.-CC.$default$sendAudio(this, arrayList, charSequence, z, i, j, z2);
}
public void didPressedButton(int button, boolean arg, boolean notify, int scheduleDate, long effectId, boolean invertMedia, boolean forceDocument) {
if (PassportActivity.this.getParentActivity() == null || PassportActivity.this.chatAttachAlert == null) {
return;
}
if (button == 8 || button == 7) {
if (button != 8) {
PassportActivity.this.chatAttachAlert.dismiss(true);
}
HashMap selectedPhotos = PassportActivity.this.chatAttachAlert.getPhotoLayout().getSelectedPhotos();
ArrayList selectedPhotosOrder = PassportActivity.this.chatAttachAlert.getPhotoLayout().getSelectedPhotosOrder();
if (selectedPhotos.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList();
for (int i = 0; i < selectedPhotosOrder.size(); i++) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) selectedPhotos.get(selectedPhotosOrder.get(i));
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
String str = ((MediaController.MediaEditState) photoEntry).imagePath;
if (str != null) {
sendingMediaInfo.path = str;
} else {
sendingMediaInfo.path = photoEntry.path;
}
arrayList.add(sendingMediaInfo);
photoEntry.reset();
}
PassportActivity.this.processSelectedFiles(arrayList);
return;
}
if (PassportActivity.this.chatAttachAlert != null) {
PassportActivity.this.chatAttachAlert.dismissWithButtonClick(button);
}
PassportActivity.this.processSelectedAttach(button);
}
public void onCameraOpened() {
AndroidUtilities.hideKeyboard(((BaseFragment) PassportActivity.this).fragmentView.findFocus());
}
});
}
}
public final int getMaxSelectedDocuments() {
int size;
int i = this.uploadingFileType;
if (i == 0) {
size = this.documents.size();
} else {
if (i != 4) {
return 1;
}
size = this.translationDocuments.size();
}
return 20 - size;
}
public final void processSelectedAttach(int which) {
if (which == 0) {
int i = Build.VERSION.SDK_INT;
if (i >= 23 && getParentActivity().checkSelfPermission("android.permission.CAMERA") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.CAMERA"}, 19);
return;
}
try {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File generatePicturePath = AndroidUtilities.generatePicturePath();
if (generatePicturePath != null) {
if (i >= 24) {
intent.putExtra("output", FileProvider.getUriForFile(getParentActivity(), ApplicationLoader.getApplicationId() + ".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);
}
}
}
public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> photos, boolean notify, int scheduleDate) {
processSelectedFiles(photos);
}
public void startDocumentSelectActivity() {
try {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
if (Build.VERSION.SDK_INT >= 18) {
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
}
intent.setType("*/*");
startActivityForResult(intent, 21);
} catch (Exception e) {
FileLog.e(e);
}
}
public void didSelectFiles(ArrayList<String> files, String caption, boolean notify, int scheduleDate, long effectId, boolean invertMedia) {
ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList = new ArrayList<>();
int size = files.size();
for (int i = 0; i < size; i++) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
sendingMediaInfo.path = files.get(i);
arrayList.add(sendingMediaInfo);
}
processSelectedFiles(arrayList);
}
public final void fillInitialValues() {
if (this.initialValues != null) {
return;
}
this.initialValues = getCurrentValues();
}
public final String getCurrentValues() {
StringBuilder sb = new StringBuilder();
int i = 0;
while (true) {
EditText[] editTextArr = this.inputFields;
if (i >= editTextArr.length) {
break;
}
sb.append((CharSequence) editTextArr[i].getText());
sb.append(",");
i++;
}
if (this.inputExtraFields != null) {
int i2 = 0;
while (true) {
EditText[] editTextArr2 = this.inputExtraFields;
if (i2 >= editTextArr2.length) {
break;
}
sb.append((CharSequence) editTextArr2[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 final boolean isHasNotAnyChanges() {
String str = this.initialValues;
return str == null || str.equals(getCurrentValues());
}
public final 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$69(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$69(DialogInterface dialogInterface, int i) {
finishFragment();
}
public final void processSelectedFiles(final ArrayList<SendMessagesHelper.SendingMediaInfo> photos) {
if (photos.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) {
EditText[] editTextArr = this.inputFields;
if (i2 < editTextArr.length) {
if (i2 != 5 && i2 != 8 && i2 != 4 && i2 != 6 && editTextArr[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$72(photos, i3, z2);
}
});
}
public void lambda$processSelectedFiles$72(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 = r9.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$processSelectedFiles$70(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$processSelectedFiles$71(recognize);
}
});
z2 = true;
} catch (Throwable th) {
th = th;
z2 = true;
FileLog.e(th);
}
}
} catch (Throwable th2) {
th = th2;
}
}
}
}
SharedConfig.saveConfig();
}
public void lambda$processSelectedFiles$70(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(((BaseFragment) this).currentAccount).uploadFile(secureDocument.path, false, true, 16777216);
addDocumentView(secureDocument, i);
updateUploadText(i);
}
public void lambda$processSelectedFiles$71(MrzRecognizer.Result result) {
int i;
int i2;
int i3 = result.type;
if (i3 == 2) {
if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard)) {
int size = this.availableDocumentTypes.size();
int i4 = 0;
while (true) {
if (i4 >= size) {
break;
}
TLRPC.TL_secureRequiredType tL_secureRequiredType = this.availableDocumentTypes.get(i4);
if (tL_secureRequiredType.type instanceof TLRPC.TL_secureValueTypeIdentityCard) {
this.currentDocumentsType = tL_secureRequiredType;
updateInterfaceStringsForDocumentType();
break;
}
i4++;
}
}
} else if (i3 == 1) {
if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypePassport)) {
int size2 = this.availableDocumentTypes.size();
int i5 = 0;
while (true) {
if (i5 >= size2) {
break;
}
TLRPC.TL_secureRequiredType tL_secureRequiredType2 = this.availableDocumentTypes.get(i5);
if (tL_secureRequiredType2.type instanceof TLRPC.TL_secureValueTypePassport) {
this.currentDocumentsType = tL_secureRequiredType2;
updateInterfaceStringsForDocumentType();
break;
}
i5++;
}
}
} else if (i3 == 3) {
if (!(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeInternalPassport)) {
int size3 = this.availableDocumentTypes.size();
int i6 = 0;
while (true) {
if (i6 >= size3) {
break;
}
TLRPC.TL_secureRequiredType tL_secureRequiredType3 = this.availableDocumentTypes.get(i6);
if (tL_secureRequiredType3.type instanceof TLRPC.TL_secureValueTypeInternalPassport) {
this.currentDocumentsType = tL_secureRequiredType3;
updateInterfaceStringsForDocumentType();
break;
}
i6++;
}
}
} else if (i3 == 4 && !(this.currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense)) {
int size4 = this.availableDocumentTypes.size();
int i7 = 0;
while (true) {
if (i7 >= size4) {
break;
}
TLRPC.TL_secureRequiredType tL_secureRequiredType4 = this.availableDocumentTypes.get(i7);
if (tL_secureRequiredType4.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
this.currentDocumentsType = tL_secureRequiredType4;
updateInterfaceStringsForDocumentType();
break;
}
i7++;
}
}
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);
}
int i8 = result.gender;
if (i8 != 0) {
if (i8 == 1) {
this.currentGender = "male";
this.inputFields[4].setText(LocaleController.getString("PassportMale", R.string.PassportMale));
} else if (i8 == 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);
}
}
int i9 = result.birthDay;
if (i9 > 0 && result.birthMonth > 0 && result.birthYear > 0) {
this.inputFields[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i9), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
}
int i10 = result.expiryDay;
if (i10 > 0 && (i = result.expiryMonth) > 0 && (i2 = result.expiryYear) > 0) {
int[] iArr = this.currentExpireDate;
iArr[0] = i2;
iArr[1] = i;
iArr[2] = i10;
this.inputFields[8].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i10), Integer.valueOf(result.expiryMonth), Integer.valueOf(result.expiryYear)));
return;
}
int[] iArr2 = this.currentExpireDate;
iArr2[2] = 0;
iArr2[1] = 0;
iArr2[0] = 0;
this.inputFields[8].setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
}
public void setNeedActivityResult(boolean needActivityResult) {
this.needActivityResult = needActivityResult;
}
public static class ProgressView extends View {
public Paint paint;
public Paint paint2;
public 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 value) {
this.progress = value;
invalidate();
}
@Override
public 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 {
public ImageView blackImageView;
public ImageView blueImageView;
public EditTextBoldCursor[] codeField;
public LinearLayout codeFieldContainer;
public int codeTime;
public Timer codeTimer;
public TextView confirmTextView;
public boolean ignoreOnTextChange;
public double lastCodeTime;
public double lastCurrentTime;
public String lastError;
public int length;
public boolean nextPressed;
public int nextType;
public String pattern;
public String phone;
public String phoneHash;
public TextView problemText;
public ProgressView progressView;
public int time;
public TextView timeText;
public Timer timeTimer;
public int timeout;
public final Object timerSync;
public TextView titleTextView;
public int verificationType;
public boolean waitingForEvent;
public static void lambda$onBackPressed$9(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public boolean needBackButton() {
return true;
}
public PhoneConfirmationView(Context context, final int type) {
super(context);
this.timerSync = new Object();
this.time = 60000;
this.codeTime = 15000;
this.lastError = "";
this.pattern = "*";
this.verificationType = type;
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
int i = Theme.key_windowBackgroundWhiteGrayText6;
textView.setTextColor(Theme.getColor(i));
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.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.titleTextView.setTextSize(1, 18.0f);
this.titleTextView.setTypeface(AndroidUtilities.bold());
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);
boolean z = LocaleController.isRTL;
if (z) {
frameLayout.addView(imageView, LayoutHelper.createFrame(64, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f));
} else {
frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1, -2.0f, z ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
frameLayout.addView(imageView, LayoutHelper.createFrame(64, 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.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.blackImageView, LayoutHelper.createFrame(-2, -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, -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, -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(this, context, PassportActivity.this) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.timeText = textView3;
textView3.setTextColor(Theme.getColor(i));
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(this, context, PassportActivity.this) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, 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(view);
}
});
}
public void lambda$new$0(View view) {
if (this.nextPressed) {
return;
}
int i = this.nextType;
if (!((i == 4 && this.verificationType == 2) || i == 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.SENDTO");
intent.setData(Uri.parse("mailto:"));
intent.putExtra("android.intent.extra.EMAIL", new String[]{"[email protected]"});
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));
}
}
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ImageView imageView;
super/*android.widget.LinearLayout*/.onMeasure(widthMeasureSpec, heightMeasureSpec);
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) {
setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
} else {
setMeasuredDimension(getMeasuredWidth(), Math.min(PassportActivity.this.scrollHeight, dp2));
}
}
public void onLayout(boolean changed, int l, int t, int r, int b) {
int i;
super/*android.widget.LinearLayout*/.onLayout(changed, l, t, r, b);
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();
i = (measuredHeight + bottom) - measuredHeight2;
TextView textView = this.problemText;
textView.layout(textView.getLeft(), i, this.problemText.getRight(), measuredHeight2 + i);
} else if (this.timeText.getVisibility() == 0) {
int measuredHeight3 = this.timeText.getMeasuredHeight();
i = (measuredHeight + bottom) - measuredHeight3;
TextView textView2 = this.timeText;
textView2.layout(textView2.getLeft(), i, this.timeText.getRight(), measuredHeight3 + i);
} else {
i = measuredHeight + bottom;
}
int measuredHeight4 = this.codeFieldContainer.getMeasuredHeight();
int i2 = (((i - bottom) - measuredHeight4) / 2) + bottom;
LinearLayout linearLayout = this.codeFieldContainer;
linearLayout.layout(linearLayout.getLeft(), i2, this.codeFieldContainer.getRight(), measuredHeight4 + i2);
}
public final 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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.this.lambda$resendCode$3(bundle, tL_auth_resendCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$resendCode$3(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$resendCode$2(tL_error, bundle, tLObject, tL_auth_resendCode);
}
});
}
public void lambda$resendCode$2(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_auth_resendCode tL_auth_resendCode) {
this.nextPressed = false;
if (tL_error != null) {
AlertDialog alertDialog = (AlertDialog) AlertsCreator.processError(((BaseFragment) 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$resendCode$1(dialogInterface, i);
}
});
}
} else {
PassportActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject, true);
}
PassportActivity.this.needHideProgress();
}
public void lambda$resendCode$1(DialogInterface dialogInterface, int i) {
onBackPressed(true);
PassportActivity.this.finishFragment();
}
public void onCancelPressed() {
this.nextPressed = false;
}
public void setParams(Bundle params, boolean restore) {
int i;
int i2;
if (params == 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.phone = params.getString("phone");
this.phoneHash = params.getString("phoneHash");
int i4 = params.getInt("timeout");
this.time = i4;
this.timeout = i4;
this.nextType = params.getInt("nextType");
this.pattern = params.getString("pattern");
int i5 = params.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) {
EditText[] editTextArr = this.codeField;
if (i6 >= editTextArr.length) {
break;
}
editTextArr[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.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[i7].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : 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.bold());
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 s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
int length;
if (!PhoneConfirmationView.this.ignoreOnTextChange && (length = s.length()) >= 1) {
if (length > 1) {
String obj = s.toString();
PhoneConfirmationView.this.ignoreOnTextChange = true;
for (int i8 = 0; i8 < Math.min(PhoneConfirmationView.this.length - i7, length); i8++) {
if (i8 == 0) {
s.replace(0, length, obj.substring(i8, i8 + 1));
} else {
PhoneConfirmationView.this.codeField[i7 + i8].setText(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(null);
}
}
}
});
this.codeField[i7].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i8, KeyEvent keyEvent) {
boolean lambda$setParams$4;
lambda$setParams$4 = PassportActivity.PhoneConfirmationView.this.lambda$setParams$4(i7, view, i8, keyEvent);
return lambda$setParams$4;
}
});
this.codeField[i7].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i8, KeyEvent keyEvent) {
boolean lambda$setParams$5;
lambda$setParams$5 = PassportActivity.PhoneConfirmationView.this.lambda$setParams$5(textView, i8, keyEvent);
return lambda$setParams$5;
}
});
i7++;
}
}
ProgressView progressView = this.progressView;
if (progressView != null) {
progressView.setVisibility(this.nextType != 0 ? 0 : 8);
}
if (this.phone == null) {
return;
}
String format = PhoneFormat.getInstance().format("+" + this.phone);
int i8 = this.verificationType;
if (i8 == 2) {
charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, new Object[]{LocaleController.addNbsp(format)}));
} else if (i8 == 3) {
charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, new Object[]{LocaleController.addNbsp(format)}));
} else if (i8 == 4) {
charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, new Object[]{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();
int i9 = this.verificationType;
if (i9 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
this.problemText.setVisibility(8);
this.timeText.setVisibility(0);
int i10 = this.nextType;
if (i10 == 4) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, new Object[]{1, 0}));
} else if (i10 == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, new Object[]{1, 0}));
}
createTimer();
return;
}
if (i9 == 2 && ((i = this.nextType) == 4 || i == 3)) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, new Object[]{2, 0}));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time >= 1000 ? 0 : 8);
createTimer();
return;
}
if (i9 == 4 && this.nextType == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, new Object[]{2, 0}));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time >= 1000 ? 0 : 8);
createTimer();
return;
}
this.timeText.setVisibility(8);
this.problemText.setVisibility(8);
createCodeTimer();
}
public boolean lambda$setParams$4(int i, View view, int i2, KeyEvent keyEvent) {
if (i2 != 67 || this.codeField[i].length() != 0 || i <= 0) {
return false;
}
EditText[] editTextArr = this.codeField;
int i3 = i - 1;
editTextArr[i3].setSelection(editTextArr[i3].length());
this.codeField[i3].requestFocus();
this.codeField[i3].dispatchKeyEvent(keyEvent);
return true;
}
public boolean lambda$setParams$5(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
onNextPressed(null);
return true;
}
public final 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 {
public AnonymousClass4() {
}
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.AnonymousClass4.this.lambda$run$0();
}
});
}
public void lambda$run$0() {
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 final void destroyCodeTimer() {
try {
synchronized (this.timerSync) {
Timer timer = this.codeTimer;
if (timer != null) {
timer.cancel();
this.codeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public final void createTimer() {
if (this.timeTimer != null) {
return;
}
Timer timer = new Timer();
this.timeTimer = timer;
timer.schedule(new AnonymousClass5(), 0L, 1000L);
}
public class AnonymousClass5 extends TimerTask {
public AnonymousClass5() {
}
@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 Runnable() {
@Override
public final void run() {
PassportActivity.PhoneConfirmationView.AnonymousClass5.this.lambda$run$2();
}
});
}
public void lambda$run$2() {
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, new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}));
} else if (PhoneConfirmationView.this.nextType == 2) {
PhoneConfirmationView.this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, new Object[]{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) {
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(PhoneConfirmationView.this, NotificationCenter.didReceiveCall);
PhoneConfirmationView.this.waitingForEvent = false;
PhoneConfirmationView.this.destroyCodeTimer();
PhoneConfirmationView.this.resendCode();
return;
}
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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.AnonymousClass5.this.lambda$run$1(tLObject, tL_error);
}
}, 2);
return;
}
if (PhoneConfirmationView.this.nextType == 3) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(PhoneConfirmationView.this, NotificationCenter.didReceiveSmsCode);
PhoneConfirmationView.this.waitingForEvent = false;
PhoneConfirmationView.this.destroyCodeTimer();
PhoneConfirmationView.this.resendCode();
}
}
}
public void lambda$run$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.this.lambda$run$0(tL_error);
}
});
}
public void lambda$run$0(TLRPC.TL_error tL_error) {
PhoneConfirmationView.this.lastError = tL_error.text;
}
}
public final void destroyTimer() {
try {
synchronized (this.timerSync) {
Timer timer = this.timeTimer;
if (timer != null) {
timer.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) {
EditText[] editTextArr = this.codeField;
if (i < editTextArr.length) {
sb.append(PhoneFormat.stripExceptNumbers(editTextArr[i].getText().toString()));
i++;
} else {
return sb.toString();
}
}
}
public void onNextPressed(String code) {
if (this.nextPressed) {
return;
}
if (code == null) {
code = getCode();
}
if (TextUtils.isEmpty(code)) {
AndroidUtilities.shakeView(this.codeFieldContainer);
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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_account_verifyPhone, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.this.lambda$onNextPressed$7(tL_account_verifyPhone, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$7(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$onNextPressed$6(tL_error, tL_account_verifyPhone);
}
});
}
public void lambda$onNextPressed$6(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;
int i3 = this.verificationType;
if ((i3 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((i3 == 2 && ((i = this.nextType) == 4 || i == 3)) || (i3 == 4 && this.nextType == 2))) {
createTimer();
}
int i4 = this.verificationType;
if (i4 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = true;
if (this.verificationType != 3) {
AlertsCreator.processError(((BaseFragment) 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 i5 = 0;
while (true) {
EditText[] editTextArr = this.codeField;
if (i5 < editTextArr.length) {
editTextArr[i5].setText("");
i5++;
} else {
editTextArr[0].requestFocus();
return;
}
}
}
public boolean onBackPressed(boolean force) {
if (!force) {
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(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(((BaseFragment) PassportActivity.this).currentAccount).sendRequest(tL_auth_cancelCode, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PassportActivity.PhoneConfirmationView.lambda$onBackPressed$9(tLObject, tL_error);
}
}, 2);
destroyTimer();
destroyCodeTimer();
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(DialogInterface dialogInterface, int i) {
onBackPressed(true);
PassportActivity.this.setPage(0, true, null);
}
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();
}
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();
EditText[] editTextArr = this.codeField;
editTextArr[length].setSelection(editTextArr[length].length());
AndroidUtilities.showKeyboard(this.codeField[length]);
return;
}
}
}
public void didReceivedNotification(int id, int account, Object... args) {
EditText[] editTextArr;
if (!this.waitingForEvent || (editTextArr = this.codeField) == null) {
return;
}
if (id == NotificationCenter.didReceiveSmsCode) {
editTextArr[0].setText("" + args[0]);
onNextPressed(null);
return;
}
if (id == NotificationCenter.didReceiveCall) {
String str = "" + args[0];
if (AndroidUtilities.checkPhonePattern(this.pattern, str)) {
this.ignoreOnTextChange = true;
this.codeField[0].setText(str);
this.ignoreOnTextChange = false;
onNextPressed(null);
}
}
}
}
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(((BaseFragment) this).fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray));
ActionBar actionBar = ((BaseFragment) this).actionBar;
int i = ThemeDescription.FLAG_BACKGROUND;
int i2 = Theme.key_actionBarDefault;
arrayList.add(new ThemeDescription(actionBar, i, null, null, null, null, i2));
arrayList.add(new ThemeDescription(this.scrollView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, i2));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
arrayList.add(new ThemeDescription(((BaseFragment) 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));
View view = this.extraBackgroundView;
int i3 = ThemeDescription.FLAG_BACKGROUND;
int i4 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(view, i3, null, null, null, null, i4));
if (this.extraBackgroundView2 != null) {
arrayList.add(new ThemeDescription(this.extraBackgroundView2, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, i4));
}
for (int i5 = 0; i5 < this.dividers.size(); i5++) {
arrayList.add(new ThemeDescription(this.dividers.get(i5), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_divider));
}
Iterator<Map.Entry<SecureDocument, SecureDocumentCell>> it = this.documentsCells.entrySet().iterator();
while (it.hasNext()) {
SecureDocumentCell value = it.next().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));
}
int i6 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSettingsCell.class}, null, null, null, i6));
int i7 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
int i8 = Theme.key_windowBackgroundWhiteGrayText2;
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i8));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextSettingsCell.class}, null, null, null, i6));
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteValueText));
int i9 = Theme.key_windowBackgroundGrayShadow;
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, i9));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_SELECTORWHITE, new Class[]{TextDetailSecureCell.class}, null, null, null, i6));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextDetailSecureCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
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, i8));
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, i6));
int i10 = Theme.key_windowBackgroundWhiteBlueHeader;
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, i9));
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 i11 = 0; i11 < this.inputFields.length; i11++) {
arrayList.add(new ThemeDescription((View) this.inputFields[i11].getParent(), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(this.inputFields[i11], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_text_RedRegular));
}
} else {
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, i7));
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, i10));
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_text_RedRegular));
}
if (this.inputExtraFields != null) {
for (int i12 = 0; i12 < this.inputExtraFields.length; i12++) {
arrayList.add(new ThemeDescription((View) this.inputExtraFields[i12].getParent(), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CURSORCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(this.inputExtraFields[i12], ThemeDescription.FLAG_PROGRESSBAR | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_text_RedRegular));
}
}
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));
TextView textView = this.passwordForgotButton;
int i13 = ThemeDescription.FLAG_TEXTCOLOR;
int i14 = Theme.key_windowBackgroundWhiteBlueText4;
arrayList.add(new ThemeDescription(textView, i13, null, null, null, null, i14));
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_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_passport_authorizeBackgroundSelected));
ContextProgressView contextProgressView = this.progressView;
int i15 = Theme.key_contextProgressInner2;
arrayList.add(new ThemeDescription(contextProgressView, 0, null, null, null, null, i15));
ContextProgressView contextProgressView2 = this.progressView;
int i16 = Theme.key_contextProgressOuter2;
arrayList.add(new ThemeDescription(contextProgressView2, 0, null, null, null, null, i16));
arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, i15));
arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, i16));
arrayList.add(new ThemeDescription(this.emptyImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_sessions_devicesImage));
TextView textView2 = this.emptyTextView1;
int i17 = ThemeDescription.FLAG_TEXTCOLOR;
int i18 = Theme.key_windowBackgroundWhiteGrayText2;
arrayList.add(new ThemeDescription(textView2, i17, null, null, null, null, i18));
arrayList.add(new ThemeDescription(this.emptyTextView2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, i18));
arrayList.add(new ThemeDescription(this.emptyTextView3, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, i14));
return arrayList;
}
}