导航菜单

页面标题

页面副标题

Rilo v2.0.21 - PaymentOptionsActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 PaymentOptionsActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.stripe.android.paymentsheet;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.compose.ComponentActivityKt;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionContext;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.common.ui.BottomSheetState;
import com.stripe.android.paymentsheet.PaymentOptionContract;
import com.stripe.android.paymentsheet.PaymentOptionsViewModel;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.state.PaymentSheetState;
import com.stripe.android.paymentsheet.ui.BaseSheetActivity;
import com.stripe.android.uicore.StripeThemeKt;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.flow.FlowCollector;
import kotlinx.coroutines.flow.FlowKt;

@Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\b\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\n\u0010\u0016\u001a\u0004\u0018\u00010\u0005H\u0002J\u0012\u0010\u0017\u001a\u00020\u00182\b\u0010\u0019\u001a\u0004\u0018\u00010\u001aH\u0014J\u0010\u0010\u001b\u001a\u00020\u00182\u0006\u0010\u001c\u001a\u00020\u0002H\u0016R\u001d\u0010\u0004\u001a\u0004\u0018\u00010\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007R\u001b\u0010\n\u001a\u00020\u000b8VX\u0096\u0084\u0002¢\u0006\f\n\u0004\b\u000e\u0010\t\u001a\u0004\b\f\u0010\rR$\u0010\u000f\u001a\u00020\u00108\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u0011\u0010\u0003\u001a\u0004\b\u0012\u0010\u0013\"\u0004\b\u0014\u0010\u0015¨\u0006\u001d²\u0006\n\u0010\u001e\u001a\u00020\u001fX\u008a\u0084\u0002"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentOptionsActivity;", "Lcom/stripe/android/paymentsheet/ui/BaseSheetActivity;", "Lcom/stripe/android/paymentsheet/PaymentOptionResult;", "()V", "starterArgs", "Lcom/stripe/android/paymentsheet/PaymentOptionContract$Args;", "getStarterArgs", "()Lcom/stripe/android/paymentsheet/PaymentOptionContract$Args;", "starterArgs$delegate", "Lkotlin/Lazy;", "viewModel", "Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel;", "getViewModel", "()Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel;", "viewModel$delegate", "viewModelFactory", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelFactory$paymentsheet_release$annotations", "getViewModelFactory$paymentsheet_release", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelFactory$paymentsheet_release", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "initializeStarterArgs", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "setActivityResult", "result", "paymentsheet_release", "isProcessing", ""}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PaymentOptionsActivity extends BaseSheetActivity<PaymentOptionResult> {

    private final Lazy viewModel;
    private ViewModelProvider.Factory viewModelFactory = new PaymentOptionsViewModel.Factory(new Function0<PaymentOptionContract.Args>() {
        {
            super(0);
        }

        public final PaymentOptionContract.Args m298invoke() {
            PaymentOptionContract.Args starterArgs;
            starterArgs = PaymentOptionsActivity.this.getStarterArgs();
            if (starterArgs != null) {
                return starterArgs;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    });

    private final Lazy starterArgs = LazyKt.lazy(new Function0<PaymentOptionContract.Args>() {
        {
            super(0);
        }

        public final PaymentOptionContract.Args m296invoke() {
            PaymentOptionContract.Args.Companion companion = PaymentOptionContract.Args.INSTANCE;
            Intent intent = PaymentOptionsActivity.this.getIntent();
            Intrinsics.checkNotNullExpressionValue(intent, "intent");
            return companion.fromIntent$paymentsheet_release(intent);
        }
    });

    public static void getViewModelFactory$paymentsheet_release$annotations() {
    }

    public PaymentOptionsActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PaymentOptionsViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m293invoke() {
                ViewModelStore viewModelStore = componentActivity.getViewModelStore();
                Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
                return viewModelStore;
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m297invoke() {
                return PaymentOptionsActivity.this.getViewModelFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m294invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                if (function02 != null && (creationExtras = (CreationExtras) function02.invoke()) != null) {
                    return creationExtras;
                }
                CreationExtras defaultViewModelCreationExtras = componentActivity.getDefaultViewModelCreationExtras();
                Intrinsics.checkNotNullExpressionValue(defaultViewModelCreationExtras, "this.defaultViewModelCreationExtras");
                return defaultViewModelCreationExtras;
            }
        });
    }

    public final ViewModelProvider.Factory getViewModelFactory() {
        return this.viewModelFactory;
    }

    public final void setViewModelFactory$paymentsheet_release(ViewModelProvider.Factory factory) {
        Intrinsics.checkNotNullParameter(factory, "<set-?>");
        this.viewModelFactory = factory;
    }

    @Override
    public PaymentOptionsViewModel getViewModel() {
        return (PaymentOptionsViewModel) this.viewModel.getValue();
    }

    public final PaymentOptionContract.Args getStarterArgs() {
        return (PaymentOptionContract.Args) this.starterArgs.getValue();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        PaymentOptionContract.Args initializeStarterArgs = initializeStarterArgs();
        super.onCreate(savedInstanceState);
        if (initializeStarterArgs == null) {
            finish();
        } else {
            ComponentActivityKt.setContent$default((ComponentActivity) this, (CompositionContext) null, ComposableLambdaKt.composableLambdaInstance(-1719713842, true, new Function2<Composer, Integer, Unit>() {
                {
                    super(2);
                }

                @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001H\u000b¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"<anonymous>", "", "invoke", "(Landroidx/compose/runtime/Composer;I)V"}, k = 3, mv = {1, 8, 0}, xi = 48)
                static final class AnonymousClass1 extends Lambda implements Function2<Composer, Integer, Unit> {
                    final PaymentOptionsActivity this$0;

                    AnonymousClass1(PaymentOptionsActivity paymentOptionsActivity) {
                        super(2);
                        this.this$0 = paymentOptionsActivity;
                    }

                    public Object invoke(Object obj, Object obj2) {
                        invoke((Composer) obj, ((Number) obj2).intValue());
                        return Unit.INSTANCE;
                    }

                    public final void invoke(Composer composer, int i2) {
                        if ((i2 & 11) != 2 || !composer.getSkipping()) {
                            if (ComposerKt.isTraceInProgress()) {
                                ComposerKt.traceEventStart(526390752, i2, -1, "com.stripe.android.paymentsheet.PaymentOptionsActivity.onCreate.<anonymous>.<anonymous> (PaymentOptionsActivity.kt:47)");
                            }
                            final State collectAsState = SnapshotStateKt.collectAsState(this.this$0.getViewModel().getProcessing(), (CoroutineContext) null, composer, 8, 1);
                            composer.startReplaceableGroup(1157296644);
                            ComposerKt.sourceInformation(composer, "CC(remember)P(1):Composables.kt#9igjgp");
                            boolean changed = composer.changed(collectAsState);
                            Object rememberedValue = composer.rememberedValue();
                            if (changed || rememberedValue == Composer.Companion.getEmpty()) {
                                rememberedValue = (Function1) 
                                throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentOptionsActivity$onCreate$1.AnonymousClass1.invoke(androidx.compose.runtime.Composer, int):void");
                            }

                            @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48)
                            @DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentOptionsActivity$onCreate$1$1$1", f = "PaymentOptionsActivity.kt", i = {}, l = {56}, m = "invokeSuspend", n = {}, s = {})
                            static final class C00001 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
                                final BottomSheetState $bottomSheetState;
                                int label;
                                final PaymentOptionsActivity this$0;

                                C00001(PaymentOptionsActivity paymentOptionsActivity, BottomSheetState bottomSheetState, Continuation<? super C00001> continuation) {
                                    super(2, continuation);
                                    this.this$0 = paymentOptionsActivity;
                                    this.$bottomSheetState = bottomSheetState;
                                }

                                public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
                                    return new C00001(this.this$0, this.$bottomSheetState, continuation);
                                }

                                public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
                                    return create(coroutineScope, continuation).invokeSuspend(Unit.INSTANCE);
                                }

                                @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u008a@"}, d2 = {"<anonymous>", "", "sheetResult", "Lcom/stripe/android/paymentsheet/PaymentOptionResult;"}, k = 3, mv = {1, 8, 0}, xi = 48)
                                static final class C00011 implements FlowCollector<PaymentOptionResult> {
                                    final BottomSheetState $bottomSheetState;
                                    final PaymentOptionsActivity this$0;

                                    C00011(PaymentOptionsActivity paymentOptionsActivity, BottomSheetState bottomSheetState) {
                                        this.this$0 = paymentOptionsActivity;
                                        this.$bottomSheetState = bottomSheetState;
                                    }

                                    public final java.lang.Object emit(com.stripe.android.paymentsheet.PaymentOptionResult r5, kotlin.coroutines.Continuation<? super kotlin.Unit> r6) {
                                        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentOptionsActivity$onCreate$1.AnonymousClass1.C00001.C00011.emit(com.stripe.android.paymentsheet.PaymentOptionResult, kotlin.coroutines.Continuation):java.lang.Object");
                                    }

                                    public Object emit(Object obj, Continuation continuation) {
                                        return emit((PaymentOptionResult) obj, (Continuation<? super Unit>) continuation);
                                    }
                                }

                                public final Object invokeSuspend(Object obj) {
                                    Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
                                    int i2 = this.label;
                                    if (i2 == 0) {
                                        ResultKt.throwOnFailure(obj);
                                        this.label = 1;
                                        if (FlowKt.filterNotNull(this.this$0.getViewModel().getPaymentOptionResult$paymentsheet_release()).collect(new C00011(this.this$0, this.$bottomSheetState), (Continuation) this) == coroutine_suspended) {
                                            return coroutine_suspended;
                                        }
                                    } else {
                                        if (i2 != 1) {
                                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                        }
                                        ResultKt.throwOnFailure(obj);
                                    }
                                    return Unit.INSTANCE;
                                }
                            }

                            @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
                            class AnonymousClass2 extends FunctionReferenceImpl implements Function0<Unit> {
                                AnonymousClass2(Object obj) {
                                    super(0, obj, PaymentOptionsViewModel.class, "onUserCancel", "onUserCancel()V", 0);
                                }

                                public Object invoke() {
                                    m295invoke();
                                    return Unit.INSTANCE;
                                }

                                public final void m295invoke() {
                                    ((PaymentOptionsViewModel) this.receiver).onUserCancel();
                                }
                            }

                            public static final boolean invoke$lambda$0(State<Boolean> state) {
                                return ((Boolean) state.getValue()).booleanValue();
                            }
                        }

                        public Object invoke(Object obj, Object obj2) {
                            invoke((Composer) obj, ((Number) obj2).intValue());
                            return Unit.INSTANCE;
                        }

                        public final void invoke(Composer composer, int i2) {
                            if ((i2 & 11) != 2 || !composer.getSkipping()) {
                                if (ComposerKt.isTraceInProgress()) {
                                    ComposerKt.traceEventStart(-1719713842, i2, -1, "com.stripe.android.paymentsheet.PaymentOptionsActivity.onCreate.<anonymous> (PaymentOptionsActivity.kt:46)");
                                }
                                StripeThemeKt.StripeTheme(null, null, null, ComposableLambdaKt.composableLambda(composer, 526390752, true, new AnonymousClass1(PaymentOptionsActivity.this)), composer, 3072, 7);
                                if (ComposerKt.isTraceInProgress()) {
                                    ComposerKt.traceEventEnd();
                                    return;
                                }
                                return;
                            }
                            composer.skipToGroupEnd();
                        }
                    }), 1, (Object) null);
                }
            }

            private final PaymentOptionContract.Args initializeStarterArgs() {
                PaymentSheetState.Full state;
                PaymentSheet.Configuration config;
                PaymentSheet.Appearance appearance;
                PaymentOptionContract.Args starterArgs = getStarterArgs();
                if (starterArgs != null && (state = starterArgs.getState()) != null && (config = state.getConfig()) != null && (appearance = config.getAppearance()) != null) {
                    PaymentSheetConfigurationKtxKt.parseAppearance(appearance);
                }
                setEarlyExitDueToIllegalState(getStarterArgs() == null);
                return getStarterArgs();
            }

            @Override
            public void setActivityResult(PaymentOptionResult result) {
                Intrinsics.checkNotNullParameter(result, "result");
                setResult(result.getResultCode(), new Intent().putExtras(result.toBundle()));
            }
        }