正在查看: Crafto v9.3.3 应用的 PaymentSheetActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 PaymentSheetActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.paymentsheet;
import P0.g2;
import android.app.Application;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.compose.runtime.Composer;
import androidx.compose.ui.platform.AbstractComposeView;
import androidx.compose.ui.platform.ComposeView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.E;
import androidx.lifecycle.J;
import androidx.lifecycle.Q;
import androidx.lifecycle.T;
import androidx.lifecycle.u0;
import androidx.lifecycle.v0;
import androidx.lifecycle.x0;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherContract;
import com.stripe.android.link.ui.LinkButtonView;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetContract;
import com.stripe.android.paymentsheet.PaymentSheetResult;
import com.stripe.android.paymentsheet.PaymentSheetViewModel;
import com.stripe.android.paymentsheet.databinding.ActivityPaymentSheetBinding;
import com.stripe.android.paymentsheet.model.FragmentConfig;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.model.PaymentSheetViewState;
import com.stripe.android.paymentsheet.ui.AnimationConstants;
import com.stripe.android.paymentsheet.ui.BaseSheetActivity;
import com.stripe.android.paymentsheet.ui.GooglePayButton;
import com.stripe.android.paymentsheet.ui.GooglePayDividerKt;
import com.stripe.android.paymentsheet.ui.PrimaryButton;
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel;
import com.stripe.android.ui.core.Amount;
import com.stripe.android.ui.core.PaymentsColors;
import com.stripe.android.ui.core.PaymentsShapes;
import com.stripe.android.ui.core.PaymentsThemeKt;
import com.stripe.android.ui.core.PaymentsTypography;
import com.stripe.android.ui.core.forms.resources.LpmRepository;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import org.jetbrains.annotations.NotNull;
import w0.V;
@Metadata
public final class PaymentSheetActivity extends BaseSheetActivity<PaymentSheetResult> {
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
public static final String EXTRA_FRAGMENT_CONFIG = "com.stripe.android.paymentsheet.extra_fragment_config";
@NotNull
public static final String EXTRA_STARTER_ARGS = "com.stripe.android.paymentsheet.extra_starter_args";
@NotNull
private final Hk.k appbar$delegate;
@NotNull
private final Hk.k bottomSheet$delegate;
@NotNull
private final Hk.k bottomSpacer$delegate;
@NotNull
private final Hk.k buttonContainer$delegate;
@NotNull
private final Function1<PaymentSheetViewState, Unit> buyButtonStateObserver;
@NotNull
private final Hk.k fragmentContainerParent$delegate;
@NotNull
private final Hk.k googlePayButton$delegate;
@NotNull
private final Hk.k googlePayDivider$delegate;
@NotNull
private final Hk.k header$delegate;
@NotNull
private final Hk.k linkAuthView$delegate;
@NotNull
private final Hk.k linkButton$delegate;
@NotNull
private final Hk.k messageView$delegate;
@NotNull
private final Hk.k notesView$delegate;
@NotNull
private final Hk.k primaryButton$delegate;
@NotNull
private final Hk.k rootView$delegate;
@NotNull
private final Hk.k scrollView$delegate;
@NotNull
private final Hk.k starterArgs$delegate;
@NotNull
private final Hk.k testModeIndicator$delegate;
@NotNull
private final Hk.k toolbar$delegate;
@NotNull
private final Hk.k topContainer$delegate;
@NotNull
private final Hk.k topMessage$delegate;
@NotNull
private final Hk.k viewBinding$delegate = Hk.l.b(new Function0<ActivityPaymentSheetBinding>() {
{
super(0);
}
@NotNull
public final ActivityPaymentSheetBinding m639invoke() {
return ActivityPaymentSheetBinding.inflate(PaymentSheetActivity.this.getLayoutInflater());
}
});
@NotNull
private final Hk.k viewModel$delegate;
@NotNull
private v0.b viewModelFactory;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public PaymentSheetActivity() {
Function0<Application> function0 = new Function0<Application>() {
{
super(0);
}
@NotNull
public final Application m641invoke() {
Application application = PaymentSheetActivity.this.getApplication();
Intrinsics.checkNotNullExpressionValue(application, "application");
return application;
}
};
Function0<PaymentSheetContract.Args> function02 = new Function0<PaymentSheetContract.Args>() {
{
super(0);
}
@NotNull
public final PaymentSheetContract.Args m642invoke() {
PaymentSheetContract.Args starterArgs;
starterArgs = PaymentSheetActivity.this.getStarterArgs();
if (starterArgs != null) {
return starterArgs;
}
throw new IllegalArgumentException("Required value was null.".toString());
}
};
Intent intent = getIntent();
this.viewModelFactory = new PaymentSheetViewModel.Factory(function0, function02, this, intent != null ? intent.getExtras() : null);
this.viewModel$delegate = new u0(Reflection.getOrCreateKotlinClass(PaymentSheetViewModel.class), new Function0<x0>() {
{
super(0);
}
@NotNull
public final x0 m617invoke() {
x0 viewModelStore = this.getViewModelStore();
Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
return viewModelStore;
}
}, new Function0<v0.b>() {
{
super(0);
}
@NotNull
public final v0.b m640invoke() {
return PaymentSheetActivity.this.getViewModelFactory$paymentsheet_release();
}
});
this.starterArgs$delegate = Hk.l.b(new Function0<PaymentSheetContract.Args>() {
{
super(0);
}
public final PaymentSheetContract.Args m634invoke() {
PaymentSheetContract.Args.Companion companion = PaymentSheetContract.Args.Companion;
Intent intent2 = PaymentSheetActivity.this.getIntent();
Intrinsics.checkNotNullExpressionValue(intent2, "intent");
return companion.fromIntent$paymentsheet_release(intent2);
}
});
this.rootView$delegate = Hk.l.b(new Function0<CoordinatorLayout>() {
{
super(0);
}
@NotNull
public final CoordinatorLayout m632invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().getRoot();
}
});
this.bottomSheet$delegate = Hk.l.b(new Function0<LinearLayout>() {
{
super(0);
}
@NotNull
public final LinearLayout m619invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().bottomSheet;
}
});
this.appbar$delegate = Hk.l.b(new Function0<AppBarLayout>() {
{
super(0);
}
@NotNull
public final AppBarLayout m618invoke() {
AppBarLayout appBarLayout = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().appbar;
Intrinsics.checkNotNullExpressionValue(appBarLayout, "viewBinding.appbar");
return appBarLayout;
}
});
this.linkAuthView$delegate = Hk.l.b(new Function0<ComposeView>() {
{
super(0);
}
@NotNull
public final ComposeView m626invoke() {
ComposeView composeView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().linkAuth;
Intrinsics.checkNotNullExpressionValue(composeView, "viewBinding.linkAuth");
return composeView;
}
});
this.toolbar$delegate = Hk.l.b(new Function0<MaterialToolbar>() {
{
super(0);
}
@NotNull
public final MaterialToolbar m636invoke() {
MaterialToolbar materialToolbar = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().toolbar;
Intrinsics.checkNotNullExpressionValue(materialToolbar, "viewBinding.toolbar");
return materialToolbar;
}
});
this.testModeIndicator$delegate = Hk.l.b(new Function0<TextView>() {
{
super(0);
}
@NotNull
public final TextView m635invoke() {
TextView textView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().testmode;
Intrinsics.checkNotNullExpressionValue(textView, "viewBinding.testmode");
return textView;
}
});
this.scrollView$delegate = Hk.l.b(new Function0<ScrollView>() {
{
super(0);
}
@NotNull
public final ScrollView m633invoke() {
ScrollView scrollView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().scrollView;
Intrinsics.checkNotNullExpressionValue(scrollView, "viewBinding.scrollView");
return scrollView;
}
});
this.header$delegate = Hk.l.b(new Function0<ComposeView>() {
{
super(0);
}
@NotNull
public final ComposeView m625invoke() {
ComposeView composeView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().header;
Intrinsics.checkNotNullExpressionValue(composeView, "viewBinding.header");
return composeView;
}
});
this.fragmentContainerParent$delegate = Hk.l.b(new Function0<LinearLayout>() {
{
super(0);
}
@NotNull
public final LinearLayout m622invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().fragmentContainerParent;
}
});
this.messageView$delegate = Hk.l.b(new Function0<TextView>() {
{
super(0);
}
@NotNull
public final TextView m628invoke() {
TextView textView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().message;
Intrinsics.checkNotNullExpressionValue(textView, "viewBinding.message");
return textView;
}
});
this.notesView$delegate = Hk.l.b(new Function0<ComposeView>() {
{
super(0);
}
@NotNull
public final ComposeView m629invoke() {
ComposeView composeView = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().notes;
Intrinsics.checkNotNullExpressionValue(composeView, "viewBinding.notes");
return composeView;
}
});
this.primaryButton$delegate = Hk.l.b(new Function0<PrimaryButton>() {
{
super(0);
}
@NotNull
public final PrimaryButton m631invoke() {
PrimaryButton primaryButton = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().buyButton;
Intrinsics.checkNotNullExpressionValue(primaryButton, "viewBinding.buyButton");
return primaryButton;
}
});
this.bottomSpacer$delegate = Hk.l.b(new Function0<View>() {
{
super(0);
}
@NotNull
public final View m620invoke() {
View view = PaymentSheetActivity.this.getViewBinding$paymentsheet_release().bottomSpacer;
Intrinsics.checkNotNullExpressionValue(view, "viewBinding.bottomSpacer");
return view;
}
});
this.buttonContainer$delegate = Hk.l.b(new Function0<FrameLayout>() {
{
super(0);
}
@NotNull
public final FrameLayout m621invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().buttonContainer;
}
});
this.topContainer$delegate = Hk.l.b(new Function0<LinearLayout>() {
{
super(0);
}
@NotNull
public final LinearLayout m637invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().topContainer;
}
});
this.googlePayButton$delegate = Hk.l.b(new Function0<GooglePayButton>() {
{
super(0);
}
@NotNull
public final GooglePayButton m623invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().googlePayButton;
}
});
this.linkButton$delegate = Hk.l.b(new Function0<LinkButtonView>() {
{
super(0);
}
@NotNull
public final LinkButtonView m627invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().linkButton;
}
});
this.topMessage$delegate = Hk.l.b(new Function0<TextView>() {
{
super(0);
}
@NotNull
public final TextView m638invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().topMessage;
}
});
this.googlePayDivider$delegate = Hk.l.b(new Function0<ComposeView>() {
{
super(0);
}
@NotNull
public final ComposeView m624invoke() {
return PaymentSheetActivity.this.getViewBinding$paymentsheet_release().googlePayDivider;
}
});
this.buyButtonStateObserver = new Function1<PaymentSheetViewState, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((PaymentSheetViewState) obj);
return Unit.a;
}
public final void invoke(PaymentSheetViewState paymentSheetViewState) {
PaymentSheetActivity paymentSheetActivity = PaymentSheetActivity.this;
paymentSheetActivity.updateErrorMessage(paymentSheetActivity.getMessageView(), paymentSheetViewState != null ? paymentSheetViewState.getErrorMessage() : null);
PaymentSheetActivity.this.getViewBinding$paymentsheet_release().buyButton.updateState(paymentSheetViewState != null ? PaymentSheetViewModelKt.convert(paymentSheetViewState) : null);
}
};
}
private final ViewGroup getButtonContainer() {
Object value = this.buttonContainer$delegate.getValue();
Intrinsics.checkNotNullExpressionValue(value, "<get-buttonContainer>(...)");
return (ViewGroup) value;
}
private final int getFragmentContainerId() {
return getViewBinding$paymentsheet_release().fragmentContainer.getId();
}
private final GooglePayButton getGooglePayButton() {
return (GooglePayButton) this.googlePayButton$delegate.getValue();
}
private final ComposeView getGooglePayDivider() {
return (ComposeView) this.googlePayDivider$delegate.getValue();
}
private final LinkButtonView getLinkButton() {
return (LinkButtonView) this.linkButton$delegate.getValue();
}
public final PaymentSheetContract.Args getStarterArgs() {
return (PaymentSheetContract.Args) this.starterArgs$delegate.getValue();
}
private final LinearLayout getTopContainer() {
return (LinearLayout) this.topContainer$delegate.getValue();
}
private final TextView getTopMessage() {
return (TextView) this.topMessage$delegate.getValue();
}
public static final void m604onCreate$lambda10(PaymentSheetActivity paymentSheetActivity, PaymentSelection paymentSelection) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
paymentSheetActivity.clearErrorMessages();
paymentSheetActivity.resetPrimaryButtonState();
}
public static final void m605onCreate$lambda11(Function1 function1, PaymentSheetViewState paymentSheetViewState) {
Intrinsics.checkNotNullParameter(function1, "$tmp0");
function1.invoke(paymentSheetViewState);
}
public static final void m606onCreate$lambda5(PaymentSheetActivity paymentSheetActivity, PaymentSheetContract.Args args, BaseSheetViewModel.Event event) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
if (event != null) {
paymentSheetActivity.clearErrorMessages();
PaymentSheetViewModel.TransitionTarget transitionTarget = (PaymentSheetViewModel.TransitionTarget) event.getContentIfNotHandled();
if (transitionTarget != null) {
paymentSheetActivity.onTransitionTarget(transitionTarget, Q1.c.a(new Pair[]{new Pair("com.stripe.android.paymentsheet.extra_starter_args", args), new Pair("com.stripe.android.paymentsheet.extra_fragment_config", transitionTarget.getFragmentConfig())}));
}
}
}
public static final void m607onCreate$lambda6(PaymentSheetActivity paymentSheetActivity, BaseSheetViewModel.Event event) {
PaymentSheetViewModel.TransitionTarget addPaymentMethodSheet;
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
FragmentConfig fragmentConfig = (FragmentConfig) event.getContentIfNotHandled();
if (fragmentConfig != null) {
List fragments = paymentSheetActivity.getSupportFragmentManager().getFragments();
Intrinsics.checkNotNullExpressionValue(fragments, "supportFragmentManager.fragments");
if (CollectionsKt.firstOrNull(fragments) instanceof PaymentSheetLoadingFragment) {
Collection collection = (Collection) paymentSheetActivity.getViewModel().getPaymentMethods$paymentsheet_release().getValue();
if (collection == null || collection.isEmpty()) {
paymentSheetActivity.getViewModel().updateSelection(null);
addPaymentMethodSheet = new PaymentSheetViewModel.TransitionTarget.AddPaymentMethodSheet(fragmentConfig);
} else {
addPaymentMethodSheet = new PaymentSheetViewModel.TransitionTarget.SelectSavedPaymentMethod(fragmentConfig);
}
paymentSheetActivity.getViewModel().transitionTo(addPaymentMethodSheet);
}
}
}
public static final void m608onCreate$lambda7(PaymentSheetActivity paymentSheetActivity, BaseSheetViewModel.Event event) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
ConfirmStripeIntentParams confirmStripeIntentParams = (ConfirmStripeIntentParams) event.getContentIfNotHandled();
if (confirmStripeIntentParams != null) {
paymentSheetActivity.getWindow().setSoftInputMode(2);
dl.g.b(J.a(paymentSheetActivity), (CoroutineContext) null, (dl.J) null, new PaymentSheetActivity$onCreate$7$1(paymentSheetActivity, confirmStripeIntentParams, null), 3);
}
}
public static final void m609onCreate$lambda8(PaymentSheetActivity paymentSheetActivity, PaymentSheetResult paymentSheetResult) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
Intrinsics.checkNotNullExpressionValue(paymentSheetResult, "it");
paymentSheetActivity.closeSheet(paymentSheetResult);
}
public static final void m610onCreate$lambda9(PaymentSheetActivity paymentSheetActivity, Boolean bool) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
LinkButtonView linkButton = paymentSheetActivity.getLinkButton();
Intrinsics.checkNotNullExpressionValue(bool, "enabled");
linkButton.setEnabled(bool.booleanValue());
paymentSheetActivity.getGooglePayButton().setEnabled(bool.booleanValue());
}
private final void onTransitionTarget(PaymentSheetViewModel.TransitionTarget transitionTarget, Bundle bundle) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
FragmentTransaction beginTransaction = supportFragmentManager.beginTransaction();
Intrinsics.checkNotNullExpressionValue(beginTransaction, "beginTransaction()");
if (transitionTarget instanceof PaymentSheetViewModel.TransitionTarget.AddPaymentMethodFull) {
AnimationConstants animationConstants = AnimationConstants.INSTANCE;
beginTransaction.setCustomAnimations(animationConstants.getFADE_IN(), animationConstants.getFADE_OUT(), animationConstants.getFADE_IN(), animationConstants.getFADE_OUT());
beginTransaction.addToBackStack((String) null);
beginTransaction.replace(getFragmentContainerId(), PaymentSheetAddPaymentMethodFragment.class, bundle);
} else if (transitionTarget instanceof PaymentSheetViewModel.TransitionTarget.SelectSavedPaymentMethod) {
AnimationConstants animationConstants2 = AnimationConstants.INSTANCE;
beginTransaction.setCustomAnimations(animationConstants2.getFADE_IN(), animationConstants2.getFADE_OUT(), animationConstants2.getFADE_IN(), animationConstants2.getFADE_OUT());
beginTransaction.replace(getFragmentContainerId(), PaymentSheetListFragment.class, bundle);
} else if (transitionTarget instanceof PaymentSheetViewModel.TransitionTarget.AddPaymentMethodSheet) {
AnimationConstants animationConstants3 = AnimationConstants.INSTANCE;
beginTransaction.setCustomAnimations(animationConstants3.getFADE_IN(), animationConstants3.getFADE_OUT(), animationConstants3.getFADE_IN(), animationConstants3.getFADE_OUT());
beginTransaction.replace(getFragmentContainerId(), PaymentSheetAddPaymentMethodFragment.class, bundle);
}
beginTransaction.commit();
getButtonContainer().setVisibility(0);
}
public static final void m611resetPrimaryButtonState$lambda13(PaymentSheetActivity paymentSheetActivity, View view) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
paymentSheetActivity.clearErrorMessages();
paymentSheetActivity.getViewModel().checkout(PaymentSheetViewModel.CheckoutIdentifier.SheetBottomBuy);
}
private final void setupGooglePayButton() {
PaymentSheet.Appearance appearance;
PaymentSheet.Colors colors;
PaymentSheet.Configuration config$paymentsheet_release = getViewModel().getConfig$paymentsheet_release();
if (config$paymentsheet_release != null && (appearance = config$paymentsheet_release.getAppearance()) != null && (colors = appearance.getColors(PaymentsThemeKt.isSystemDarkTheme(this))) != null) {
getGooglePayButton().setBackgroundColor(PaymentsThemeKt.shouldUseDarkDynamicColor-8_81llA(V.b(colors.getSurface())));
}
getGooglePayButton().setOnClickListener(new ba.k(this, 1));
getViewModel().getSelection$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m613setupGooglePayButton$lambda19(PaymentSheetActivity.this, (PaymentSelection) obj);
}
});
getViewModel().getButtonStateObservable$paymentsheet_release(PaymentSheetViewModel.CheckoutIdentifier.SheetTopGooglePay).observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m614setupGooglePayButton$lambda20(PaymentSheetActivity.this, (PaymentSheetViewState) obj);
}
});
}
public static final void m612setupGooglePayButton$lambda18(PaymentSheetActivity paymentSheetActivity, View view) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
paymentSheetActivity.getViewModel().setContentVisible(false);
paymentSheetActivity.getViewModel().setLastSelectedPaymentMethod$paymentsheet_release((PaymentSelection) paymentSheetActivity.getViewModel().getSelection$paymentsheet_release().getValue());
paymentSheetActivity.getViewModel().updateSelection(PaymentSelection.GooglePay.INSTANCE);
}
public static final void m613setupGooglePayButton$lambda19(PaymentSheetActivity paymentSheetActivity, PaymentSelection paymentSelection) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
if (Intrinsics.areEqual(paymentSelection, PaymentSelection.GooglePay.INSTANCE)) {
paymentSheetActivity.getViewModel().checkout(PaymentSheetViewModel.CheckoutIdentifier.SheetTopGooglePay);
}
}
public static final void m614setupGooglePayButton$lambda20(PaymentSheetActivity paymentSheetActivity, PaymentSheetViewState paymentSheetViewState) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
if (paymentSheetViewState instanceof PaymentSheetViewState.Reset) {
paymentSheetActivity.getViewModel().updateSelection(paymentSheetActivity.getViewModel().getLastSelectedPaymentMethod$paymentsheet_release());
}
TextView topMessage = paymentSheetActivity.getTopMessage();
Intrinsics.checkNotNullExpressionValue(topMessage, "topMessage");
paymentSheetActivity.updateErrorMessage(topMessage, paymentSheetViewState != null ? paymentSheetViewState.getErrorMessage() : null);
paymentSheetActivity.getGooglePayButton().updateState(paymentSheetViewState != null ? PaymentSheetViewModelKt.convert(paymentSheetViewState) : null);
}
private final void setupTopContainer() {
int i;
setupGooglePayButton();
Resources resources = getResources();
if (getViewModel().getSupportedPaymentMethods$paymentsheet_release().size() == 1) {
List<LpmRepository.SupportedPaymentMethod> supportedPaymentMethods$paymentsheet_release = getViewModel().getSupportedPaymentMethods$paymentsheet_release();
ArrayList arrayList = new ArrayList(kotlin.collections.u.n(supportedPaymentMethods$paymentsheet_release, 10));
Iterator<T> it = supportedPaymentMethods$paymentsheet_release.iterator();
while (it.hasNext()) {
arrayList.add(((LpmRepository.SupportedPaymentMethod) it.next()).getCode());
}
if (arrayList.contains(LpmRepository.Companion.getHardcodedCard().getCode())) {
i = R.string.stripe_paymentsheet_or_pay_with_card;
final String string = resources.getString(i);
Intrinsics.checkNotNullExpressionValue(string, "resources.getString(\n …g\n }\n )");
getViewModel().getShowTopContainer$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m615setupTopContainer$lambda16(PaymentSheetActivity.this, string, (Boolean) obj);
}
});
}
}
i = R.string.stripe_paymentsheet_or_pay_using;
final String string2 = resources.getString(i);
Intrinsics.checkNotNullExpressionValue(string2, "resources.getString(\n …g\n }\n )");
getViewModel().getShowTopContainer$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m615setupTopContainer$lambda16(PaymentSheetActivity.this, string2, (Boolean) obj);
}
});
}
public static final void m615setupTopContainer$lambda16(PaymentSheetActivity paymentSheetActivity, final String str, Boolean bool) {
Intrinsics.checkNotNullParameter(paymentSheetActivity, "this$0");
Intrinsics.checkNotNullParameter(str, "$dividerText");
AbstractComposeView linkButton = paymentSheetActivity.getLinkButton();
Intrinsics.checkNotNullExpressionValue(linkButton, "linkButton");
Object value = paymentSheetActivity.getViewModel().isLinkEnabled$paymentsheet_release().getValue();
Boolean bool2 = Boolean.TRUE;
linkButton.setVisibility(Intrinsics.areEqual(value, bool2) ? 0 : 8);
GooglePayButton googlePayButton = paymentSheetActivity.getGooglePayButton();
Intrinsics.checkNotNullExpressionValue(googlePayButton, "googlePayButton");
googlePayButton.setVisibility(Intrinsics.areEqual(paymentSheetActivity.getViewModel().isGooglePayReady$paymentsheet_release().getValue(), bool2) ? 0 : 8);
LinearLayout topContainer = paymentSheetActivity.getTopContainer();
Intrinsics.checkNotNullExpressionValue(topContainer, "topContainer");
Intrinsics.checkNotNullExpressionValue(bool, "visible");
topContainer.setVisibility(bool.booleanValue() ? 0 : 8);
if (bool.booleanValue()) {
ComposeView googlePayDivider = paymentSheetActivity.getGooglePayDivider();
googlePayDivider.setViewCompositionStrategy(g2.a.a);
googlePayDivider.setContent(new k0.a(-1463347592, true, new Function2<Composer, Integer, Unit>() {
{
super(2);
}
public Object invoke(Object obj, Object obj2) {
invoke((Composer) obj, ((Number) obj2).intValue());
return Unit.a;
}
public final void invoke(Composer composer, int i) {
if ((i & 11) == 2 && composer.i()) {
composer.F();
} else {
final String str2 = str;
PaymentsThemeKt.PaymentsTheme((PaymentsColors) null, (PaymentsShapes) null, (PaymentsTypography) null, k0.b.b(composer, 685839530, new Function2<Composer, Integer, Unit>() {
{
super(2);
}
public Object invoke(Object obj, Object obj2) {
invoke((Composer) obj, ((Number) obj2).intValue());
return Unit.a;
}
public final void invoke(Composer composer2, int i2) {
if ((i2 & 11) == 2 && composer2.i()) {
composer2.F();
} else {
GooglePayDividerKt.GooglePayDividerUi(str2, composer2, 0, 0);
}
}
}), composer, 3072, 7);
}
}
}));
}
}
@Override
public void clearErrorMessages() {
super.clearErrorMessages();
TextView topMessage = getTopMessage();
Intrinsics.checkNotNullExpressionValue(topMessage, "topMessage");
BaseSheetActivity.updateErrorMessage$default(this, topMessage, null, 2, null);
}
@Override
@NotNull
public AppBarLayout getAppbar() {
return (AppBarLayout) this.appbar$delegate.getValue();
}
@Override
@NotNull
public ViewGroup getBottomSheet() {
Object value = this.bottomSheet$delegate.getValue();
Intrinsics.checkNotNullExpressionValue(value, "<get-bottomSheet>(...)");
return (ViewGroup) value;
}
@Override
@NotNull
public View getBottomSpacer() {
return (View) this.bottomSpacer$delegate.getValue();
}
@Override
@NotNull
public ViewGroup getFragmentContainerParent() {
Object value = this.fragmentContainerParent$delegate.getValue();
Intrinsics.checkNotNullExpressionValue(value, "<get-fragmentContainerParent>(...)");
return (ViewGroup) value;
}
@Override
@NotNull
public ComposeView getHeader() {
return (ComposeView) this.header$delegate.getValue();
}
@Override
@NotNull
public ComposeView getLinkAuthView() {
return (ComposeView) this.linkAuthView$delegate.getValue();
}
@Override
@NotNull
public TextView getMessageView() {
return (TextView) this.messageView$delegate.getValue();
}
@Override
@NotNull
public ComposeView getNotesView() {
return (ComposeView) this.notesView$delegate.getValue();
}
@Override
@NotNull
public PrimaryButton getPrimaryButton() {
return (PrimaryButton) this.primaryButton$delegate.getValue();
}
@Override
@NotNull
public ViewGroup getRootView() {
Object value = this.rootView$delegate.getValue();
Intrinsics.checkNotNullExpressionValue(value, "<get-rootView>(...)");
return (ViewGroup) value;
}
@Override
@NotNull
public ScrollView getScrollView() {
return (ScrollView) this.scrollView$delegate.getValue();
}
@Override
@NotNull
public TextView getTestModeIndicator() {
return (TextView) this.testModeIndicator$delegate.getValue();
}
@Override
@NotNull
public MaterialToolbar getToolbar() {
return (MaterialToolbar) this.toolbar$delegate.getValue();
}
@NotNull
public final ActivityPaymentSheetBinding getViewBinding$paymentsheet_release() {
return (ActivityPaymentSheetBinding) this.viewBinding$delegate.getValue();
}
@NotNull
public final v0.b getViewModelFactory$paymentsheet_release() {
return this.viewModelFactory;
}
@Override
public void onCreate(Bundle bundle) {
PaymentSheet.Appearance appearance;
final PaymentSheetContract.Args starterArgs = getStarterArgs();
if (starterArgs == null) {
setActivityResult((PaymentSheetResult) new PaymentSheetResult.Failed(new IllegalArgumentException("PaymentSheet started without arguments.")));
finish();
return;
}
try {
PaymentSheet.Configuration config$paymentsheet_release = starterArgs.getConfig$paymentsheet_release();
if (config$paymentsheet_release != null) {
PaymentSheetConfigurationKtxKt.validate(config$paymentsheet_release);
}
starterArgs.getClientSecret$paymentsheet_release().validate();
PaymentSheet.Configuration config$paymentsheet_release2 = starterArgs.getConfig$paymentsheet_release();
if (config$paymentsheet_release2 != null && (appearance = config$paymentsheet_release2.getAppearance()) != null) {
PaymentSheetConfigurationKtxKt.parseAppearance(appearance);
}
super.onCreate(bundle);
PaymentSheetViewModel viewModel = getViewModel();
E a = J.a(this);
GooglePayPaymentMethodLauncherContract googlePayPaymentMethodLauncherContract = new GooglePayPaymentMethodLauncherContract();
final PaymentSheetViewModel viewModel2 = getViewModel();
i.c<GooglePayPaymentMethodLauncherContract.Args> registerForActivityResult = registerForActivityResult(googlePayPaymentMethodLauncherContract, new i.a() {
public final void onActivityResult(Object obj) {
PaymentSheetViewModel.this.onGooglePayResult$paymentsheet_release((GooglePayPaymentMethodLauncher.Result) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…lePayResult\n )");
viewModel.setupGooglePay(a, registerForActivityResult);
if (!getViewModel().maybeFetchStripeIntent$paymentsheet_release()) {
getButtonContainer().setVisibility(0);
PrimaryButton primaryButton = getViewBinding$paymentsheet_release().buyButton;
Intrinsics.checkNotNullExpressionValue(primaryButton, "viewBinding.buyButton");
primaryButton.setVisibility(0);
}
Integer statusBarColor$paymentsheet_release = starterArgs.getStatusBarColor$paymentsheet_release();
if (statusBarColor$paymentsheet_release != null) {
getWindow().setStatusBarColor(statusBarColor$paymentsheet_release.intValue());
}
setContentView(getViewBinding$paymentsheet_release().getRoot());
getRootView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(@NotNull View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
BottomSheetController bottomSheetController;
Intrinsics.checkNotNullParameter(view, "view");
view.removeOnLayoutChangeListener(this);
bottomSheetController = PaymentSheetActivity.this.getBottomSheetController();
bottomSheetController.expand();
}
});
setupTopContainer();
LinkButtonView linkButton = getLinkButton();
linkButton.setOnClick(new PaymentSheetActivity$onCreate$4$1(getViewModel()));
linkButton.setLinkPaymentLauncher(getViewModel().getLinkLauncher());
getViewModel().getTransition$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m606onCreate$lambda5(PaymentSheetActivity.this, starterArgs, (BaseSheetViewModel.Event) obj);
}
});
getViewModel().getFragmentConfigEvent().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m607onCreate$lambda6(PaymentSheetActivity.this, (BaseSheetViewModel.Event) obj);
}
});
getViewModel().getStartConfirm$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m608onCreate$lambda7(PaymentSheetActivity.this, (BaseSheetViewModel.Event) obj);
}
});
getViewModel().getPaymentSheetResult$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m609onCreate$lambda8(PaymentSheetActivity.this, (PaymentSheetResult) obj);
}
});
getViewModel().getButtonsEnabled().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m610onCreate$lambda9(PaymentSheetActivity.this, (Boolean) obj);
}
});
getViewModel().getSelection$paymentsheet_release().observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m604onCreate$lambda10(PaymentSheetActivity.this, (PaymentSelection) obj);
}
});
Q<PaymentSheetViewState> buttonStateObservable$paymentsheet_release = getViewModel().getButtonStateObservable$paymentsheet_release(PaymentSheetViewModel.CheckoutIdentifier.SheetBottomBuy);
final Function1<PaymentSheetViewState, Unit> function1 = this.buyButtonStateObserver;
buttonStateObservable$paymentsheet_release.observe(this, new T() {
public final void onChanged(Object obj) {
PaymentSheetActivity.m605onCreate$lambda11(function1, (PaymentSheetViewState) obj);
}
});
} catch (InvalidParameterException e) {
setActivityResult((PaymentSheetResult) new PaymentSheetResult.Failed(e));
finish();
}
}
@Override
public void resetPrimaryButtonState() {
String str;
getViewBinding$paymentsheet_release().buyButton.updateState(PrimaryButton.State.Ready.INSTANCE);
if (getViewModel().isProcessingPaymentIntent$paymentsheet_release()) {
PrimaryButton primaryButton = getViewBinding$paymentsheet_release().buyButton;
Amount amount = (Amount) getViewModel().getAmount$paymentsheet_release().getValue();
if (amount != null) {
Resources resources = getResources();
Intrinsics.checkNotNullExpressionValue(resources, "resources");
str = amount.buildPayButtonLabel(resources);
} else {
str = null;
}
primaryButton.setLabel(str);
} else {
getViewBinding$paymentsheet_release().buyButton.setLabel(getResources().getString(R.string.stripe_setup_button_label));
}
getViewBinding$paymentsheet_release().buyButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PaymentSheetActivity.m611resetPrimaryButtonState$lambda13(PaymentSheetActivity.this, view);
}
});
}
public final void setViewModelFactory$paymentsheet_release(@NotNull v0.b bVar) {
Intrinsics.checkNotNullParameter(bVar, "<set-?>");
this.viewModelFactory = bVar;
}
@Override
@NotNull
public PaymentSheetViewModel getViewModel() {
return (PaymentSheetViewModel) this.viewModel$delegate.getValue();
}
@Override
public void setActivityResult(@NotNull PaymentSheetResult paymentSheetResult) {
Intrinsics.checkNotNullParameter(paymentSheetResult, "result");
setResult(-1, new Intent().putExtras(new PaymentSheetContract.Result(paymentSheetResult).toBundle()));
}
public static void getViewBinding$paymentsheet_release$annotations() {
}
public static void getViewModelFactory$paymentsheet_release$annotations() {
}
}