正在查看: Plus 12 v10.13.1.1 应用的 PaymentFormActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 PaymentFormActivity.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.Activity;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.JavascriptInterface;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebView;
import android.webkit.WebViewClient;
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.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.FloatValueHolder;
import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
import androidx.fragment.app.FragmentActivity;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.wallet.AutoResolveHelper;
import com.google.android.gms.wallet.IsReadyToPayRequest;
import com.google.android.gms.wallet.PaymentData;
import com.google.android.gms.wallet.PaymentDataRequest;
import com.google.android.gms.wallet.PaymentsClient;
import com.google.android.gms.wallet.Wallet;
import com.stripe.android.Stripe;
import com.stripe.android.TokenCallback;
import com.stripe.android.exception.APIConnectionException;
import com.stripe.android.exception.APIException;
import com.stripe.android.model.Card;
import com.stripe.android.model.Token;
import com.stripe.android.net.TokenParser;
import j$.util.Optional;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Scanner;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SRPHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
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.BaseFragment$BottomSheetParams;
import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.INavigationLayout;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.EditTextSettingsCell;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.PaymentInfoCell;
import org.telegram.ui.Cells.RadioCell;
import org.telegram.ui.Cells.RecurrentPaymentsAcceptCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextDetailSettingsCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextPriceCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ContextProgressView;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.UndoView;
import org.telegram.ui.CountrySelectActivity;
import org.telegram.ui.PaymentFormActivity;
import org.telegram.ui.Stars.StarsIntroActivity;
public class PaymentFormActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
public TLRPC.User botUser;
public TextInfoPrivacyCell[] bottomCell;
public BottomFrameLayout bottomLayout;
public boolean canceled;
public String cardName;
public TextCheckCell checkCell1;
public EditTextSettingsCell codeFieldCell;
public HashMap<String, String> codesMap;
public ArrayList<String> countriesArray;
public HashMap<String, String> countriesMap;
public CountrySelectActivity.Country country;
public String countryName;
public String currentBotName;
public String currentItemName;
public TLRPC.account_Password currentPassword;
public int currentStep;
public PaymentFormActivityDelegate delegate;
public TextDetailSettingsCell[] detailSettingsCell;
public ArrayList<View> dividers;
public ActionBarMenuItem doneItem;
public AnimatorSet doneItemAnimation;
public boolean donePressed;
public int emailCodeLength;
public FrameLayout googlePayButton;
public FrameLayout googlePayContainer;
public String googlePayCountryCode;
public TLRPC.TL_inputPaymentCredentialsGooglePay googlePayCredentials;
public JSONObject googlePayParameters;
public String googlePayPublicKey;
public HeaderCell[] headerCell;
public boolean ignoreOnCardChange;
public boolean ignoreOnPhoneChange;
public boolean ignoreOnTextChange;
public boolean initGooglePay;
public EditTextBoldCursor[] inputFields;
public TLRPC.InputInvoice invoiceInput;
public String invoiceSlug;
public InvoiceStatus invoiceStatus;
public boolean isCheckoutPreview;
public boolean isWebView;
public LinearLayout linearLayout2;
public boolean loadingPasswordInfo;
public MessageObject messageObject;
public boolean needPayAfterTransition;
public boolean need_card_country;
public boolean need_card_name;
public boolean need_card_postcode;
public BaseFragment parentFragment;
public PaymentFormActivity passwordFragment;
public boolean passwordOk;
public TextView payTextView;
public TLRPC.PaymentForm paymentForm;
public PaymentFormCallback paymentFormCallback;
public TLRPC.TL_paymentFormMethod paymentFormMethod;
public PaymentInfoCell paymentInfoCell;
public String paymentJson;
public TLRPC.PaymentReceipt paymentReceipt;
public boolean paymentStatusSent;
public PaymentsClient paymentsClient;
public HashMap<String, String> phoneFormatMap;
public ArrayList<TLRPC.TL_labeledPrice> prices;
public ContextProgressView progressView;
public ContextProgressView progressViewButton;
public String providerApiKey;
public RadioCell[] radioCells;
public RecurrentPaymentsAcceptCell recurrentAcceptCell;
public boolean recurrentAccepted;
public TLRPC.TL_payments_validatedRequestedInfo requestedInfo;
public Theme.ResourcesProvider resourcesProvider;
public boolean saveCardInfo;
public boolean saveShippingInfo;
public TLRPC.TL_paymentSavedCredentialsCard savedCredentialsCard;
public ScrollView scrollView;
public ShadowSectionCell[] sectionCell;
public TextSettingsCell[] settingsCell;
public float shiftDp;
public TLRPC.TL_shippingOption shippingOption;
public Runnable shortPollRunnable;
public boolean shouldNavigateBack;
public boolean swipeBackEnabled;
public TextView textView;
public Long tipAmount;
public LinearLayout tipLayout;
public TextPriceCell totalCell;
public String[] totalPrice;
public TLRPC.TL_payments_validateRequestedInfo validateRequest;
public boolean waitingForEmail;
public WebView webView;
public String webViewUrl;
public boolean webviewLoading;
public static final List<String> WEBVIEW_PROTOCOLS = Arrays.asList("http", "https");
public static final List<String> BLACKLISTED_PROTOCOLS = Collections.singletonList("tg");
public enum InvoiceStatus {
PAID,
CANCELLED,
PENDING,
FAILED
}
public interface PaymentFormActivityDelegate {
public final class CC {
public static void $default$currentPasswordUpdated(PaymentFormActivityDelegate paymentFormActivityDelegate, TLRPC.account_Password account_password) {
}
public static void $default$didSelectNewAddress(PaymentFormActivityDelegate paymentFormActivityDelegate, TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo) {
}
public static boolean $default$didSelectNewCard(PaymentFormActivityDelegate paymentFormActivityDelegate, String str, String str2, boolean z, TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay, TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard) {
return false;
}
public static void $default$onFragmentDestroyed(PaymentFormActivityDelegate paymentFormActivityDelegate) {
}
}
void currentPasswordUpdated(TLRPC.account_Password password);
void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo validateRequested);
boolean didSelectNewCard(String tokenJson, String card, boolean saveCard, TLRPC.TL_inputPaymentCredentialsGooglePay googlePay, TLRPC.TL_paymentSavedCredentialsCard credentialsCard);
void onFragmentDestroyed();
}
public interface PaymentFormCallback {
void onInvoiceStatusChanged(InvoiceStatus status);
}
public static boolean lambda$createView$10(View view, MotionEvent motionEvent) {
return true;
}
public static void lambda$createView$26(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$sendForm$52(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public class TelegramWebviewProxy {
public TelegramWebviewProxy() {
}
@JavascriptInterface
public void postEvent(final String eventName, final String eventData) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.TelegramWebviewProxy.this.lambda$postEvent$0(eventName, eventData);
}
});
}
public void lambda$postEvent$0(String str, String str2) {
if (PaymentFormActivity.this.getParentActivity() != null && str.equals("payment_form_submit")) {
try {
JSONObject jSONObject = new JSONObject(str2);
JSONObject jSONObject2 = jSONObject.getJSONObject("credentials");
PaymentFormActivity.this.paymentJson = jSONObject2.toString();
PaymentFormActivity.this.cardName = jSONObject.getString("title");
} catch (Throwable th) {
PaymentFormActivity.this.paymentJson = str2;
FileLog.e(th);
}
PaymentFormActivity.this.goToNextStep();
}
}
}
public class LinkSpan extends ClickableSpan {
public LinkSpan() {
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
@Override
public void onClick(View widget) {
PaymentFormActivity paymentFormActivity = PaymentFormActivity.this;
paymentFormActivity.presentFragment(new TwoStepVerificationSetupActivity(6, paymentFormActivity.currentPassword));
}
}
public PaymentFormActivity(TLRPC.PaymentReceipt receipt) {
this.countriesArray = new ArrayList<>();
this.countriesMap = new HashMap<>();
this.codesMap = new HashMap<>();
this.phoneFormatMap = new HashMap<>();
this.swipeBackEnabled = true;
this.headerCell = new HeaderCell[3];
this.dividers = new ArrayList<>();
this.sectionCell = new ShadowSectionCell[3];
this.bottomCell = new TextInfoPrivacyCell[3];
this.settingsCell = new TextSettingsCell[2];
this.detailSettingsCell = new TextDetailSettingsCell[7];
this.shiftDp = -4.5f;
this.emailCodeLength = 6;
this.currentStep = 5;
TLRPC.PaymentForm paymentForm = new TLRPC.PaymentForm();
this.paymentForm = paymentForm;
this.paymentReceipt = receipt;
paymentForm.bot_id = receipt.bot_id;
paymentForm.invoice = receipt.invoice;
paymentForm.provider_id = receipt.provider_id;
paymentForm.users = receipt.users;
this.shippingOption = receipt.shipping;
long j = receipt.tip_amount;
if (j != 0) {
this.tipAmount = Long.valueOf(j);
}
TLRPC.User user = getMessagesController().getUser(Long.valueOf(receipt.bot_id));
this.botUser = user;
if (user != null) {
this.currentBotName = user.first_name;
} else {
this.currentBotName = "";
}
this.currentItemName = receipt.title;
if (receipt.info != null) {
this.validateRequest = new TLRPC.TL_payments_validateRequestedInfo();
if (this.messageObject != null) {
TLRPC.TL_inputInvoiceMessage tL_inputInvoiceMessage = new TLRPC.TL_inputInvoiceMessage();
tL_inputInvoiceMessage.peer = getMessagesController().getInputPeer(receipt.bot_id);
this.validateRequest.invoice = tL_inputInvoiceMessage;
} else {
TLRPC.TL_inputInvoiceSlug tL_inputInvoiceSlug = new TLRPC.TL_inputInvoiceSlug();
tL_inputInvoiceSlug.slug = this.invoiceSlug;
this.validateRequest.invoice = tL_inputInvoiceSlug;
}
this.validateRequest.info = receipt.info;
}
this.cardName = receipt.credentials_title;
}
public PaymentFormActivity(TLRPC.PaymentForm form, String invoiceSlug, BaseFragment parentFragment) {
this(form, null, invoiceSlug, parentFragment);
}
public PaymentFormActivity(TLRPC.PaymentForm form, TLRPC.InputInvoice premiumGiftCode, BaseFragment parentFragment) {
this(premiumGiftCode, form, null, null, 4, null, null, null, null, null, null, false, null, parentFragment);
this.isCheckoutPreview = true;
}
public PaymentFormActivity(TLRPC.PaymentForm form, MessageObject message, BaseFragment parentFragment) {
this(form, message, null, parentFragment);
}
public PaymentFormActivity(TLRPC.PaymentForm form, MessageObject message, String invoiceSlug, BaseFragment parentFragment) {
this.countriesArray = new ArrayList<>();
this.countriesMap = new HashMap<>();
this.codesMap = new HashMap<>();
this.phoneFormatMap = new HashMap<>();
this.swipeBackEnabled = true;
this.headerCell = new HeaderCell[3];
this.dividers = new ArrayList<>();
this.sectionCell = new ShadowSectionCell[3];
this.bottomCell = new TextInfoPrivacyCell[3];
this.settingsCell = new TextSettingsCell[2];
this.detailSettingsCell = new TextDetailSettingsCell[7];
this.shiftDp = -4.5f;
this.emailCodeLength = 6;
this.isCheckoutPreview = true;
init(null, form, message, invoiceSlug, 4, null, null, null, null, null, null, false, null, parentFragment);
}
public PaymentFormActivity(TLRPC.InputInvoice premiumGiftCode, TLRPC.PaymentForm form, MessageObject message, String invoiceSlug, int step, TLRPC.TL_payments_validatedRequestedInfo validatedRequestedInfo, TLRPC.TL_shippingOption shipping, Long tips, String tokenJson, String card, TLRPC.TL_payments_validateRequestedInfo request, boolean saveCard, TLRPC.TL_inputPaymentCredentialsGooglePay googlePay, BaseFragment parent) {
this.countriesArray = new ArrayList<>();
this.countriesMap = new HashMap<>();
this.codesMap = new HashMap<>();
this.phoneFormatMap = new HashMap<>();
this.swipeBackEnabled = true;
this.headerCell = new HeaderCell[3];
this.dividers = new ArrayList<>();
this.sectionCell = new ShadowSectionCell[3];
this.bottomCell = new TextInfoPrivacyCell[3];
this.settingsCell = new TextSettingsCell[2];
this.detailSettingsCell = new TextDetailSettingsCell[7];
this.shiftDp = -4.5f;
this.emailCodeLength = 6;
init(premiumGiftCode, form, message, invoiceSlug, step, validatedRequestedInfo, shipping, tips, tokenJson, card, request, saveCard, googlePay, parent);
}
public void setPaymentFormCallback(PaymentFormCallback callback) {
this.paymentFormCallback = callback;
}
public final void setCurrentPassword(TLRPC.account_Password password) {
if (password != null && password.has_password) {
if (getParentActivity() == null) {
return;
}
goToNextStep();
} else {
this.currentPassword = password;
this.waitingForEmail = (password == null || TextUtils.isEmpty(password.email_unconfirmed_pattern)) ? false : true;
updatePasswordFields();
}
}
public final void setDelegate(PaymentFormActivityDelegate paymentFormActivityDelegate) {
this.delegate = paymentFormActivityDelegate;
}
public void setResourcesProvider(Theme.ResourcesProvider provider) {
this.resourcesProvider = provider;
}
public Theme.ResourcesProvider getResourceProvider() {
return this.resourcesProvider;
}
public final void init(TLRPC.InputInvoice premiumGiftCode, TLRPC.PaymentForm form, MessageObject message, String slug, int step, TLRPC.TL_payments_validatedRequestedInfo validatedRequestedInfo, TLRPC.TL_shippingOption shipping, Long tips, String tokenJson, String card, TLRPC.TL_payments_validateRequestedInfo request, boolean saveCard, TLRPC.TL_inputPaymentCredentialsGooglePay googlePay, BaseFragment parent) {
this.currentStep = step;
this.parentFragment = parent;
this.paymentJson = tokenJson;
this.googlePayCredentials = googlePay;
this.requestedInfo = validatedRequestedInfo;
this.paymentForm = form;
this.shippingOption = shipping;
this.tipAmount = tips;
this.messageObject = message;
this.invoiceSlug = slug;
this.invoiceInput = premiumGiftCode;
this.saveCardInfo = saveCard;
this.isWebView = ("stripe".equals(form.native_provider) || "smartglocal".equals(this.paymentForm.native_provider)) ? false : true;
TLRPC.User user = getMessagesController().getUser(Long.valueOf(form.bot_id));
this.botUser = user;
if (user != null) {
this.currentBotName = user.first_name;
} else {
this.currentBotName = "";
}
this.currentItemName = form.title;
this.validateRequest = request;
this.saveShippingInfo = true;
if (saveCard || this.currentStep == 4) {
this.saveCardInfo = saveCard;
} else {
this.saveCardInfo = !this.paymentForm.saved_credentials.isEmpty();
}
if (card == null) {
if (this.paymentForm.saved_credentials.isEmpty()) {
return;
}
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard = (TLRPC.TL_paymentSavedCredentialsCard) this.paymentForm.saved_credentials.get(0);
this.savedCredentialsCard = tL_paymentSavedCredentialsCard;
this.cardName = tL_paymentSavedCredentialsCard.title;
return;
}
this.cardName = card;
}
public void onResume() {
super.onResume();
AndroidUtilities.requestAdjustResize(getParentActivity(), ((BaseFragment) this).classGuid);
if (Build.VERSION.SDK_INT >= 23) {
try {
int i = this.currentStep;
if ((i == 2 || i == 6) && !this.paymentForm.invoice.test) {
getParentActivity().getWindow().setFlags(8192, 8192);
} else if (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture) {
getParentActivity().getWindow().clearFlags(8192);
}
} catch (Throwable th) {
FileLog.e(th);
}
}
}
@android.annotation.SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
public android.view.View createView(android.content.Context r35) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PaymentFormActivity.createView(android.content.Context):android.view.View");
}
public boolean lambda$createView$1(View view, MotionEvent motionEvent) {
if (getParentActivity() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
countrySelectActivity.setDisableAnonymousNumbers(true);
countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
PaymentFormActivity.this.lambda$createView$0(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$createView$0(CountrySelectActivity.Country country) {
this.country = country;
this.inputFields[4].setText(country.name);
this.countryName = country.shortname;
}
public boolean lambda$createView$2(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
if (i != 6) {
return false;
}
this.doneItem.performClick();
return true;
}
int intValue = ((Integer) textView.getTag()).intValue();
while (true) {
intValue++;
EditText[] editTextArr = this.inputFields;
if (intValue < editTextArr.length) {
if (intValue != 4 && ((View) editTextArr[intValue].getParent()).getVisibility() == 0) {
this.inputFields[intValue].requestFocus();
break;
}
} else {
break;
}
}
return true;
}
public void lambda$createView$3(View view) {
boolean z = !this.saveShippingInfo;
this.saveShippingInfo = z;
this.checkCell1.setChecked(z);
}
public class AnonymousClass6 extends WebViewClient {
public final Context val$context;
public AnonymousClass6(final Context val$context) {
this.val$context = val$context;
}
@Override
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
new AlertDialog.Builder(PaymentFormActivity.this.getContext(), PaymentFormActivity.this.resourcesProvider).setTitle(LocaleController.getString(R.string.ChromeCrashTitle)).setMessage(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.ChromeCrashMessage), new Runnable() {
@Override
public final void run() {
PaymentFormActivity.AnonymousClass6.this.lambda$onRenderProcessGone$0();
}
})).setPositiveButton(LocaleController.getString(R.string.OK), null).show();
return true;
}
public void lambda$onRenderProcessGone$0() {
Browser.openUrl(PaymentFormActivity.this.getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview");
}
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Uri parse;
PaymentFormActivity.this.shouldNavigateBack = !url.equals(r0.webViewUrl);
try {
parse = Uri.parse(url);
} catch (Exception unused) {
}
if ("t.me".equals(parse.getHost())) {
PaymentFormActivity.this.goToNextStep();
return true;
}
if (PaymentFormActivity.BLACKLISTED_PROTOCOLS.contains(parse.getScheme())) {
return true;
}
if (!PaymentFormActivity.WEBVIEW_PROTOCOLS.contains(parse.getScheme())) {
try {
if (PaymentFormActivity.this.getContext() instanceof Activity) {
((Activity) PaymentFormActivity.this.getContext()).startActivityForResult(new Intent("android.intent.action.VIEW", parse), 210);
}
} catch (ActivityNotFoundException unused2) {
new AlertDialog.Builder(this.val$context).setTitle(PaymentFormActivity.this.currentBotName).setMessage(LocaleController.getString(R.string.PaymentAppNotFoundForDeeplink)).setPositiveButton(LocaleController.getString(R.string.OK), null).show();
}
return true;
}
return super.shouldOverrideUrlLoading(view, url);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
PaymentFormActivity.this.webviewLoading = false;
PaymentFormActivity.this.showEditDoneProgress(true, false);
PaymentFormActivity.this.updateSavePaymentField();
}
}
public void lambda$createView$4(View view) {
boolean z = !this.saveCardInfo;
this.saveCardInfo = z;
this.checkCell1.setChecked(z);
}
public boolean lambda$createView$6(View view, MotionEvent motionEvent) {
if (getParentActivity() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
CountrySelectActivity countrySelectActivity = new CountrySelectActivity(false);
countrySelectActivity.setDisableAnonymousNumbers(true);
countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
PaymentFormActivity.this.lambda$createView$5(country);
}
});
presentFragment(countrySelectActivity);
}
return true;
}
public void lambda$createView$5(CountrySelectActivity.Country country) {
this.country = country;
this.inputFields[4].setText(country.name);
}
public boolean lambda$createView$7(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
if (i != 6) {
return false;
}
this.doneItem.performClick();
return true;
}
int intValue = ((Integer) textView.getTag()).intValue();
while (true) {
intValue++;
EditText[] editTextArr = this.inputFields;
if (intValue >= editTextArr.length) {
break;
}
if (intValue == 4) {
intValue++;
}
if (((View) editTextArr[intValue].getParent()).getVisibility() == 0) {
this.inputFields[intValue].requestFocus();
break;
}
}
return true;
}
public void lambda$createView$8(View view) {
boolean z = !this.saveCardInfo;
this.saveCardInfo = z;
this.checkCell1.setChecked(z);
}
public void lambda$createView$9(View view) {
int intValue = ((Integer) view.getTag()).intValue();
int i = 0;
while (true) {
RadioCell[] radioCellArr = this.radioCells;
if (i >= radioCellArr.length) {
return;
}
radioCellArr[i].setChecked(intValue == i, true);
i++;
}
}
public boolean lambda$createView$11(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6) {
return false;
}
this.doneItem.performClick();
return true;
}
public void lambda$createView$12(View view) {
this.passwordOk = false;
goToNextStep();
}
public void lambda$createView$13(View view) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
public static boolean lambda$createView$14(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6) {
return false;
}
AndroidUtilities.hideKeyboard(textView);
return true;
}
public void lambda$createView$15(TextView textView, long j, View view) {
long longValue = ((Long) textView.getTag()).longValue();
Long l = this.tipAmount;
if (l != null && longValue == l.longValue()) {
this.ignoreOnTextChange = true;
this.inputFields[0].setText("");
this.ignoreOnTextChange = false;
this.tipAmount = 0L;
updateTotalPrice();
} else {
this.inputFields[0].setText(LocaleController.getInstance().formatCurrencyString(j, false, true, true, this.paymentForm.invoice.currency));
}
EditText[] editTextArr = this.inputFields;
editTextArr[0].setSelection(editTextArr[0].length());
}
public void lambda$createView$16(View view) {
if (getParentActivity() == null) {
return;
}
showChoosePaymentMethod();
}
public void lambda$createView$17(View view) {
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 0, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity.setDelegate(new PaymentFormActivityDelegate() {
@Override
public void currentPasswordUpdated(TLRPC.account_Password account_password) {
PaymentFormActivityDelegate.CC.$default$currentPasswordUpdated(this, account_password);
}
@Override
public boolean didSelectNewCard(String str, String str2, boolean z, TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay, TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard) {
return PaymentFormActivityDelegate.CC.$default$didSelectNewCard(this, str, str2, z, tL_inputPaymentCredentialsGooglePay, tL_paymentSavedCredentialsCard);
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivityDelegate.CC.$default$onFragmentDestroyed(this);
}
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo validateRequested) {
PaymentFormActivity.this.validateRequest = validateRequested;
PaymentFormActivity paymentFormActivity2 = PaymentFormActivity.this;
paymentFormActivity2.setAddressFields(paymentFormActivity2.validateRequest.info);
}
});
presentFragment(paymentFormActivity);
}
public void lambda$createView$18(View view) {
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 0, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity.setDelegate(new PaymentFormActivityDelegate() {
@Override
public void currentPasswordUpdated(TLRPC.account_Password account_password) {
PaymentFormActivityDelegate.CC.$default$currentPasswordUpdated(this, account_password);
}
@Override
public boolean didSelectNewCard(String str, String str2, boolean z, TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay, TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard) {
return PaymentFormActivityDelegate.CC.$default$didSelectNewCard(this, str, str2, z, tL_inputPaymentCredentialsGooglePay, tL_paymentSavedCredentialsCard);
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivityDelegate.CC.$default$onFragmentDestroyed(this);
}
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo validateRequested) {
PaymentFormActivity.this.validateRequest = validateRequested;
PaymentFormActivity paymentFormActivity2 = PaymentFormActivity.this;
paymentFormActivity2.setAddressFields(paymentFormActivity2.validateRequest.info);
}
});
presentFragment(paymentFormActivity);
}
public void lambda$createView$19(View view) {
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 0, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity.setDelegate(new PaymentFormActivityDelegate() {
@Override
public void currentPasswordUpdated(TLRPC.account_Password account_password) {
PaymentFormActivityDelegate.CC.$default$currentPasswordUpdated(this, account_password);
}
@Override
public boolean didSelectNewCard(String str, String str2, boolean z, TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay, TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard) {
return PaymentFormActivityDelegate.CC.$default$didSelectNewCard(this, str, str2, z, tL_inputPaymentCredentialsGooglePay, tL_paymentSavedCredentialsCard);
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivityDelegate.CC.$default$onFragmentDestroyed(this);
}
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo validateRequested) {
PaymentFormActivity.this.validateRequest = validateRequested;
PaymentFormActivity paymentFormActivity2 = PaymentFormActivity.this;
paymentFormActivity2.setAddressFields(paymentFormActivity2.validateRequest.info);
}
});
presentFragment(paymentFormActivity);
}
public void lambda$createView$20(View view) {
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 0, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity.setDelegate(new PaymentFormActivityDelegate() {
@Override
public void currentPasswordUpdated(TLRPC.account_Password account_password) {
PaymentFormActivityDelegate.CC.$default$currentPasswordUpdated(this, account_password);
}
@Override
public boolean didSelectNewCard(String str, String str2, boolean z, TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay, TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard) {
return PaymentFormActivityDelegate.CC.$default$didSelectNewCard(this, str, str2, z, tL_inputPaymentCredentialsGooglePay, tL_paymentSavedCredentialsCard);
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivityDelegate.CC.$default$onFragmentDestroyed(this);
}
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo validateRequested) {
PaymentFormActivity.this.validateRequest = validateRequested;
PaymentFormActivity paymentFormActivity2 = PaymentFormActivity.this;
paymentFormActivity2.setAddressFields(paymentFormActivity2.validateRequest.info);
}
});
presentFragment(paymentFormActivity);
}
public void lambda$createView$23(java.lang.String r22, final android.view.View r23) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PaymentFormActivity.lambda$createView$23(java.lang.String, android.view.View):void");
}
public void lambda$createView$21(View view) {
setDonePressed(false);
view.callOnClick();
}
public void lambda$createView$22(DialogInterface dialogInterface, int i) {
showPayAlert(this.totalPrice[0]);
}
public class AnonymousClass18 extends WebViewClient {
public final Context val$context;
public AnonymousClass18(final Context val$context) {
this.val$context = val$context;
}
@Override
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
FragmentActivity fragmentActivity = LaunchActivity.instance;
if (fragmentActivity != null && fragmentActivity.isFinishing()) {
return true;
}
new AlertDialog.Builder(PaymentFormActivity.this.getContext(), PaymentFormActivity.this.resourcesProvider).setTitle(LocaleController.getString(R.string.ChromeCrashTitle)).setMessage(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.ChromeCrashMessage), new Runnable() {
@Override
public final void run() {
PaymentFormActivity.AnonymousClass18.this.lambda$onRenderProcessGone$0();
}
})).setPositiveButton(LocaleController.getString(R.string.OK), null).show();
return true;
}
public void lambda$onRenderProcessGone$0() {
Browser.openUrl(PaymentFormActivity.this.getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview");
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
PaymentFormActivity.this.webviewLoading = false;
PaymentFormActivity.this.showEditDoneProgress(true, false);
PaymentFormActivity.this.updateSavePaymentField();
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
try {
Uri parse = Uri.parse(url);
if ("t.me".equals(parse.getHost())) {
PaymentFormActivity.this.goToNextStep();
return true;
}
if (PaymentFormActivity.BLACKLISTED_PROTOCOLS.contains(parse.getScheme())) {
return true;
}
if (PaymentFormActivity.WEBVIEW_PROTOCOLS.contains(parse.getScheme())) {
return false;
}
try {
if (PaymentFormActivity.this.getContext() instanceof Activity) {
((Activity) PaymentFormActivity.this.getContext()).startActivityForResult(new Intent("android.intent.action.VIEW", parse), 210);
}
} catch (ActivityNotFoundException unused) {
new AlertDialog.Builder(this.val$context).setTitle(PaymentFormActivity.this.currentBotName).setMessage(LocaleController.getString(R.string.PaymentAppNotFoundForDeeplink)).setPositiveButton(LocaleController.getString(R.string.OK), null).show();
}
return true;
} catch (Exception unused2) {
return false;
}
}
}
public void lambda$createView$24(View view) {
if (this.donePressed) {
return;
}
boolean z = !this.recurrentAccepted;
this.recurrentAccepted = z;
this.recurrentAcceptCell.setChecked(z);
this.bottomLayout.setChecked(this.recurrentAccepted, true);
}
public boolean lambda$createView$25(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6) {
return false;
}
sendSavePassword(false);
return true;
}
public void lambda$createView$27(View view) {
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(new TLRPC.TL_account_resendPasswordEmail(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.lambda$createView$26(tLObject, tL_error);
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("ResendCodeInfo", R.string.ResendCodeInfo));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
public void lambda$createView$29(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
String string = LocaleController.getString("TurnPasswordOffQuestion", R.string.TurnPasswordOffQuestion);
if (this.currentPassword.has_secure_values) {
string = string + "\n\n" + LocaleController.getString("TurnPasswordOffPassport", R.string.TurnPasswordOffPassport);
}
builder.setMessage(string);
builder.setTitle(LocaleController.getString("TurnPasswordOffQuestionTitle", R.string.TurnPasswordOffQuestionTitle));
builder.setPositiveButton(LocaleController.getString("Disable", R.string.Disable), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PaymentFormActivity.this.lambda$createView$28(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(getThemedColor(Theme.key_text_RedBold));
}
}
public void lambda$createView$28(DialogInterface dialogInterface, int i) {
sendSavePassword(true);
}
public boolean lambda$createView$30(TextView textView, int i, KeyEvent keyEvent) {
if (i == 6) {
this.doneItem.performClick();
return true;
}
if (i != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue();
if (intValue == 0) {
this.inputFields[1].requestFocus();
return false;
}
if (intValue != 1) {
return false;
}
this.inputFields[2].requestFocus();
return false;
}
public final void showChoosePaymentMethod() {
showChoosePaymentMethod(null);
}
public final void showChoosePaymentMethod(final Runnable callback) {
BottomSheet.Builder title = new BottomSheet.Builder(getParentActivity()).setTitle(LocaleController.getString("PaymentCheckoutMethod", R.string.PaymentCheckoutMethod), true);
final ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard = this.savedCredentialsCard;
if (tL_paymentSavedCredentialsCard != null) {
arrayList.add(tL_paymentSavedCredentialsCard.title);
arrayList2.add(Integer.valueOf(R.drawable.msg_payment_card));
} else {
String str = this.cardName;
if (str != null) {
arrayList.add(str);
arrayList2.add(Integer.valueOf(R.drawable.msg_payment_card));
}
}
final ArrayList arrayList3 = new ArrayList();
Iterator it = this.paymentForm.saved_credentials.iterator();
while (it.hasNext()) {
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard2 = (TLRPC.TL_paymentSavedCredentialsCard) it.next();
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard3 = this.savedCredentialsCard;
if (tL_paymentSavedCredentialsCard3 == null || !Objects.equals(tL_paymentSavedCredentialsCard2.id, tL_paymentSavedCredentialsCard3.id)) {
arrayList.add(tL_paymentSavedCredentialsCard2.title);
arrayList2.add(Integer.valueOf(R.drawable.msg_payment_card));
arrayList3.add(tL_paymentSavedCredentialsCard2);
}
}
Iterator it2 = this.paymentForm.additional_methods.iterator();
while (it2.hasNext()) {
arrayList.add(((TLRPC.TL_paymentFormMethod) it2.next()).title);
arrayList2.add(Integer.valueOf(R.drawable.msg_payment_provider));
}
arrayList.add(LocaleController.getString(R.string.PaymentCheckoutMethodNewCard));
arrayList2.add(Integer.valueOf(R.drawable.msg_addbot));
int[] iArr = new int[arrayList2.size()];
for (int i = 0; i < arrayList2.size(); i++) {
iArr[i] = ((Integer) arrayList2.get(i)).intValue();
}
title.setItems((CharSequence[]) arrayList.toArray(new CharSequence[0]), iArr, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
PaymentFormActivity.this.lambda$showChoosePaymentMethod$31(callback, arrayList3, arrayList, dialogInterface, i2);
}
});
showDialog(title.create());
}
public void lambda$showChoosePaymentMethod$31(final Runnable runnable, List list, List list2, DialogInterface dialogInterface, int i) {
PaymentFormActivityDelegate paymentFormActivityDelegate = new PaymentFormActivityDelegate() {
@Override
public void currentPasswordUpdated(TLRPC.account_Password account_password) {
PaymentFormActivityDelegate.CC.$default$currentPasswordUpdated(this, account_password);
}
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo) {
PaymentFormActivityDelegate.CC.$default$didSelectNewAddress(this, tL_payments_validateRequestedInfo);
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivityDelegate.CC.$default$onFragmentDestroyed(this);
}
@Override
public boolean didSelectNewCard(String tokenJson, String card, boolean saveCard, TLRPC.TL_inputPaymentCredentialsGooglePay googlePay, TLRPC.TL_paymentSavedCredentialsCard credentialsCard) {
String str;
PaymentFormActivity.this.savedCredentialsCard = credentialsCard;
PaymentFormActivity.this.paymentJson = tokenJson;
PaymentFormActivity.this.saveCardInfo = saveCard;
PaymentFormActivity.this.cardName = card;
PaymentFormActivity.this.googlePayCredentials = googlePay;
if (PaymentFormActivity.this.detailSettingsCell[0] != null) {
PaymentFormActivity.this.detailSettingsCell[0].setVisibility(0);
TextDetailSettingsCell textDetailSettingsCell = PaymentFormActivity.this.detailSettingsCell[0];
if (PaymentFormActivity.this.cardName == null || PaymentFormActivity.this.cardName.length() <= 1) {
str = PaymentFormActivity.this.cardName;
} else {
str = PaymentFormActivity.this.cardName.substring(0, 1).toUpperCase() + PaymentFormActivity.this.cardName.substring(1);
}
textDetailSettingsCell.setTextAndValueAndIcon(str, LocaleController.getString("PaymentCheckoutMethod", R.string.PaymentCheckoutMethod), R.drawable.msg_payment_card, true);
if (PaymentFormActivity.this.detailSettingsCell[1] != null) {
PaymentFormActivity.this.detailSettingsCell[1].setVisibility(0);
}
}
Runnable runnable2 = runnable;
if (runnable2 != null) {
runnable2.run();
}
return false;
}
};
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard = this.savedCredentialsCard;
int i2 = (tL_paymentSavedCredentialsCard == null && this.cardName == null) ? 0 : 1;
if (!(tL_paymentSavedCredentialsCard == null && this.cardName == null) && i == 0) {
return;
}
if (i >= i2 && i < list.size() + i2) {
TLRPC.TL_paymentSavedCredentialsCard tL_paymentSavedCredentialsCard2 = (TLRPC.TL_paymentSavedCredentialsCard) list.get(i - i2);
this.savedCredentialsCard = tL_paymentSavedCredentialsCard2;
paymentFormActivityDelegate.didSelectNewCard(null, tL_paymentSavedCredentialsCard2.title, true, null, tL_paymentSavedCredentialsCard2);
} else {
if (i < list2.size() - 1) {
TLRPC.TL_paymentFormMethod tL_paymentFormMethod = (TLRPC.TL_paymentFormMethod) this.paymentForm.additional_methods.get((i - list.size()) - i2);
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 2, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity.setPaymentMethod(tL_paymentFormMethod);
paymentFormActivity.setDelegate(paymentFormActivityDelegate);
presentFragment(paymentFormActivity);
return;
}
if (i == list2.size() - 1) {
PaymentFormActivity paymentFormActivity2 = new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 2, this.requestedInfo, this.shippingOption, this.tipAmount, null, this.cardName, this.validateRequest, this.saveCardInfo, null, this.parentFragment);
paymentFormActivity2.setDelegate(paymentFormActivityDelegate);
presentFragment(paymentFormActivity2);
}
}
}
public final void setPaymentMethod(TLRPC.TL_paymentFormMethod method) {
this.paymentFormMethod = method;
}
public final void setAddressFields(TLRPC.TL_paymentRequestedInfo info) {
TLRPC.TL_postAddress tL_postAddress = info.shipping_address;
if (tL_postAddress != null) {
this.detailSettingsCell[2].setTextAndValueAndIcon(String.format("%s %s, %s, %s, %s, %s", tL_postAddress.street_line1, tL_postAddress.street_line2, tL_postAddress.city, tL_postAddress.state, tL_postAddress.country_iso2, tL_postAddress.post_code), LocaleController.getString("PaymentShippingAddress", R.string.PaymentShippingAddress), R.drawable.msg_payment_address, true);
}
this.detailSettingsCell[2].setVisibility(info.shipping_address != null ? 0 : 8);
String str = info.name;
if (str != null) {
this.detailSettingsCell[3].setTextAndValueAndIcon(str, LocaleController.getString("PaymentCheckoutName", R.string.PaymentCheckoutName), R.drawable.msg_contacts, true);
}
this.detailSettingsCell[3].setVisibility(info.name != null ? 0 : 8);
if (info.phone != null) {
this.detailSettingsCell[4].setTextAndValueAndIcon(PhoneFormat.getInstance().format(info.phone), LocaleController.getString("PaymentCheckoutPhoneNumber", R.string.PaymentCheckoutPhoneNumber), R.drawable.msg_calls, (info.email == null && this.shippingOption == null) ? false : true);
}
this.detailSettingsCell[4].setVisibility(info.phone != null ? 0 : 8);
String str2 = info.email;
if (str2 != null) {
this.detailSettingsCell[5].setTextAndValueAndIcon(str2, LocaleController.getString("PaymentCheckoutEmail", R.string.PaymentCheckoutEmail), R.drawable.msg_mention, this.shippingOption != null);
}
this.detailSettingsCell[5].setVisibility(info.email == null ? 8 : 0);
}
public final void updateTotalPrice() {
this.totalPrice[0] = getTotalPriceString(this.prices);
this.totalCell.setTextAndValue(LocaleController.getString("PaymentTransactionTotal", R.string.PaymentTransactionTotal), this.totalPrice[0], true);
TextView textView = this.payTextView;
if (textView != null) {
textView.setText(LocaleController.formatString("PaymentCheckoutPay", R.string.PaymentCheckoutPay, new Object[]{this.totalPrice[0]}));
}
if (this.tipLayout != null) {
int themedColor = getThemedColor(Theme.key_contacts_inviteBackground);
int childCount = this.tipLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
TextView textView2 = (TextView) this.tipLayout.getChildAt(i);
if (textView2.getTag().equals(this.tipAmount)) {
Theme.setDrawableColor(textView2.getBackground(), themedColor);
textView2.setTextColor(getThemedColor(Theme.key_contacts_inviteText));
} else {
Theme.setDrawableColor(textView2.getBackground(), 536870911 & themedColor);
textView2.setTextColor(getThemedColor(Theme.key_chats_secretName));
}
textView2.invalidate();
}
}
}
public final void createGooglePayButton(Context context) {
FrameLayout frameLayout = new FrameLayout(context);
this.googlePayContainer = frameLayout;
frameLayout.setBackgroundDrawable(Theme.getSelectorDrawable(true));
this.googlePayContainer.setVisibility(8);
FrameLayout frameLayout2 = new FrameLayout(context);
this.googlePayButton = frameLayout2;
frameLayout2.setClickable(true);
this.googlePayButton.setFocusable(true);
this.googlePayButton.setBackgroundResource(R.drawable.googlepay_button_no_shadow_background);
if (this.googlePayPublicKey == null) {
this.googlePayButton.setPadding(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(2.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(2.0f));
} else {
this.googlePayButton.setPadding(AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f));
}
this.googlePayContainer.addView(this.googlePayButton, LayoutHelper.createFrame(-1, 48.0f));
this.googlePayButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PaymentFormActivity.this.lambda$createGooglePayButton$32(view);
}
});
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setWeightSum(2.0f);
linearLayout.setGravity(16);
linearLayout.setOrientation(1);
linearLayout.setDuplicateParentStateEnabled(true);
this.googlePayButton.addView(linearLayout, LayoutHelper.createFrame(-1, -1.0f));
ImageView imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
imageView.setDuplicateParentStateEnabled(true);
imageView.setImageResource(R.drawable.buy_with_googlepay_button_content);
linearLayout.addView(imageView, LayoutHelper.createLinear(-1, 0, 1.0f));
ImageView imageView2 = new ImageView(context);
imageView2.setScaleType(ImageView.ScaleType.FIT_XY);
imageView2.setDuplicateParentStateEnabled(true);
imageView2.setImageResource(R.drawable.googlepay_button_overlay);
this.googlePayButton.addView(imageView2, LayoutHelper.createFrame(-1, -1.0f));
}
public void lambda$createGooglePayButton$32(View view) {
this.googlePayButton.setClickable(false);
try {
JSONObject baseRequest = getBaseRequest();
JSONObject baseCardPaymentMethod = getBaseCardPaymentMethod();
if (this.googlePayPublicKey != null && this.googlePayParameters == null) {
baseCardPaymentMethod.put("tokenizationSpecification", new JSONObject() {
{
put("type", "DIRECT");
put("parameters", new JSONObject() {
{
put("protocolVersion", "ECv2");
put("publicKey", PaymentFormActivity.this.googlePayPublicKey);
}
});
}
});
} else {
baseCardPaymentMethod.put("tokenizationSpecification", new JSONObject() {
{
put("type", "PAYMENT_GATEWAY");
if (PaymentFormActivity.this.googlePayParameters != null) {
put("parameters", PaymentFormActivity.this.googlePayParameters);
} else {
put("parameters", new JSONObject() {
{
put("gateway", "stripe");
put("stripe:publishableKey", PaymentFormActivity.this.providerApiKey);
put("stripe:version", "3.5.0");
}
});
}
}
});
}
baseRequest.put("allowedPaymentMethods", new JSONArray().put(baseCardPaymentMethod));
JSONObject jSONObject = new JSONObject();
ArrayList<TLRPC.TL_labeledPrice> arrayList = new ArrayList<>(this.paymentForm.invoice.prices);
TLRPC.TL_shippingOption tL_shippingOption = this.shippingOption;
if (tL_shippingOption != null) {
arrayList.addAll(tL_shippingOption.prices);
}
jSONObject.put("totalPrice", getTotalPriceDecimalString(arrayList));
jSONObject.put("totalPriceStatus", "FINAL");
if (!TextUtils.isEmpty(this.googlePayCountryCode)) {
jSONObject.put("countryCode", this.googlePayCountryCode);
}
jSONObject.put("currencyCode", this.paymentForm.invoice.currency);
jSONObject.put("checkoutOption", "COMPLETE_IMMEDIATE_PURCHASE");
baseRequest.put("transactionInfo", jSONObject);
baseRequest.put("merchantInfo", new JSONObject().put("merchantName", this.currentBotName));
PaymentDataRequest fromJson = PaymentDataRequest.fromJson(baseRequest.toString());
if (fromJson != null) {
AutoResolveHelper.resolveTask(this.paymentsClient.loadPaymentData(fromJson), getParentActivity(), 991);
}
} catch (JSONException e) {
FileLog.e(e);
}
}
public final void updatePasswordFields() {
if (this.currentStep != 6 || this.bottomCell[2] == null) {
return;
}
int i = 0;
this.doneItem.setVisibility(0);
if (this.currentPassword == null) {
showEditDoneProgress(true, true);
this.bottomCell[2].setVisibility(8);
this.settingsCell[0].setVisibility(8);
this.settingsCell[1].setVisibility(8);
this.codeFieldCell.setVisibility(8);
this.headerCell[0].setVisibility(8);
this.headerCell[1].setVisibility(8);
this.bottomCell[0].setVisibility(8);
for (int i2 = 0; i2 < 3; i2++) {
((View) this.inputFields[i2].getParent()).setVisibility(8);
}
while (i < this.dividers.size()) {
this.dividers.get(i).setVisibility(8);
i++;
}
return;
}
showEditDoneProgress(true, false);
if (this.waitingForEmail) {
TextInfoPrivacyCell textInfoPrivacyCell = this.bottomCell[2];
int i3 = R.string.EmailPasswordConfirmText2;
Object[] objArr = new Object[1];
String str = this.currentPassword.email_unconfirmed_pattern;
if (str == null) {
str = "";
}
objArr[0] = str;
textInfoPrivacyCell.setText(LocaleController.formatString("EmailPasswordConfirmText2", i3, objArr));
this.bottomCell[2].setVisibility(0);
this.settingsCell[0].setVisibility(0);
this.settingsCell[1].setVisibility(0);
this.codeFieldCell.setVisibility(0);
this.bottomCell[1].setText("");
this.headerCell[0].setVisibility(8);
this.headerCell[1].setVisibility(8);
this.bottomCell[0].setVisibility(8);
for (int i4 = 0; i4 < 3; i4++) {
((View) this.inputFields[i4].getParent()).setVisibility(8);
}
while (i < this.dividers.size()) {
this.dividers.get(i).setVisibility(8);
i++;
}
return;
}
this.bottomCell[2].setVisibility(8);
this.settingsCell[0].setVisibility(8);
this.settingsCell[1].setVisibility(8);
this.bottomCell[1].setText(LocaleController.getString("PaymentPasswordEmailInfo", R.string.PaymentPasswordEmailInfo));
this.codeFieldCell.setVisibility(8);
this.headerCell[0].setVisibility(0);
this.headerCell[1].setVisibility(0);
this.bottomCell[0].setVisibility(0);
for (int i5 = 0; i5 < 3; i5++) {
((View) this.inputFields[i5].getParent()).setVisibility(0);
}
for (int i6 = 0; i6 < this.dividers.size(); i6++) {
this.dividers.get(i6).setVisibility(0);
}
}
public final void loadPasswordInfo() {
if (this.loadingPasswordInfo) {
return;
}
this.loadingPasswordInfo = true;
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$loadPasswordInfo$35(tLObject, tL_error);
}
}, 10);
}
public void lambda$loadPasswordInfo$35(final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$loadPasswordInfo$34(tL_error, tLObject);
}
});
}
public void lambda$loadPasswordInfo$34(TLRPC.TL_error tL_error, TLObject tLObject) {
this.loadingPasswordInfo = false;
if (tL_error == 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;
}
TLRPC.PaymentForm paymentForm = this.paymentForm;
if (paymentForm != null && this.currentPassword.has_password) {
paymentForm.password_missing = false;
paymentForm.can_save_credentials = true;
updateSavePaymentField();
}
TwoStepVerificationActivity.initPasswordNewAlgo(this.currentPassword);
PaymentFormActivity paymentFormActivity = this.passwordFragment;
if (paymentFormActivity != null) {
paymentFormActivity.setCurrentPassword(this.currentPassword);
}
if (this.currentPassword.has_password || this.shortPollRunnable != null) {
return;
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$loadPasswordInfo$33();
}
};
this.shortPollRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 5000L);
}
}
public void lambda$loadPasswordInfo$33() {
if (this.shortPollRunnable == null) {
return;
}
loadPasswordInfo();
this.shortPollRunnable = null;
}
public final void showAlertWithText(String title, String text) {
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 showPayAlert(final String totalPrice) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("PaymentTransactionReview", R.string.PaymentTransactionReview));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("PaymentTransactionMessage2", R.string.PaymentTransactionMessage2, new Object[]{totalPrice, this.currentBotName, this.currentItemName})));
builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PaymentFormActivity.this.lambda$showPayAlert$36(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
public void lambda$showPayAlert$36(DialogInterface dialogInterface, int i) {
setDonePressed(true);
sendData();
}
public final JSONObject getBaseRequest() throws JSONException {
return new JSONObject().put("apiVersion", 2).put("apiVersionMinor", 0);
}
public final JSONObject getBaseCardPaymentMethod() throws JSONException {
List asList = Arrays.asList("AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA");
List asList2 = Arrays.asList("PAN_ONLY", "CRYPTOGRAM_3DS");
JSONObject jSONObject = new JSONObject();
jSONObject.put("type", "CARD");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("allowedAuthMethods", new JSONArray((Collection) asList2));
jSONObject2.put("allowedCardNetworks", new JSONArray((Collection) asList));
jSONObject.put("parameters", jSONObject2);
return jSONObject;
}
public Optional<JSONObject> getIsReadyToPayRequest() {
try {
JSONObject baseRequest = getBaseRequest();
baseRequest.put("allowedPaymentMethods", new JSONArray().put(getBaseCardPaymentMethod()));
return Optional.of(baseRequest);
} catch (JSONException unused) {
return Optional.empty();
}
}
public final void initGooglePay(Context context) {
IsReadyToPayRequest fromJson;
if (Build.VERSION.SDK_INT < 19 || getParentActivity() == null) {
return;
}
this.paymentsClient = Wallet.getPaymentsClient(context, new Wallet.WalletOptions.Builder().setEnvironment(this.paymentForm.invoice.test ? 3 : 1).setTheme(1).build());
Optional<JSONObject> isReadyToPayRequest = getIsReadyToPayRequest();
if (isReadyToPayRequest.isPresent() && (fromJson = IsReadyToPayRequest.fromJson(((JSONObject) isReadyToPayRequest.get()).toString())) != null) {
this.paymentsClient.isReadyToPay(fromJson).addOnCompleteListener(getParentActivity(), new OnCompleteListener() {
public final void onComplete(Task task) {
PaymentFormActivity.this.lambda$initGooglePay$37(task);
}
});
}
}
public void lambda$initGooglePay$37(Task task) {
if (task.isSuccessful()) {
FrameLayout frameLayout = this.googlePayContainer;
if (frameLayout != null) {
frameLayout.setVisibility(0);
return;
}
return;
}
FileLog.e("isReadyToPay failed", task.getException());
}
public final String getTotalPriceString(ArrayList<TLRPC.TL_labeledPrice> prices) {
long j = 0;
for (int i = 0; i < prices.size(); i++) {
j += prices.get(i).amount;
}
Long l = this.tipAmount;
if (l != null) {
j += l.longValue();
}
return LocaleController.getInstance().formatCurrencyString(j, this.paymentForm.invoice.currency);
}
public final String getTotalPriceDecimalString(ArrayList<TLRPC.TL_labeledPrice> prices) {
long j = 0;
for (int i = 0; i < prices.size(); i++) {
j += prices.get(i).amount;
}
return LocaleController.getInstance().formatCurrencyDecimalString(j, this.paymentForm.invoice.currency, false);
}
public boolean onFragmentCreate() {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.didRemoveTwoStepPassword);
if (this.currentStep != 4 || this.isCheckoutPreview) {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.paymentFinished);
}
return super.onFragmentCreate();
}
public int getOtherSameFragmentDiff() {
INavigationLayout iNavigationLayout = ((BaseFragment) this).parentLayout;
int i = 0;
if (iNavigationLayout == null || iNavigationLayout.getFragmentStack() == null) {
return 0;
}
int indexOf = ((BaseFragment) this).parentLayout.getFragmentStack().indexOf(this);
if (indexOf == -1) {
indexOf = ((BaseFragment) this).parentLayout.getFragmentStack().size();
}
while (true) {
if (i >= ((BaseFragment) this).parentLayout.getFragmentStack().size()) {
i = indexOf;
break;
}
if (((BaseFragment) this).parentLayout.getFragmentStack().get(i) instanceof PaymentFormActivity) {
break;
}
i++;
}
return i - indexOf;
}
public void onFragmentDestroy() {
PaymentFormActivityDelegate paymentFormActivityDelegate = this.delegate;
if (paymentFormActivityDelegate != null) {
paymentFormActivityDelegate.onFragmentDestroyed();
}
AndroidUtilities.checkAndroidTheme(getContext(), false);
if (!this.paymentStatusSent) {
this.invoiceStatus = InvoiceStatus.CANCELLED;
if (this.paymentFormCallback != null && getOtherSameFragmentDiff() == 0) {
this.paymentFormCallback.onInvoiceStatusChanged(this.invoiceStatus);
}
}
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.didRemoveTwoStepPassword);
if (this.currentStep != 4 || this.isCheckoutPreview) {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.paymentFinished);
}
WebView webView = this.webView;
if (webView != null) {
try {
ViewParent parent = webView.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(this.webView);
}
this.webView.stopLoading();
this.webView.loadUrl("about:blank");
this.webViewUrl = null;
this.webView.destroy();
this.webView = null;
} catch (Exception e) {
FileLog.e(e);
}
}
try {
int i = this.currentStep;
if ((i == 2 || i == 6) && Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) {
getParentActivity().getWindow().clearFlags(8192);
}
} catch (Throwable th) {
FileLog.e(th);
}
super.onFragmentDestroy();
this.canceled = true;
}
public void onBecomeFullyVisible() {
super.onBecomeFullyVisible();
if (this.currentStep == 4 && this.needPayAfterTransition) {
this.needPayAfterTransition = false;
this.bottomLayout.callOnClick();
}
}
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
if (!isOpen || backward) {
return;
}
WebView webView = this.webView;
if (webView != null) {
if (this.currentStep != 4) {
TLRPC.TL_paymentFormMethod tL_paymentFormMethod = this.paymentFormMethod;
if (tL_paymentFormMethod != null) {
String str = tL_paymentFormMethod.url;
this.webViewUrl = str;
webView.loadUrl(str);
return;
} else {
String str2 = this.paymentForm.url;
this.webViewUrl = str2;
webView.loadUrl(str2);
return;
}
}
return;
}
int i = this.currentStep;
if (i == 2) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$onTransitionAnimationEnd$38();
}
}, 100L);
return;
}
if (i == 3) {
this.inputFields[1].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[1]);
return;
}
if (i == 4) {
EditText[] editTextArr = this.inputFields;
if (editTextArr != null) {
editTextArr[0].requestFocus();
return;
}
return;
}
if (i != 6 || this.waitingForEmail) {
return;
}
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
public void lambda$onTransitionAnimationEnd$38() {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.twoStepPasswordChanged) {
TLRPC.PaymentForm paymentForm = this.paymentForm;
paymentForm.password_missing = false;
paymentForm.can_save_credentials = true;
updateSavePaymentField();
return;
}
if (id == NotificationCenter.didRemoveTwoStepPassword) {
TLRPC.PaymentForm paymentForm2 = this.paymentForm;
paymentForm2.password_missing = true;
paymentForm2.can_save_credentials = false;
updateSavePaymentField();
return;
}
if (id == NotificationCenter.paymentFinished) {
this.paymentStatusSent = true;
removeSelfFromStack();
}
}
public void onActivityResultFragment(int requestCode, final int resultCode, final Intent data) {
if (requestCode == 991) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$onActivityResultFragment$39(resultCode, data);
}
});
}
}
public void lambda$onActivityResultFragment$39(int i, Intent intent) {
String json;
if (i == -1) {
PaymentData fromIntent = PaymentData.getFromIntent(intent);
if (fromIntent == null || (json = fromIntent.toJson()) == null) {
return;
}
try {
JSONObject jSONObject = new JSONObject(json).getJSONObject("paymentMethodData");
JSONObject jSONObject2 = jSONObject.getJSONObject("tokenizationData");
jSONObject2.getString("type");
String string = jSONObject2.getString("token");
if (this.googlePayPublicKey == null && this.googlePayParameters == null) {
Token parseToken = TokenParser.parseToken(string);
this.paymentJson = String.format(Locale.US, "{\"type\":\"%1$s\", \"id\":\"%2$s\"}", parseToken.getType(), parseToken.getId());
Card card = parseToken.getCard();
this.cardName = card.getBrand() + " *" + card.getLast4();
goToNextStep();
}
TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay = new TLRPC.TL_inputPaymentCredentialsGooglePay();
this.googlePayCredentials = tL_inputPaymentCredentialsGooglePay;
((TLRPC.InputPaymentCredentials) tL_inputPaymentCredentialsGooglePay).payment_token = new TLRPC.TL_dataJSON();
((TLRPC.InputPaymentCredentials) this.googlePayCredentials).payment_token.data = jSONObject2.toString();
String optString = jSONObject.optString("description");
if (!TextUtils.isEmpty(optString)) {
this.cardName = optString;
} else {
this.cardName = "Android Pay";
}
goToNextStep();
} catch (JSONException e) {
FileLog.e(e);
}
} else if (i == 1) {
Status statusFromIntent = AutoResolveHelper.getStatusFromIntent(intent);
StringBuilder sb = new StringBuilder();
sb.append("android pay error ");
sb.append(statusFromIntent != null ? statusFromIntent.getStatusMessage() : "");
FileLog.e(sb.toString());
}
showEditDoneProgress(true, false);
setDonePressed(false);
FrameLayout frameLayout = this.googlePayButton;
if (frameLayout != null) {
frameLayout.setClickable(true);
}
}
public final void goToNextStep() {
int i;
int i2;
boolean z;
int i3 = this.currentStep;
if (i3 == 0) {
PaymentFormActivityDelegate paymentFormActivityDelegate = this.delegate;
if (paymentFormActivityDelegate != null) {
paymentFormActivityDelegate.didSelectNewAddress(this.validateRequest);
finishFragment();
return;
}
if (this.paymentForm.invoice.flexible) {
i = 1;
} else if (this.savedCredentialsCard == null && this.paymentJson == null) {
i = 2;
} else {
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null && UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword.valid_until < ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).getCurrentTime() + 60) {
UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword = null;
UserConfig.getInstance(((BaseFragment) this).currentAccount).saveConfig(false);
}
i = UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null ? 4 : 3;
}
if (i == 2 && this.savedCredentialsCard == null && this.paymentJson == null && !this.paymentForm.additional_methods.isEmpty()) {
showChoosePaymentMethod(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.goToNextStep();
}
});
return;
} else {
presentFragment(new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, i, this.requestedInfo, null, null, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), this.isWebView);
return;
}
}
if (i3 == 1) {
if (this.paymentJson == null && this.cardName == null) {
if (this.savedCredentialsCard != null) {
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null && UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword.valid_until < ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).getCurrentTime() + 60) {
UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword = null;
UserConfig.getInstance(((BaseFragment) this).currentAccount).saveConfig(false);
}
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword == null) {
i2 = 3;
}
} else {
i2 = 2;
}
if (i2 != 2 && this.cardName == null && this.savedCredentialsCard == null && this.paymentJson == null && !this.paymentForm.additional_methods.isEmpty()) {
showChoosePaymentMethod(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.goToNextStep();
}
});
return;
} else {
presentFragment(new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, i2, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), this.isWebView);
return;
}
}
i2 = 4;
if (i2 != 2) {
}
presentFragment(new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, i2, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), this.isWebView);
return;
}
if (i3 == 2) {
TLRPC.PaymentForm paymentForm = this.paymentForm;
if (paymentForm.password_missing && (z = this.saveCardInfo)) {
PaymentFormActivity paymentFormActivity = new PaymentFormActivity(this.invoiceInput, paymentForm, this.messageObject, this.invoiceSlug, 6, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, z, this.googlePayCredentials, this.parentFragment);
this.passwordFragment = paymentFormActivity;
paymentFormActivity.setCurrentPassword(this.currentPassword);
this.passwordFragment.setDelegate(new PaymentFormActivityDelegate() {
@Override
public void didSelectNewAddress(TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo) {
PaymentFormActivityDelegate.CC.$default$didSelectNewAddress(this, tL_payments_validateRequestedInfo);
}
@Override
public boolean didSelectNewCard(String tokenJson, String card, boolean saveCard, TLRPC.TL_inputPaymentCredentialsGooglePay googlePay, TLRPC.TL_paymentSavedCredentialsCard credentialsCard) {
if (PaymentFormActivity.this.delegate != null) {
PaymentFormActivity.this.delegate.didSelectNewCard(tokenJson, card, saveCard, googlePay, credentialsCard);
}
if (PaymentFormActivity.this.isWebView) {
PaymentFormActivity.this.removeSelfFromStack();
}
return PaymentFormActivity.this.delegate != null;
}
@Override
public void onFragmentDestroyed() {
PaymentFormActivity.this.passwordFragment = null;
}
@Override
public void currentPasswordUpdated(TLRPC.account_Password password) {
PaymentFormActivity.this.currentPassword = password;
}
});
presentFragment(this.passwordFragment, this.isWebView);
return;
}
PaymentFormActivityDelegate paymentFormActivityDelegate2 = this.delegate;
if (paymentFormActivityDelegate2 != null) {
paymentFormActivityDelegate2.didSelectNewCard(this.paymentJson, this.cardName, this.saveCardInfo, this.googlePayCredentials, null);
finishFragment();
return;
} else {
presentFragment(new PaymentFormActivity(this.invoiceInput, paymentForm, this.messageObject, this.invoiceSlug, 4, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), this.isWebView);
return;
}
}
if (i3 == 3) {
presentFragment(new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, this.passwordOk ? 4 : 2, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), true);
return;
}
if (i3 != 4) {
if (i3 != 6) {
return;
}
if (!this.delegate.didSelectNewCard(this.paymentJson, this.cardName, this.saveCardInfo, this.googlePayCredentials, this.savedCredentialsCard)) {
presentFragment(new PaymentFormActivity(this.invoiceInput, this.paymentForm, this.messageObject, this.invoiceSlug, 4, this.requestedInfo, this.shippingOption, this.tipAmount, this.paymentJson, this.cardName, this.validateRequest, this.saveCardInfo, this.googlePayCredentials, this.parentFragment), true);
return;
} else {
finishFragment();
return;
}
}
if (this.isCheckoutPreview) {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.paymentFinished);
}
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).postNotificationName(NotificationCenter.paymentFinished, new Object[0]);
if (getMessagesController().newMessageCallback == null) {
if (onCheckoutSuccess(getParentLayout(), getParentActivity()) || isFinishing()) {
return;
}
finishFragment();
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$goToNextStep$40();
}
}, 500L);
}
public void lambda$goToNextStep$40() {
getMessagesController().newMessageCallback = null;
if (this.invoiceStatus == InvoiceStatus.PENDING && !isFinishing()) {
InvoiceStatus invoiceStatus = InvoiceStatus.FAILED;
this.invoiceStatus = invoiceStatus;
PaymentFormCallback paymentFormCallback = this.paymentFormCallback;
if (paymentFormCallback != null) {
paymentFormCallback.onInvoiceStatusChanged(invoiceStatus);
}
finishFragment();
return;
}
if (this.invoiceStatus != InvoiceStatus.PAID || isFinishing()) {
return;
}
finishFragment();
}
public final boolean onCheckoutSuccess(INavigationLayout parentLayout, Activity parentActivity) {
if (this.invoiceInput != null) {
if (parentLayout == null) {
return false;
}
Iterator it = new ArrayList(parentLayout.getFragmentStack()).iterator();
while (it.hasNext()) {
BaseFragment baseFragment = (BaseFragment) it.next();
if (baseFragment instanceof PaymentFormActivity) {
baseFragment.removeSelfFromStack();
}
}
return true;
}
String str = this.botUser.username;
if ((!(str != null && str.equalsIgnoreCase(getMessagesController().premiumBotUsername) && this.invoiceSlug == null) && (this.invoiceSlug == null || getMessagesController().premiumInvoiceSlug == null || !Objects.equals(this.invoiceSlug, getMessagesController().premiumInvoiceSlug))) || parentLayout == null) {
return false;
}
Iterator it2 = new ArrayList(parentLayout.getFragmentStack()).iterator();
while (it2.hasNext()) {
BaseFragment baseFragment2 = (BaseFragment) it2.next();
if ((baseFragment2 instanceof ChatActivity) || (baseFragment2 instanceof PremiumPreviewFragment)) {
baseFragment2.removeSelfFromStack();
}
}
parentLayout.presentFragment(new PremiumPreviewFragment(null).setForcePremium(), !isFinishing());
if (parentActivity instanceof LaunchActivity) {
try {
((BaseFragment) this).fragmentView.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
((LaunchActivity) parentActivity).getFireworksOverlay().start();
}
return true;
}
public final void updateSavePaymentField() {
if (this.bottomCell[0] == null || this.sectionCell[2] == null) {
return;
}
TLRPC.PaymentForm paymentForm = this.paymentForm;
if ((paymentForm.password_missing || paymentForm.can_save_credentials) && (this.webView == null || !this.webviewLoading)) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(LocaleController.getString("PaymentCardSavePaymentInformationInfoLine1", R.string.PaymentCardSavePaymentInformationInfoLine1));
if (this.paymentForm.password_missing) {
loadPasswordInfo();
spannableStringBuilder.append((CharSequence) "\n");
int length = spannableStringBuilder.length();
String string = LocaleController.getString("PaymentCardSavePaymentInformationInfoLine2", R.string.PaymentCardSavePaymentInformationInfoLine2);
int indexOf = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
spannableStringBuilder.append((CharSequence) string);
if (indexOf != -1 && lastIndexOf != -1) {
int i = indexOf + length;
int i2 = lastIndexOf + length;
this.bottomCell[0].getTextView().setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
spannableStringBuilder.replace(i2, i2 + 1, (CharSequence) "");
spannableStringBuilder.replace(i, i + 1, (CharSequence) "");
spannableStringBuilder.setSpan(new LinkSpan(), i, i2 - 1, 33);
}
}
this.checkCell1.setEnabled(true);
this.bottomCell[0].setText(spannableStringBuilder);
this.checkCell1.setVisibility(0);
this.bottomCell[0].setVisibility(0);
ShadowSectionCell[] shadowSectionCellArr = this.sectionCell;
shadowSectionCellArr[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(shadowSectionCellArr[2].getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
return;
}
this.checkCell1.setVisibility(8);
this.bottomCell[0].setVisibility(8);
ShadowSectionCell[] shadowSectionCellArr2 = this.sectionCell;
shadowSectionCellArr2[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(shadowSectionCellArr2[2].getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
}
@android.annotation.SuppressLint({"HardwareIds"})
public void fillNumber(java.lang.String r8) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PaymentFormActivity.fillNumber(java.lang.String):void");
}
public final void sendSavePassword(final boolean clear) {
final String str;
final String str2;
if (!clear && this.codeFieldCell.getVisibility() == 0) {
String text = this.codeFieldCell.getText();
if (text.length() == 0) {
shakeView(this.codeFieldCell);
return;
}
showEditDoneProgress(true, true);
TLRPC.TL_account_confirmPasswordEmail tL_account_confirmPasswordEmail = new TLRPC.TL_account_confirmPasswordEmail();
tL_account_confirmPasswordEmail.code = text;
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_confirmPasswordEmail, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendSavePassword$42(tLObject, tL_error);
}
}, 10);
return;
}
final TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings = new TLRPC.TL_account_updatePasswordSettings();
if (clear) {
this.doneItem.setVisibility(0);
TLRPC.TL_account_passwordInputSettings tL_account_passwordInputSettings = new TLRPC.TL_account_passwordInputSettings();
tL_account_updatePasswordSettings.new_settings = tL_account_passwordInputSettings;
tL_account_passwordInputSettings.flags = 2;
tL_account_passwordInputSettings.email = "";
tL_account_updatePasswordSettings.password = new TLRPC.TL_inputCheckPasswordEmpty();
str2 = null;
str = null;
} else {
String obj = this.inputFields[0].getText().toString();
if (TextUtils.isEmpty(obj)) {
shakeField(0);
return;
}
if (!obj.equals(this.inputFields[1].getText().toString())) {
try {
Toast.makeText(getParentActivity(), LocaleController.getString("PasswordDoNotMatch", R.string.PasswordDoNotMatch), 0).show();
} catch (Exception e) {
FileLog.e(e);
}
shakeField(1);
return;
}
String obj2 = this.inputFields[2].getText().toString();
if (obj2.length() < 3) {
shakeField(2);
return;
}
int lastIndexOf = obj2.lastIndexOf(46);
int lastIndexOf2 = obj2.lastIndexOf(64);
if (lastIndexOf2 < 0 || lastIndexOf < lastIndexOf2) {
shakeField(2);
return;
}
tL_account_updatePasswordSettings.password = new TLRPC.TL_inputCheckPasswordEmpty();
TLRPC.TL_account_passwordInputSettings tL_account_passwordInputSettings2 = new TLRPC.TL_account_passwordInputSettings();
tL_account_updatePasswordSettings.new_settings = tL_account_passwordInputSettings2;
int i = tL_account_passwordInputSettings2.flags | 1;
tL_account_passwordInputSettings2.flags = i;
tL_account_passwordInputSettings2.hint = "";
tL_account_passwordInputSettings2.new_algo = this.currentPassword.new_algo;
tL_account_passwordInputSettings2.flags = i | 2;
tL_account_passwordInputSettings2.email = obj2.trim();
str = obj;
str2 = obj2;
}
showEditDoneProgress(true, true);
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavePassword$48(clear, str2, str, tL_account_updatePasswordSettings);
}
});
}
public void lambda$sendSavePassword$42(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavePassword$41(tL_error);
}
});
}
public void lambda$sendSavePassword$41(TLRPC.TL_error tL_error) {
String formatPluralString;
showEditDoneProgress(true, false);
if (tL_error == null) {
if (getParentActivity() == null) {
return;
}
Runnable runnable = this.shortPollRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.shortPollRunnable = null;
}
goToNextStep();
return;
}
if (tL_error.text.startsWith("CODE_INVALID")) {
shakeView(this.codeFieldCell);
this.codeFieldCell.setText("", false);
} else {
if (tL_error.text.startsWith("FLOOD_WAIT")) {
int intValue = Utilities.parseInt(tL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, 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$sendSavePassword$47(final boolean z, final String str, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavePassword$46(tL_error, z, tLObject, str);
}
});
}
public void lambda$sendSavePassword$48(final boolean z, final String str, String str2, TLRPC.TL_account_updatePasswordSettings tL_account_updatePasswordSettings) {
RequestDelegate requestDelegate = new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendSavePassword$47(z, str, tLObject, tL_error);
}
};
if (!z) {
byte[] stringBytes = AndroidUtilities.getStringBytes(str2);
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = this.currentPassword.new_algo;
if (tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
tL_account_updatePasswordSettings.new_settings.new_password_hash = SRPHelper.getVBytes(stringBytes, tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow);
if (tL_account_updatePasswordSettings.new_settings.new_password_hash == null) {
TLRPC.TL_error tL_error = new TLRPC.TL_error();
tL_error.text = "ALGO_INVALID";
requestDelegate.run((TLObject) null, tL_error);
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_updatePasswordSettings, requestDelegate, 10);
return;
}
TLRPC.TL_error tL_error2 = new TLRPC.TL_error();
tL_error2.text = "PASSWORD_HASH_INVALID";
requestDelegate.run((TLObject) null, tL_error2);
return;
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_updatePasswordSettings, requestDelegate, 10);
}
public void lambda$sendSavePassword$46(TLRPC.TL_error tL_error, final boolean z, TLObject tLObject, final String str) {
String formatPluralString;
if (tL_error != null && "SRP_ID_INVALID".equals(tL_error.text)) {
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error2) {
PaymentFormActivity.this.lambda$sendSavePassword$44(z, tLObject2, tL_error2);
}
}, 8);
return;
}
showEditDoneProgress(true, false);
if (z) {
TLRPC.account_Password account_password = this.currentPassword;
account_password.has_password = false;
account_password.current_algo = null;
this.delegate.currentPasswordUpdated(account_password);
finishFragment();
return;
}
if (tL_error == null && (tLObject instanceof TLRPC.TL_boolTrue)) {
if (getParentActivity() == null) {
return;
}
goToNextStep();
return;
}
if (tL_error != null) {
if (tL_error.text.equals("EMAIL_UNCONFIRMED") || tL_error.text.startsWith("EMAIL_UNCONFIRMED_")) {
this.emailCodeLength = Utilities.parseInt(tL_error.text).intValue();
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) {
PaymentFormActivity.this.lambda$sendSavePassword$45(str, dialogInterface, i);
}
});
builder.setMessage(LocaleController.getString("YourEmailAlmostThereText", R.string.YourEmailAlmostThereText));
builder.setTitle(LocaleController.getString("YourEmailAlmostThere", R.string.YourEmailAlmostThere));
Dialog showDialog = showDialog(builder.create());
if (showDialog != null) {
showDialog.setCanceledOnTouchOutside(false);
showDialog.setCancelable(false);
return;
}
return;
}
if (tL_error.text.equals("EMAIL_INVALID")) {
showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("PasswordEmailInvalid", R.string.PasswordEmailInvalid));
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$sendSavePassword$44(final boolean z, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavePassword$43(tL_error, tLObject, z);
}
});
}
public void lambda$sendSavePassword$43(TLRPC.TL_error tL_error, TLObject tLObject, boolean z) {
if (tL_error == null) {
TLRPC.account_Password account_password = (TLRPC.account_Password) tLObject;
this.currentPassword = account_password;
TwoStepVerificationActivity.initPasswordNewAlgo(account_password);
sendSavePassword(z);
}
}
public void lambda$sendSavePassword$45(String str, DialogInterface dialogInterface, int i) {
this.waitingForEmail = true;
this.currentPassword.email_unconfirmed_pattern = str;
updatePasswordFields();
}
public final boolean sendCardData() {
Integer num;
Integer num2;
String[] split = this.inputFields[1].getText().toString().split("/");
if (split.length == 2) {
Integer parseInt = Utilities.parseInt(split[0]);
num2 = Utilities.parseInt(split[1]);
num = parseInt;
} else {
num = null;
num2 = null;
}
final Card card = new Card(this.inputFields[0].getText().toString(), num, num2, this.inputFields[3].getText().toString(), this.inputFields[2].getText().toString(), (String) null, (String) null, (String) null, (String) null, this.inputFields[5].getText().toString(), this.inputFields[4].getText().toString(), (String) null);
this.cardName = card.getBrand() + " *" + card.getLast4();
if (!card.validateNumber()) {
shakeField(0);
return false;
}
if (!card.validateExpMonth() || !card.validateExpYear() || !card.validateExpiryDate()) {
shakeField(1);
return false;
}
if (this.need_card_name && this.inputFields[2].length() == 0) {
shakeField(2);
return false;
}
if (!card.validateCVC()) {
shakeField(3);
return false;
}
if (this.need_card_country && this.inputFields[4].length() == 0) {
shakeField(4);
return false;
}
if (this.need_card_postcode && this.inputFields[5].length() == 0) {
shakeField(5);
return false;
}
showEditDoneProgress(true, true);
try {
if ("stripe".equals(this.paymentForm.native_provider)) {
new Stripe(this.providerApiKey).createToken(card, new AnonymousClass25());
} else if ("smartglocal".equals(this.paymentForm.native_provider)) {
new AsyncTask<Object, Object, String>() {
@Override
public java.lang.String doInBackground(java.lang.Object... r13) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PaymentFormActivity.AnonymousClass26.doInBackground(java.lang.Object[]):java.lang.String");
}
@Override
public void onPostExecute(String result) {
if (PaymentFormActivity.this.canceled) {
return;
}
if (result == null) {
AlertsCreator.showSimpleToast(PaymentFormActivity.this, LocaleController.getString("PaymentConnectionFailed", R.string.PaymentConnectionFailed));
} else {
PaymentFormActivity.this.paymentJson = result;
PaymentFormActivity.this.goToNextStep();
}
PaymentFormActivity.this.showEditDoneProgress(true, false);
PaymentFormActivity.this.setDonePressed(false);
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
}
return true;
} catch (Exception e) {
FileLog.e(e);
return true;
}
}
public class AnonymousClass25 implements TokenCallback {
public AnonymousClass25() {
}
public void onSuccess(Token token) {
if (PaymentFormActivity.this.canceled) {
return;
}
PaymentFormActivity.this.paymentJson = String.format(Locale.US, "{\"type\":\"%1$s\", \"id\":\"%2$s\"}", token.getType(), token.getId());
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.AnonymousClass25.this.lambda$onSuccess$0();
}
});
}
public void lambda$onSuccess$0() {
PaymentFormActivity.this.goToNextStep();
PaymentFormActivity.this.showEditDoneProgress(true, false);
PaymentFormActivity.this.setDonePressed(false);
}
public void onError(Exception error) {
if (PaymentFormActivity.this.canceled) {
return;
}
PaymentFormActivity.this.showEditDoneProgress(true, false);
PaymentFormActivity.this.setDonePressed(false);
if ((error instanceof APIConnectionException) || (error instanceof APIException)) {
AlertsCreator.showSimpleToast(PaymentFormActivity.this, LocaleController.getString("PaymentConnectionFailed", R.string.PaymentConnectionFailed));
} else {
AlertsCreator.showSimpleToast(PaymentFormActivity.this, error.getMessage());
}
}
}
public static String getResponseBody(InputStream responseStream) throws IOException {
String next = new Scanner(responseStream, "UTF-8").useDelimiter("\\A").next();
responseStream.close();
return next;
}
public final void sendSavedForm(final Runnable callback) {
if (this.canceled) {
return;
}
showEditDoneProgress(true, true);
TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo = new TLRPC.TL_payments_validateRequestedInfo();
this.validateRequest = tL_payments_validateRequestedInfo;
TLRPC.InputInvoice inputInvoice = this.invoiceInput;
if (inputInvoice != null) {
tL_payments_validateRequestedInfo.invoice = inputInvoice;
} else if (this.messageObject != null) {
TLRPC.TL_inputInvoiceMessage tL_inputInvoiceMessage = new TLRPC.TL_inputInvoiceMessage();
tL_inputInvoiceMessage.peer = getMessagesController().getInputPeer(this.messageObject.messageOwner.peer_id);
tL_inputInvoiceMessage.msg_id = this.messageObject.getId();
this.validateRequest.invoice = tL_inputInvoiceMessage;
} else {
TLRPC.TL_inputInvoiceSlug tL_inputInvoiceSlug = new TLRPC.TL_inputInvoiceSlug();
tL_inputInvoiceSlug.slug = this.invoiceSlug;
this.validateRequest.invoice = tL_inputInvoiceSlug;
}
final TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo2 = this.validateRequest;
tL_payments_validateRequestedInfo2.save = true;
tL_payments_validateRequestedInfo2.info = this.paymentForm.saved_info;
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_payments_validateRequestedInfo2, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendSavedForm$51(callback, tL_payments_validateRequestedInfo2, tLObject, tL_error);
}
}, 2);
}
public void lambda$sendSavedForm$51(final Runnable runnable, final TLObject tLObject, final TLObject tLObject2, final TLRPC.TL_error tL_error) {
if (tLObject2 instanceof TLRPC.TL_payments_validatedRequestedInfo) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavedForm$49(tLObject2, runnable);
}
});
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendSavedForm$50(tL_error, tLObject);
}
});
}
}
public void lambda$sendSavedForm$49(TLObject tLObject, Runnable runnable) {
this.requestedInfo = (TLRPC.TL_payments_validatedRequestedInfo) tLObject;
runnable.run();
setDonePressed(false);
showEditDoneProgress(true, false);
}
public void lambda$sendSavedForm$50(TLRPC.TL_error tL_error, TLObject tLObject) {
setDonePressed(false);
showEditDoneProgress(true, false);
if (tL_error != null) {
AlertsCreator.processError(((BaseFragment) this).currentAccount, tL_error, this, tLObject, new Object[0]);
}
}
public final void sendForm() {
if (this.canceled) {
return;
}
showEditDoneProgress(true, true);
TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo = new TLRPC.TL_payments_validateRequestedInfo();
this.validateRequest = tL_payments_validateRequestedInfo;
TLRPC.InputInvoice inputInvoice = this.invoiceInput;
if (inputInvoice != null) {
tL_payments_validateRequestedInfo.invoice = inputInvoice;
} else if (this.messageObject != null) {
TLRPC.TL_inputInvoiceMessage tL_inputInvoiceMessage = new TLRPC.TL_inputInvoiceMessage();
tL_inputInvoiceMessage.peer = getMessagesController().getInputPeer(this.messageObject.messageOwner.peer_id);
tL_inputInvoiceMessage.msg_id = this.messageObject.getId();
this.validateRequest.invoice = tL_inputInvoiceMessage;
} else {
TLRPC.TL_inputInvoiceSlug tL_inputInvoiceSlug = new TLRPC.TL_inputInvoiceSlug();
tL_inputInvoiceSlug.slug = this.invoiceSlug;
this.validateRequest.invoice = tL_inputInvoiceSlug;
}
TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo2 = this.validateRequest;
tL_payments_validateRequestedInfo2.save = this.saveShippingInfo;
tL_payments_validateRequestedInfo2.info = new TLRPC.TL_paymentRequestedInfo();
if (this.paymentForm.invoice.name_requested) {
this.validateRequest.info.name = this.inputFields[6].getText().toString();
this.validateRequest.info.flags |= 1;
}
if (this.paymentForm.invoice.phone_requested) {
this.validateRequest.info.phone = "+" + this.inputFields[8].getText().toString() + this.inputFields[9].getText().toString();
TLRPC.TL_paymentRequestedInfo tL_paymentRequestedInfo = this.validateRequest.info;
tL_paymentRequestedInfo.flags = tL_paymentRequestedInfo.flags | 2;
}
if (this.paymentForm.invoice.email_requested) {
this.validateRequest.info.email = this.inputFields[7].getText().toString().trim();
this.validateRequest.info.flags |= 4;
}
if (this.paymentForm.invoice.shipping_address_requested) {
this.validateRequest.info.shipping_address = new TLRPC.TL_postAddress();
this.validateRequest.info.shipping_address.street_line1 = this.inputFields[0].getText().toString();
this.validateRequest.info.shipping_address.street_line2 = this.inputFields[1].getText().toString();
this.validateRequest.info.shipping_address.city = this.inputFields[2].getText().toString();
this.validateRequest.info.shipping_address.state = this.inputFields[3].getText().toString();
TLRPC.TL_postAddress tL_postAddress = this.validateRequest.info.shipping_address;
String str = this.countryName;
if (str == null) {
str = "";
}
tL_postAddress.country_iso2 = str;
tL_postAddress.post_code = this.inputFields[5].getText().toString();
this.validateRequest.info.flags |= 8;
}
final TLRPC.TL_payments_validateRequestedInfo tL_payments_validateRequestedInfo3 = this.validateRequest;
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(this.validateRequest, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendForm$55(tL_payments_validateRequestedInfo3, tLObject, tL_error);
}
}, 2);
}
public void lambda$sendForm$55(final TLObject tLObject, final TLObject tLObject2, final TLRPC.TL_error tL_error) {
if (tLObject2 instanceof TLRPC.TL_payments_validatedRequestedInfo) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendForm$53(tLObject2);
}
});
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendForm$54(tL_error, tLObject);
}
});
}
}
public void lambda$sendForm$53(TLObject tLObject) {
this.requestedInfo = (TLRPC.TL_payments_validatedRequestedInfo) tLObject;
if (this.paymentForm.saved_info != null && !this.saveShippingInfo) {
TLRPC.TL_payments_clearSavedInfo tL_payments_clearSavedInfo = new TLRPC.TL_payments_clearSavedInfo();
tL_payments_clearSavedInfo.info = true;
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_payments_clearSavedInfo, new RequestDelegate() {
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error) {
PaymentFormActivity.lambda$sendForm$52(tLObject2, tL_error);
}
});
}
goToNextStep();
setDonePressed(false);
showEditDoneProgress(true, false);
}
public void lambda$sendForm$54(TLRPC.TL_error tL_error, TLObject tLObject) {
setDonePressed(false);
showEditDoneProgress(true, false);
if (tL_error != null) {
String str = tL_error.text;
str.hashCode();
switch (str) {
case "ADDRESS_CITY_INVALID":
shakeField(2);
break;
case "ADDRESS_STREET_LINE1_INVALID":
shakeField(0);
break;
case "ADDRESS_COUNTRY_INVALID":
shakeField(4);
break;
case "REQ_INFO_NAME_INVALID":
shakeField(6);
break;
case "ADDRESS_POSTCODE_INVALID":
shakeField(5);
break;
case "ADDRESS_STATE_INVALID":
shakeField(3);
break;
case "REQ_INFO_PHONE_INVALID":
shakeField(9);
break;
case "ADDRESS_STREET_LINE2_INVALID":
shakeField(1);
break;
case "REQ_INFO_EMAIL_INVALID":
shakeField(7);
break;
default:
AlertsCreator.processError(((BaseFragment) this).currentAccount, tL_error, this, tLObject, new Object[0]);
break;
}
}
}
public final void sendData() {
String str;
if (this.canceled) {
return;
}
showEditDoneProgress(false, true);
final TLRPC.TL_payments_sendPaymentForm tL_payments_sendPaymentForm = new TLRPC.TL_payments_sendPaymentForm();
TLRPC.InputInvoice inputInvoice = this.invoiceInput;
if (inputInvoice != null) {
tL_payments_sendPaymentForm.invoice = inputInvoice;
} else if (this.messageObject != null) {
TLRPC.TL_inputInvoiceMessage tL_inputInvoiceMessage = new TLRPC.TL_inputInvoiceMessage();
tL_inputInvoiceMessage.peer = getMessagesController().getInputPeer(this.messageObject.messageOwner.peer_id);
tL_inputInvoiceMessage.msg_id = this.messageObject.getId();
tL_payments_sendPaymentForm.invoice = tL_inputInvoiceMessage;
} else {
TLRPC.TL_inputInvoiceSlug tL_inputInvoiceSlug = new TLRPC.TL_inputInvoiceSlug();
tL_inputInvoiceSlug.slug = this.invoiceSlug;
tL_payments_sendPaymentForm.invoice = tL_inputInvoiceSlug;
}
tL_payments_sendPaymentForm.form_id = this.paymentForm.form_id;
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null && this.savedCredentialsCard != null) {
TLRPC.TL_inputPaymentCredentialsSaved tL_inputPaymentCredentialsSaved = new TLRPC.TL_inputPaymentCredentialsSaved();
tL_payments_sendPaymentForm.credentials = tL_inputPaymentCredentialsSaved;
((TLRPC.InputPaymentCredentials) tL_inputPaymentCredentialsSaved).id = this.savedCredentialsCard.id;
((TLRPC.InputPaymentCredentials) tL_inputPaymentCredentialsSaved).tmp_password = UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword.tmp_password;
} else {
TLRPC.TL_inputPaymentCredentialsGooglePay tL_inputPaymentCredentialsGooglePay = this.googlePayCredentials;
if (tL_inputPaymentCredentialsGooglePay != null) {
tL_payments_sendPaymentForm.credentials = tL_inputPaymentCredentialsGooglePay;
} else {
TLRPC.TL_inputPaymentCredentials tL_inputPaymentCredentials = new TLRPC.TL_inputPaymentCredentials();
tL_payments_sendPaymentForm.credentials = tL_inputPaymentCredentials;
((TLRPC.InputPaymentCredentials) tL_inputPaymentCredentials).save = this.saveCardInfo;
((TLRPC.InputPaymentCredentials) tL_inputPaymentCredentials).data = new TLRPC.TL_dataJSON();
tL_payments_sendPaymentForm.credentials.data.data = this.paymentJson;
}
}
TLRPC.TL_payments_validatedRequestedInfo tL_payments_validatedRequestedInfo = this.requestedInfo;
if (tL_payments_validatedRequestedInfo != null && (str = tL_payments_validatedRequestedInfo.id) != null) {
tL_payments_sendPaymentForm.requested_info_id = str;
tL_payments_sendPaymentForm.flags = 1 | tL_payments_sendPaymentForm.flags;
}
TLRPC.TL_shippingOption tL_shippingOption = this.shippingOption;
if (tL_shippingOption != null) {
tL_payments_sendPaymentForm.shipping_option_id = tL_shippingOption.id;
tL_payments_sendPaymentForm.flags |= 2;
}
if ((this.paymentForm.invoice.flags & 256) != 0) {
Long l = this.tipAmount;
tL_payments_sendPaymentForm.tip_amount = l != null ? l.longValue() : 0L;
tL_payments_sendPaymentForm.flags |= 4;
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_payments_sendPaymentForm, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendData$67(tL_payments_sendPaymentForm, tLObject, tL_error);
}
}, 2);
}
public void lambda$sendData$67(final TLRPC.TL_payments_sendPaymentForm tL_payments_sendPaymentForm, final TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tLObject != null) {
if (tLObject instanceof TLRPC.TL_payments_paymentResult) {
TLRPC.Updates updates = ((TLRPC.TL_payments_paymentResult) tLObject).updates;
final TLRPC.Message[] messageArr = new TLRPC.Message[1];
int size = updates.updates.size();
int i = 0;
while (true) {
if (i >= size) {
break;
}
TLRPC.TL_updateNewChannelMessage tL_updateNewChannelMessage = (TLRPC.Update) updates.updates.get(i);
if (tL_updateNewChannelMessage instanceof TLRPC.TL_updateNewMessage) {
messageArr[0] = ((TLRPC.TL_updateNewMessage) tL_updateNewChannelMessage).message;
break;
} else {
if (tL_updateNewChannelMessage instanceof TLRPC.TL_updateNewChannelMessage) {
messageArr[0] = tL_updateNewChannelMessage.message;
break;
}
i++;
}
}
getMessagesController().processUpdates(updates, false);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$59(messageArr);
}
});
return;
}
if (tLObject instanceof TLRPC.TL_payments_paymentVerificationNeeded) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$65(tLObject);
}
});
return;
}
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$66(tL_error, tL_payments_sendPaymentForm);
}
});
}
public void lambda$sendData$59(final TLRPC.Message[] messageArr) {
String formatString;
PaymentFormCallback paymentFormCallback;
PaymentFormCallback paymentFormCallback2;
this.paymentStatusSent = true;
InvoiceStatus invoiceStatus = InvoiceStatus.PAID;
this.invoiceStatus = invoiceStatus;
boolean z = this.invoiceInput instanceof TLRPC.TL_inputInvoiceStars;
if (!z && (paymentFormCallback2 = this.paymentFormCallback) != null) {
paymentFormCallback2.onInvoiceStatusChanged(invoiceStatus);
}
goToNextStep();
if (z && (paymentFormCallback = this.paymentFormCallback) != null) {
paymentFormCallback.onInvoiceStatusChanged(this.invoiceStatus);
}
if (z) {
formatString = LocaleController.formatPluralString("PaymentInfoHintStars", (int) this.invoiceInput.option.stars, new Object[]{this.totalPrice[0]});
} else {
formatString = LocaleController.formatString(R.string.PaymentInfoHint, new Object[]{this.totalPrice[0], this.currentItemName});
}
SpannableStringBuilder replaceTags = AndroidUtilities.replaceTags(formatString);
BaseFragment baseFragment = this.parentFragment;
if (baseFragment instanceof ChatActivity) {
UndoView undoView = ((ChatActivity) baseFragment).getUndoView();
if (undoView != null) {
undoView.showWithAction(0L, 77, replaceTags, messageArr[0], (Runnable) null, (Runnable) null);
return;
}
return;
}
final Bulletin createSimpleBulletin = BulletinFactory.global().createSimpleBulletin(R.raw.payment_success, replaceTags);
if (messageArr[0] != null) {
createSimpleBulletin.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PaymentFormActivity.this.lambda$sendData$58(createSimpleBulletin, messageArr, view);
}
});
}
createSimpleBulletin.show();
}
public void lambda$sendData$58(Bulletin bulletin, TLRPC.Message[] messageArr, View view) {
bulletin.hide();
TLRPC.TL_payments_getPaymentReceipt tL_payments_getPaymentReceipt = new TLRPC.TL_payments_getPaymentReceipt();
tL_payments_getPaymentReceipt.msg_id = messageArr[0].id;
tL_payments_getPaymentReceipt.peer = MessagesController.getInstance(((BaseFragment) this).currentAccount).getInputPeer(messageArr[0].peer_id);
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_payments_getPaymentReceipt, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendData$57(tLObject, tL_error);
}
}, 2);
}
public void lambda$sendData$57(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$56(tLObject);
}
});
}
public void lambda$sendData$56(TLObject tLObject) {
BaseFragment lastFragment;
if (tLObject instanceof TLRPC.TL_payments_paymentReceiptStars) {
StarsIntroActivity.showTransactionSheet(getContext(), ((BaseFragment) this).currentAccount, (TLRPC.TL_payments_paymentReceiptStars) tLObject, getResourceProvider());
return;
}
if (!(tLObject instanceof TLRPC.PaymentReceipt) || (lastFragment = LaunchActivity.getLastFragment()) == null) {
return;
}
BaseFragment$BottomSheetParams baseFragment$BottomSheetParams = new BaseFragment$BottomSheetParams();
baseFragment$BottomSheetParams.transitionFromLeft = true;
baseFragment$BottomSheetParams.allowNestedScroll = false;
lastFragment.showAsSheet(new PaymentFormActivity((TLRPC.PaymentReceipt) tLObject), baseFragment$BottomSheetParams);
}
public void lambda$sendData$65(TLObject tLObject) {
setDonePressed(false);
this.webviewLoading = true;
showEditDoneProgress(true, true);
ContextProgressView contextProgressView = this.progressView;
if (contextProgressView != null) {
contextProgressView.setVisibility(0);
}
ActionBarMenuItem actionBarMenuItem = this.doneItem;
if (actionBarMenuItem != null) {
actionBarMenuItem.setEnabled(false);
this.doneItem.getContentView().setVisibility(4);
}
final INavigationLayout parentLayout = getParentLayout();
final Activity parentActivity = getParentActivity();
getMessagesController().newMessageCallback = new MessagesController.NewMessageCallback() {
public final boolean onMessageReceived(TLRPC.Message message) {
boolean lambda$sendData$64;
lambda$sendData$64 = PaymentFormActivity.this.lambda$sendData$64(parentLayout, parentActivity, message);
return lambda$sendData$64;
}
};
WebView webView = this.webView;
if (webView != null) {
webView.setVisibility(0);
WebView webView2 = this.webView;
String str = ((TLRPC.TL_payments_paymentVerificationNeeded) tLObject).url;
this.webViewUrl = str;
webView2.loadUrl(str);
}
this.paymentStatusSent = true;
InvoiceStatus invoiceStatus = InvoiceStatus.PENDING;
this.invoiceStatus = invoiceStatus;
PaymentFormCallback paymentFormCallback = this.paymentFormCallback;
if (paymentFormCallback != null) {
paymentFormCallback.onInvoiceStatusChanged(invoiceStatus);
}
}
public boolean lambda$sendData$64(final INavigationLayout iNavigationLayout, final Activity activity, final TLRPC.Message message) {
if (MessageObject.getPeerId(message.peer_id) != this.botUser.id || !(message.action instanceof TLRPC.TL_messageActionPaymentSent)) {
return false;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$63(iNavigationLayout, activity, message);
}
});
return true;
}
public void lambda$sendData$63(INavigationLayout iNavigationLayout, Activity activity, final TLRPC.Message message) {
String formatString;
this.paymentStatusSent = true;
InvoiceStatus invoiceStatus = InvoiceStatus.PAID;
this.invoiceStatus = invoiceStatus;
PaymentFormCallback paymentFormCallback = this.paymentFormCallback;
if (paymentFormCallback != null) {
paymentFormCallback.onInvoiceStatusChanged(invoiceStatus);
}
onCheckoutSuccess(iNavigationLayout, activity);
TLRPC.TL_inputInvoiceStars tL_inputInvoiceStars = this.invoiceInput;
if (tL_inputInvoiceStars instanceof TLRPC.TL_inputInvoiceStars) {
formatString = LocaleController.formatPluralString("PaymentInfoHintStars", (int) tL_inputInvoiceStars.option.stars, new Object[]{this.totalPrice[0]});
} else {
formatString = LocaleController.formatString(R.string.PaymentInfoHint, new Object[]{this.totalPrice[0], this.currentItemName});
}
SpannableStringBuilder replaceTags = AndroidUtilities.replaceTags(formatString);
BaseFragment baseFragment = this.parentFragment;
if (baseFragment instanceof ChatActivity) {
UndoView undoView = ((ChatActivity) baseFragment).getUndoView();
if (undoView != null) {
undoView.showWithAction(0L, 77, replaceTags, message, (Runnable) null, (Runnable) null);
return;
}
return;
}
final Bulletin createSimpleBulletin = BulletinFactory.global().createSimpleBulletin(R.raw.payment_success, replaceTags);
if (message != null) {
createSimpleBulletin.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PaymentFormActivity.this.lambda$sendData$62(createSimpleBulletin, message, view);
}
});
}
createSimpleBulletin.show();
}
public void lambda$sendData$62(Bulletin bulletin, TLRPC.Message message, View view) {
bulletin.hide();
TLRPC.TL_payments_getPaymentReceipt tL_payments_getPaymentReceipt = new TLRPC.TL_payments_getPaymentReceipt();
tL_payments_getPaymentReceipt.msg_id = message.id;
tL_payments_getPaymentReceipt.peer = MessagesController.getInstance(((BaseFragment) this).currentAccount).getInputPeer(message.peer_id);
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_payments_getPaymentReceipt, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$sendData$61(tLObject, tL_error);
}
}, 2);
}
public void lambda$sendData$61(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$sendData$60(tLObject);
}
});
}
public void lambda$sendData$60(TLObject tLObject) {
BaseFragment lastFragment;
if (tLObject instanceof TLRPC.TL_payments_paymentReceiptStars) {
StarsIntroActivity.showTransactionSheet(getContext(), ((BaseFragment) this).currentAccount, (TLRPC.TL_payments_paymentReceiptStars) tLObject, getResourceProvider());
return;
}
if (!(tLObject instanceof TLRPC.PaymentReceipt) || (lastFragment = LaunchActivity.getLastFragment()) == null) {
return;
}
BaseFragment$BottomSheetParams baseFragment$BottomSheetParams = new BaseFragment$BottomSheetParams();
baseFragment$BottomSheetParams.transitionFromLeft = true;
baseFragment$BottomSheetParams.allowNestedScroll = false;
lastFragment.showAsSheet(new PaymentFormActivity((TLRPC.PaymentReceipt) tLObject), baseFragment$BottomSheetParams);
}
public void lambda$sendData$66(TLRPC.TL_error tL_error, TLRPC.TL_payments_sendPaymentForm tL_payments_sendPaymentForm) {
AlertsCreator.processError(((BaseFragment) this).currentAccount, tL_error, this, tL_payments_sendPaymentForm, new Object[0]);
setDonePressed(false);
showEditDoneProgress(false, false);
this.paymentStatusSent = true;
InvoiceStatus invoiceStatus = InvoiceStatus.FAILED;
this.invoiceStatus = invoiceStatus;
PaymentFormCallback paymentFormCallback = this.paymentFormCallback;
if (paymentFormCallback != null) {
paymentFormCallback.onInvoiceStatusChanged(invoiceStatus);
}
}
public final void shakeField(int field) {
shakeView(this.inputFields[field]);
}
public final void shakeView(View view) {
try {
view.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
AndroidUtilities.shakeViewSpring(view, 2.5f);
}
public final void setDonePressed(boolean value) {
this.donePressed = value;
this.swipeBackEnabled = !value;
ActionBar actionBar = ((BaseFragment) this).actionBar;
if (actionBar != null && actionBar.getBackButton() != null) {
((BaseFragment) this).actionBar.getBackButton().setEnabled(!this.donePressed);
}
TextDetailSettingsCell[] textDetailSettingsCellArr = this.detailSettingsCell;
if (textDetailSettingsCellArr[0] != null) {
textDetailSettingsCellArr[0].setEnabled(!this.donePressed);
}
}
public boolean isSwipeBackEnabled(MotionEvent event) {
return this.swipeBackEnabled;
}
public final void checkPassword() {
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null && UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword.valid_until < ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).getCurrentTime() + 60) {
UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword = null;
UserConfig.getInstance(((BaseFragment) this).currentAccount).saveConfig(false);
}
if (UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword != null) {
sendData();
return;
}
if (this.inputFields[1].length() == 0) {
try {
this.inputFields[1].performHapticFeedback(3, 2);
} catch (Exception unused) {
}
AndroidUtilities.shakeViewSpring(this.inputFields[1], 2.5f);
return;
}
final String obj = this.inputFields[1].getText().toString();
showEditDoneProgress(true, true);
setDonePressed(true);
final TLRPC.TL_account_getPassword tL_account_getPassword = new TLRPC.TL_account_getPassword();
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_getPassword, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$checkPassword$72(obj, tL_account_getPassword, tLObject, tL_error);
}
}, 2);
}
public void lambda$checkPassword$72(final String str, final TLRPC.TL_account_getPassword tL_account_getPassword, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$checkPassword$71(tL_error, tLObject, str, tL_account_getPassword);
}
});
}
public void lambda$checkPassword$71(TLRPC.TL_error tL_error, TLObject tLObject, String str, TLRPC.TL_account_getPassword tL_account_getPassword) {
if (tL_error == null) {
final TLRPC.account_Password account_password = (TLRPC.account_Password) tLObject;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(account_password, false)) {
AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
return;
} else if (!account_password.has_password) {
this.passwordOk = false;
goToNextStep();
return;
} else {
final byte[] stringBytes = AndroidUtilities.getStringBytes(str);
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$checkPassword$70(account_password, stringBytes);
}
});
return;
}
}
AlertsCreator.processError(((BaseFragment) this).currentAccount, tL_error, this, tL_account_getPassword, new Object[0]);
showEditDoneProgress(true, false);
setDonePressed(false);
}
public void lambda$checkPassword$70(TLRPC.account_Password account_password, byte[] bArr) {
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = account_password.current_algo;
byte[] x = tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow ? SRPHelper.getX(bArr, tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) : null;
final TLRPC.TL_account_getTmpPassword tL_account_getTmpPassword = new TLRPC.TL_account_getTmpPassword();
tL_account_getTmpPassword.period = 1800;
RequestDelegate requestDelegate = new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
PaymentFormActivity.this.lambda$checkPassword$69(tL_account_getTmpPassword, tLObject, tL_error);
}
};
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2 = account_password.current_algo;
if (tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2 instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
TLRPC.TL_inputCheckPasswordSRP startCheck = SRPHelper.startCheck(x, account_password.srp_id, account_password.srp_B, tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2);
tL_account_getTmpPassword.password = startCheck;
if (startCheck == null) {
TLRPC.TL_error tL_error = new TLRPC.TL_error();
tL_error.text = "ALGO_INVALID";
requestDelegate.run((TLObject) null, tL_error);
return;
}
ConnectionsManager.getInstance(((BaseFragment) this).currentAccount).sendRequest(tL_account_getTmpPassword, requestDelegate, 10);
return;
}
TLRPC.TL_error tL_error2 = new TLRPC.TL_error();
tL_error2.text = "PASSWORD_HASH_INVALID";
requestDelegate.run((TLObject) null, tL_error2);
}
public void lambda$checkPassword$69(final TLRPC.TL_account_getTmpPassword tL_account_getTmpPassword, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PaymentFormActivity.this.lambda$checkPassword$68(tLObject, tL_error, tL_account_getTmpPassword);
}
});
}
public void lambda$checkPassword$68(TLObject tLObject, TLRPC.TL_error tL_error, TLRPC.TL_account_getTmpPassword tL_account_getTmpPassword) {
showEditDoneProgress(true, false);
setDonePressed(false);
if (tLObject != null) {
this.passwordOk = true;
UserConfig.getInstance(((BaseFragment) this).currentAccount).tmpPassword = (TLRPC.TL_account_tmpPassword) tLObject;
UserConfig.getInstance(((BaseFragment) this).currentAccount).saveConfig(false);
goToNextStep();
return;
}
if (tL_error.text.equals("PASSWORD_HASH_INVALID")) {
try {
this.inputFields[1].performHapticFeedback(3, 2);
} catch (Exception unused) {
}
AndroidUtilities.shakeViewSpring(this.inputFields[1], 3.25f);
this.inputFields[1].setText("");
return;
}
AlertsCreator.processError(((BaseFragment) this).currentAccount, tL_error, this, tL_account_getTmpPassword, new Object[0]);
}
public final void showEditDoneProgress(final boolean animateDoneItem, final boolean show) {
AnimatorSet animatorSet = this.doneItemAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
if (animateDoneItem && this.doneItem != null) {
AnimatorSet animatorSet2 = new AnimatorSet();
this.doneItemAnimation = animatorSet2;
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 if (this.webView != null) {
animatorSet2.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));
} 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));
if (!isFinishing()) {
this.doneItemAnimation.playTogether(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 (PaymentFormActivity.this.doneItemAnimation == null || !PaymentFormActivity.this.doneItemAnimation.equals(animation)) {
return;
}
if (!show) {
PaymentFormActivity.this.progressView.setVisibility(4);
} else {
PaymentFormActivity.this.doneItem.getContentView().setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (PaymentFormActivity.this.doneItemAnimation == null || !PaymentFormActivity.this.doneItemAnimation.equals(animation)) {
return;
}
PaymentFormActivity.this.doneItemAnimation = null;
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
return;
}
if (this.payTextView != null) {
this.doneItemAnimation = new AnimatorSet();
if (show) {
this.progressViewButton.setVisibility(0);
this.bottomLayout.setEnabled(false);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.payTextView, (Property<TextView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.payTextView, (Property<TextView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.payTextView, (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.payTextView.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.payTextView, (Property<TextView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.payTextView, (Property<TextView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.payTextView, (Property<TextView, Float>) View.ALPHA, 1.0f));
}
this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (PaymentFormActivity.this.doneItemAnimation == null || !PaymentFormActivity.this.doneItemAnimation.equals(animation)) {
return;
}
if (!show) {
PaymentFormActivity.this.progressViewButton.setVisibility(4);
} else {
PaymentFormActivity.this.payTextView.setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (PaymentFormActivity.this.doneItemAnimation == null || !PaymentFormActivity.this.doneItemAnimation.equals(animation)) {
return;
}
PaymentFormActivity.this.doneItemAnimation = null;
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
}
}
public boolean presentFragment(BaseFragment fragment) {
onPresentFragment(fragment);
return super.presentFragment(fragment);
}
public boolean presentFragment(BaseFragment fragment, boolean removeLast) {
onPresentFragment(fragment);
return super.presentFragment(fragment, removeLast);
}
public final void onPresentFragment(BaseFragment fragment) {
AndroidUtilities.hideKeyboard(((BaseFragment) this).fragmentView);
if (fragment instanceof PaymentFormActivity) {
PaymentFormActivity paymentFormActivity = (PaymentFormActivity) fragment;
paymentFormActivity.paymentFormCallback = this.paymentFormCallback;
paymentFormActivity.resourcesProvider = this.resourcesProvider;
paymentFormActivity.needPayAfterTransition = this.needPayAfterTransition;
paymentFormActivity.savedCredentialsCard = this.savedCredentialsCard;
}
}
public boolean onBackPressed() {
if (this.shouldNavigateBack) {
this.webView.loadUrl(this.webViewUrl);
this.shouldNavigateBack = false;
return false;
}
return !this.donePressed;
}
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));
ContextProgressView contextProgressView = this.progressView;
int i3 = Theme.key_contextProgressInner2;
arrayList.add(new ThemeDescription(contextProgressView, 0, null, null, null, null, i3));
ContextProgressView contextProgressView2 = this.progressView;
int i4 = Theme.key_contextProgressOuter2;
arrayList.add(new ThemeDescription(contextProgressView2, 0, null, null, null, null, i4));
arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, i3));
arrayList.add(new ThemeDescription(this.progressViewButton, 0, null, null, null, null, i4));
if (this.inputFields != null) {
for (int i5 = 0; i5 < this.inputFields.length; i5++) {
arrayList.add(new ThemeDescription((View) this.inputFields[i5].getParent(), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.inputFields[i5], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.inputFields[i5], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
}
} else {
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
}
if (this.radioCells != null) {
for (int i6 = 0; i6 < this.radioCells.length; i6++) {
arrayList.add(new ThemeDescription(this.radioCells[i6], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.radioCells[i6], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(this.radioCells[i6], 0, new Class[]{RadioCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.radioCells[i6], ThemeDescription.FLAG_CHECKBOX, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackground));
arrayList.add(new ThemeDescription(this.radioCells[i6], ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackgroundChecked));
}
} else {
arrayList.add(new ThemeDescription((View) null, 0, new Class[]{RadioCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_CHECKBOX, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackground));
arrayList.add(new ThemeDescription((View) null, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackgroundChecked));
}
for (int i7 = 0; i7 < this.headerCell.length; i7++) {
arrayList.add(new ThemeDescription(this.headerCell[i7], ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.headerCell[i7], 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueHeader));
}
for (int i8 = 0; i8 < this.sectionCell.length; i8++) {
arrayList.add(new ThemeDescription(this.sectionCell[i8], ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
}
for (int i9 = 0; i9 < this.bottomCell.length; i9++) {
arrayList.add(new ThemeDescription(this.bottomCell[i9], ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(this.bottomCell[i9], 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText4));
arrayList.add(new ThemeDescription(this.bottomCell[i9], ThemeDescription.FLAG_LINKCOLOR, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteLinkText));
}
for (int i10 = 0; i10 < this.dividers.size(); i10++) {
arrayList.add(new ThemeDescription(this.dividers.get(i10), ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
}
EditTextSettingsCell editTextSettingsCell = this.codeFieldCell;
int i11 = ThemeDescription.FLAG_BACKGROUND;
int i12 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(editTextSettingsCell, i11, null, null, null, null, i12));
int i13 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(this.codeFieldCell, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{EditTextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.codeFieldCell, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[]{EditTextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(this.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, i13));
arrayList.add(new ThemeDescription(this.checkCell1, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.checkCell1, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_switchTrack));
arrayList.add(new ThemeDescription(this.checkCell1, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_switchTrackChecked));
arrayList.add(new ThemeDescription(this.checkCell1, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i12));
arrayList.add(new ThemeDescription(this.checkCell1, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
for (int i14 = 0; i14 < this.settingsCell.length; i14++) {
arrayList.add(new ThemeDescription(this.settingsCell[i14], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.settingsCell[i14], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(this.settingsCell[i14], 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
}
arrayList.add(new ThemeDescription(this.payTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText6));
int i15 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextPriceCell.class}, null, null, null, i15));
int i16 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextPriceCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i16));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextPriceCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i16));
int i17 = Theme.key_windowBackgroundWhiteGrayText2;
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextPriceCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i17));
arrayList.add(new ThemeDescription(this.linearLayout2, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextPriceCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i17));
arrayList.add(new ThemeDescription(this.detailSettingsCell[0], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i15));
arrayList.add(new ThemeDescription(this.detailSettingsCell[0], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
for (int i18 = 1; i18 < this.detailSettingsCell.length; i18++) {
arrayList.add(new ThemeDescription(this.detailSettingsCell[i18], ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.detailSettingsCell[i18], 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.detailSettingsCell[i18], 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
}
PaymentInfoCell paymentInfoCell = this.paymentInfoCell;
int i19 = ThemeDescription.FLAG_BACKGROUND;
int i20 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(paymentInfoCell, i19, null, null, null, null, i20));
int i21 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(this.paymentInfoCell, 0, new Class[]{PaymentInfoCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i21));
arrayList.add(new ThemeDescription(this.paymentInfoCell, 0, new Class[]{PaymentInfoCell.class}, new String[]{"detailTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i21));
arrayList.add(new ThemeDescription(this.paymentInfoCell, 0, new Class[]{PaymentInfoCell.class}, new String[]{"detailExTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i20));
arrayList.add(new ThemeDescription(this.bottomLayout, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
return arrayList;
}
public class BottomFrameLayout extends FrameLayout {
public Paint paint;
public float progress;
public SpringAnimation springAnimation;
public BottomFrameLayout(Context context, TLRPC.PaymentForm paymentForm) {
super(context);
this.paint = new Paint(1);
setWillNotDraw(false);
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawColor(PaymentFormActivity.this.getThemedColor(Theme.key_switchTrackBlue));
this.paint.setColor(PaymentFormActivity.this.getThemedColor(Theme.key_contacts_inviteBackground));
canvas.drawCircle(LocaleController.isRTL ? getWidth() - AndroidUtilities.dp(28.0f) : AndroidUtilities.dp(28.0f), -AndroidUtilities.dp(28.0f), Math.max(getWidth(), getHeight()) * this.progress, this.paint);
}
public void setChecked(boolean checked, boolean animated) {
SpringAnimation springAnimation = this.springAnimation;
if (springAnimation != null) {
springAnimation.cancel();
}
float f = checked ? 1.0f : 0.0f;
if (!animated) {
this.progress = f;
if (PaymentFormActivity.this.payTextView != null) {
PaymentFormActivity.this.payTextView.setAlpha((this.progress * 0.2f) + 0.8f);
}
invalidate();
return;
}
if (this.progress == f) {
return;
}
SpringAnimation spring = new SpringAnimation(new FloatValueHolder(this.progress * 100.0f)).setSpring(new SpringForce(f * 100.0f).setStiffness(checked ? 500.0f : 650.0f).setDampingRatio(1.0f));
this.springAnimation = spring;
spring.addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener() {
public final void onAnimationUpdate(DynamicAnimation dynamicAnimation, float f2, float f3) {
PaymentFormActivity.BottomFrameLayout.this.lambda$setChecked$0(dynamicAnimation, f2, f3);
}
});
this.springAnimation.addEndListener(new DynamicAnimation.OnAnimationEndListener() {
public final void onAnimationEnd(DynamicAnimation dynamicAnimation, boolean z, float f2, float f3) {
PaymentFormActivity.BottomFrameLayout.this.lambda$setChecked$1(dynamicAnimation, z, f2, f3);
}
});
this.springAnimation.start();
}
public void lambda$setChecked$0(DynamicAnimation dynamicAnimation, float f, float f2) {
this.progress = f / 100.0f;
if (PaymentFormActivity.this.payTextView != null) {
PaymentFormActivity.this.payTextView.setAlpha((this.progress * 0.2f) + 0.8f);
}
invalidate();
}
public void lambda$setChecked$1(DynamicAnimation dynamicAnimation, boolean z, float f, float f2) {
if (dynamicAnimation == this.springAnimation) {
this.springAnimation = null;
}
}
}
}