导航菜单

页面标题

页面副标题

Rilo v2.0.21 - CustomerSheetActivity.java 源代码

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

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


package com.stripe.android.customersheet;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.compose.BackHandlerKt;
import androidx.activity.compose.ComponentActivityKt;
import androidx.activity.result.ActivityResultCaller;
import androidx.appcompat.app.AppCompatActivity;
import androidx.compose.material.ModalBottomSheetValue;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionContext;
import androidx.compose.runtime.EffectsKt;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.core.view.WindowCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.common.ui.BottomSheetKt;
import com.stripe.android.common.ui.BottomSheetState;
import com.stripe.android.customersheet.CustomerSheetViewAction;
import com.stripe.android.customersheet.CustomerSheetViewModel;
import com.stripe.android.customersheet.ui.CustomerSheetScreenKt;
import com.stripe.android.uicore.StripeColors;
import com.stripe.android.uicore.StripeShapes;
import com.stripe.android.uicore.StripeThemeKt;
import com.stripe.android.uicore.StripeTypography;
import com.stripe.android.utils.AnimationConstants;
import kotlin.Lazy;
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.Reflection;
import kotlin.reflect.KFunction;
import kotlinx.coroutines.CoroutineScope;

@Metadata(d1 = {"\u00008\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\u0006\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0016J\u0010\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0013\u001a\u00020\u0014H\u0002J\u0012\u0010\u0015\u001a\u00020\u00112\b\u0010\u0016\u001a\u0004\u0018\u00010\u0017H\u0014R\u001b\u0010\u0003\u001a\u00020\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006R$\u0010\t\u001a\u00020\n8\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u000b\u0010\u0002\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000f¨\u0006\u0018²\u0006\n\u0010\u0019\u001a\u00020\u001aX\u008a\u0084\u0002²\u0006\f\u0010\u0013\u001a\u0004\u0018\u00010\u0014X\u008a\u0084\u0002"}, d2 = {"Lcom/stripe/android/customersheet/CustomerSheetActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "viewModel", "Lcom/stripe/android/customersheet/CustomerSheetViewModel;", "getViewModel", "()Lcom/stripe/android/customersheet/CustomerSheetViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "viewModelProvider", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelProvider$paymentsheet_release$annotations", "getViewModelProvider$paymentsheet_release", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelProvider$paymentsheet_release", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "finish", "", "finishWithResult", "result", "Lcom/stripe/android/customersheet/InternalCustomerSheetResult;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "paymentsheet_release", "viewState", "Lcom/stripe/android/customersheet/CustomerSheetViewState;"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class CustomerSheetActivity extends AppCompatActivity {

    private final Lazy viewModel;
    private ViewModelProvider.Factory viewModelProvider = CustomerSheetViewModel.Factory.INSTANCE;

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

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

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

            public final ViewModelProvider.Factory m422invoke() {
                return CustomerSheetActivity.this.getViewModelProvider();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m419invoke() {
                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 getViewModelProvider() {
        return this.viewModelProvider;
    }

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

    public final CustomerSheetViewModel getViewModel() {
        return (CustomerSheetViewModel) this.viewModel.getValue();
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
        getViewModel().registerFromActivity((ActivityResultCaller) this, (LifecycleOwner) this);
        ComponentActivityKt.setContent$default((ComponentActivity) this, (CompositionContext) null, ComposableLambdaKt.composableLambdaInstance(602239828, true, new Function2<Composer, Integer, Unit>() {
            {
                super(2);
            }

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

            public final void invoke(Composer composer, int i) {
                if ((i & 11) != 2 || !composer.getSkipping()) {
                    if (ComposerKt.isTraceInProgress()) {
                        ComposerKt.traceEventStart(602239828, i, -1, "com.stripe.android.customersheet.CustomerSheetActivity.onCreate.<anonymous> (CustomerSheetActivity.kt:51)");
                    }
                    final CustomerSheetActivity customerSheetActivity = CustomerSheetActivity.this;
                    StripeThemeKt.StripeTheme((StripeColors) null, (StripeShapes) null, (StripeTypography) null, ComposableLambdaKt.composableLambda(composer, -295136510, true, new Function2<Composer, Integer, Unit>() {
                        {
                            super(2);
                        }

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

                        public final void invoke(Composer composer2, int i2) {
                            CustomerSheetViewModel viewModel;
                            CustomerSheetViewModel viewModel2;
                            if ((i2 & 11) != 2 || !composer2.getSkipping()) {
                                if (ComposerKt.isTraceInProgress()) {
                                    ComposerKt.traceEventStart(-295136510, i2, -1, "com.stripe.android.customersheet.CustomerSheetActivity.onCreate.<anonymous>.<anonymous> (CustomerSheetActivity.kt:52)");
                                }
                                final CustomerSheetActivity customerSheetActivity2 = CustomerSheetActivity.this;
                                BottomSheetState rememberBottomSheetState = BottomSheetKt.rememberBottomSheetState(new Function1<ModalBottomSheetValue, Boolean>() {
                                    {
                                        super(1);
                                    }

                                    public final Boolean invoke(ModalBottomSheetValue modalBottomSheetValue) {
                                        boolean z;
                                        CustomerSheetViewModel viewModel3;
                                        Intrinsics.checkNotNullParameter(modalBottomSheetValue, "it");
                                        if (modalBottomSheetValue == ModalBottomSheetValue.Hidden) {
                                            viewModel3 = CustomerSheetActivity.this.getViewModel();
                                            z = viewModel3.bottomSheetConfirmStateChange();
                                        } else {
                                            z = true;
                                        }
                                        return Boolean.valueOf(z);
                                    }
                                }, composer2, 0, 0);
                                viewModel = CustomerSheetActivity.this.getViewModel();
                                final State collectAsState = SnapshotStateKt.collectAsState(viewModel.getViewState(), (CoroutineContext) null, composer2, 8, 1);
                                viewModel2 = CustomerSheetActivity.this.getViewModel();
                                State collectAsState2 = SnapshotStateKt.collectAsState(viewModel2.getResult(), (CoroutineContext) null, composer2, 8, 1);
                                EffectsKt.LaunchedEffect(invoke$lambda$1(collectAsState2), new C00131(collectAsState2, rememberBottomSheetState, CustomerSheetActivity.this, null), composer2, 72);
                                final CustomerSheetActivity customerSheetActivity3 = CustomerSheetActivity.this;
                                BackHandlerKt.BackHandler(false, new Function0<Unit>() {
                                    {
                                        super(0);
                                    }

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

                                    public final void m420invoke() {
                                        CustomerSheetViewModel viewModel3;
                                        viewModel3 = CustomerSheetActivity.this.getViewModel();
                                        viewModel3.handleViewAction(CustomerSheetViewAction.OnBackPressed.INSTANCE);
                                    }
                                }, composer2, 0, 1);
                                final CustomerSheetActivity customerSheetActivity4 = CustomerSheetActivity.this;
                                Function0<Unit> function0 = new Function0<Unit>() {
                                    {
                                        super(0);
                                    }

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

                                    public final void m421invoke() {
                                        CustomerSheetViewModel viewModel3;
                                        viewModel3 = CustomerSheetActivity.this.getViewModel();
                                        viewModel3.handleViewAction(CustomerSheetViewAction.OnDismissed.INSTANCE);
                                    }
                                };
                                final CustomerSheetActivity customerSheetActivity5 = CustomerSheetActivity.this;
                                BottomSheetKt.BottomSheet(rememberBottomSheetState, null, function0, ComposableLambdaKt.composableLambda(composer2, -472699748, true, new Function2<Composer, Integer, Unit>() {
                                    {
                                        super(2);
                                    }

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

                                    public final void invoke(Composer composer3, int i3) {
                                        CustomerSheetViewModel viewModel3;
                                        CustomerSheetViewModel viewModel4;
                                        CustomerSheetViewModel viewModel5;
                                        if ((i3 & 11) != 2 || !composer3.getSkipping()) {
                                            if (ComposerKt.isTraceInProgress()) {
                                                ComposerKt.traceEventStart(-472699748, i3, -1, "com.stripe.android.customersheet.CustomerSheetActivity.onCreate.<anonymous>.<anonymous>.<anonymous> (CustomerSheetActivity.kt:80)");
                                            }
                                            CustomerSheetViewState invoke$lambda$0 = AnonymousClass1.invoke$lambda$0(collectAsState);
                                            viewModel3 = CustomerSheetActivity.this.getViewModel();
                                            Function1 function1 = (KFunction) new C00141(viewModel3);
                                            viewModel4 = CustomerSheetActivity.this.getViewModel();
                                            Function1 function12 = (KFunction) new AnonymousClass2(viewModel4);
                                            viewModel5 = CustomerSheetActivity.this.getViewModel();
                                            CustomerSheetScreenKt.CustomerSheetScreen(invoke$lambda$0, viewModel5.getFormViewModelSubcomponentBuilderProvider(), null, function1, function12, composer3, 72, 4);
                                            if (ComposerKt.isTraceInProgress()) {
                                                ComposerKt.traceEventEnd();
                                                return;
                                            }
                                            return;
                                        }
                                        composer3.skipToGroupEnd();
                                    }

                                    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
                                    class C00141 extends FunctionReferenceImpl implements Function1<CustomerSheetViewAction, Unit> {
                                        C00141(Object obj) {
                                            super(1, obj, CustomerSheetViewModel.class, "handleViewAction", "handleViewAction(Lcom/stripe/android/customersheet/CustomerSheetViewAction;)V", 0);
                                        }

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

                                        public final void invoke(CustomerSheetViewAction customerSheetViewAction) {
                                            Intrinsics.checkNotNullParameter(customerSheetViewAction, "p0");
                                            ((CustomerSheetViewModel) this.receiver).handleViewAction(customerSheetViewAction);
                                        }
                                    }

                                    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
                                    class AnonymousClass2 extends FunctionReferenceImpl implements Function1<String, String> {
                                        AnonymousClass2(Object obj) {
                                            super(1, obj, CustomerSheetViewModel.class, "providePaymentMethodName", "providePaymentMethodName(Ljava/lang/String;)Ljava/lang/String;", 0);
                                        }

                                        public final String invoke(String str) {
                                            return ((CustomerSheetViewModel) this.receiver).providePaymentMethodName(str);
                                        }
                                    }
                                }), composer2, 3080, 2);
                                if (ComposerKt.isTraceInProgress()) {
                                    ComposerKt.traceEventEnd();
                                    return;
                                }
                                return;
                            }
                            composer2.skipToGroupEnd();
                        }

                        public static final CustomerSheetViewState invoke$lambda$0(State<? extends CustomerSheetViewState> state) {
                            return (CustomerSheetViewState) state.getValue();
                        }

                        public static final InternalCustomerSheetResult invoke$lambda$1(State<? extends InternalCustomerSheetResult> state) {
                            return (InternalCustomerSheetResult) state.getValue();
                        }

                        @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.customersheet.CustomerSheetActivity$onCreate$1$1$1", f = "CustomerSheetActivity.kt", i = {0}, l = {69}, m = "invokeSuspend", n = {"result"}, s = {"L$1"})
                        static final class C00131 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
                            final BottomSheetState $bottomSheetState;
                            final State<InternalCustomerSheetResult> $result$delegate;
                            Object L$0;
                            Object L$1;
                            int label;
                            final CustomerSheetActivity this$0;

                            C00131(State<? extends InternalCustomerSheetResult> state, BottomSheetState bottomSheetState, CustomerSheetActivity customerSheetActivity, Continuation<? super C00131> continuation) {
                                super(2, continuation);
                                this.$result$delegate = state;
                                this.$bottomSheetState = bottomSheetState;
                                this.this$0 = customerSheetActivity;
                            }

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

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

                            public final Object invokeSuspend(Object obj) {
                                InternalCustomerSheetResult internalCustomerSheetResult;
                                CustomerSheetActivity customerSheetActivity;
                                Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
                                int i = this.label;
                                if (i == 0) {
                                    ResultKt.throwOnFailure(obj);
                                    InternalCustomerSheetResult invoke$lambda$1 = AnonymousClass1.invoke$lambda$1(this.$result$delegate);
                                    if (invoke$lambda$1 != null) {
                                        BottomSheetState bottomSheetState = this.$bottomSheetState;
                                        CustomerSheetActivity customerSheetActivity2 = this.this$0;
                                        this.L$0 = customerSheetActivity2;
                                        this.L$1 = invoke$lambda$1;
                                        this.label = 1;
                                        if (bottomSheetState.hide(this) == coroutine_suspended) {
                                            return coroutine_suspended;
                                        }
                                        internalCustomerSheetResult = invoke$lambda$1;
                                        customerSheetActivity = customerSheetActivity2;
                                    }
                                    return Unit.INSTANCE;
                                }
                                if (i != 1) {
                                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                }
                                internalCustomerSheetResult = (InternalCustomerSheetResult) this.L$1;
                                customerSheetActivity = (CustomerSheetActivity) this.L$0;
                                ResultKt.throwOnFailure(obj);
                                customerSheetActivity.finishWithResult(internalCustomerSheetResult);
                                return Unit.INSTANCE;
                            }
                        }
                    }), composer, 3072, 7);
                    if (ComposerKt.isTraceInProgress()) {
                        ComposerKt.traceEventEnd();
                        return;
                    }
                    return;
                }
                composer.skipToGroupEnd();
            }
        }), 1, (Object) null);
    }

    public final void finishWithResult(InternalCustomerSheetResult result) {
        setResult(-1, new Intent().putExtras(result.toBundle$paymentsheet_release()));
        finish();
    }

    public void finish() {
        super.finish();
        overridePendingTransition(AnimationConstants.INSTANCE.getFADE_IN(), AnimationConstants.INSTANCE.getFADE_OUT());
    }
}