导航菜单

页面标题

页面副标题

Rilo v2.0.21 - PollingActivity.java 源代码

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

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


package com.stripe.android.paymentsheet.paymentdatacollection.polling;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.compose.ComponentActivityKt;
import androidx.appcompat.app.AppCompatActivity;
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.core.view.WindowCompat;
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.payments.PaymentFlowResult;
import com.stripe.android.paymentsheet.paymentdatacollection.polling.PollingContract;
import com.stripe.android.paymentsheet.paymentdatacollection.polling.PollingViewModel;
import com.stripe.android.uicore.StripeThemeKt;
import com.stripe.android.utils.AnimationConstants;
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.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.Reflection;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.CoroutineScope;

@Metadata(d1 = {"\u0000>\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\u0005\n\u0002\u0010\u0002\n\u0000\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\u0010\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J\u0012\u0010\u0018\u001a\u00020\u00152\b\u0010\u0019\u001a\u0004\u0018\u00010\u001aH\u0014R\u001b\u0010\u0003\u001a\u00020\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006R\u001b\u0010\t\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\r\u0010\b\u001a\u0004\b\u000b\u0010\fR\u001a\u0010\u000e\u001a\u00020\u000fX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0010\u0010\u0011\"\u0004\b\u0012\u0010\u0013¨\u0006\u001b²\u0006\n\u0010\u001c\u001a\u00020\u001dX\u008a\u0084\u0002"}, d2 = {"Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "args", "Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingContract$Args;", "getArgs", "()Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingContract$Args;", "args$delegate", "Lkotlin/Lazy;", "viewModel", "Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingViewModel;", "getViewModel", "()Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingViewModel;", "viewModel$delegate", "viewModelFactory", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelFactory$paymentsheet_release", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelFactory$paymentsheet_release", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "finishWithResult", "", "result", "Lcom/stripe/android/payments/PaymentFlowResult$Unvalidated;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "paymentsheet_release", "uiState", "Lcom/stripe/android/paymentsheet/paymentdatacollection/polling/PollingUiState;"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PollingActivity extends AppCompatActivity {

    private final Lazy viewModel;

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

        public final PollingContract.Args m503invoke() {
            PollingContract.Args.Companion companion = PollingContract.Args.INSTANCE;
            Intent intent = PollingActivity.this.getIntent();
            Intrinsics.checkNotNullExpressionValue(intent, "intent");
            PollingContract.Args fromIntent = companion.fromIntent(intent);
            if (fromIntent != null) {
                return fromIntent;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    });
    private ViewModelProvider.Factory viewModelFactory = new PollingViewModel.Factory(new Function0<PollingViewModel.Args>() {
        {
            super(0);
        }

        public final PollingViewModel.Args m507invoke() {
            PollingContract.Args args;
            PollingContract.Args args2;
            PollingContract.Args args3;
            PollingContract.Args args4;
            PollingContract.Args args5;
            args = PollingActivity.this.getArgs();
            String clientSecret = args.getClientSecret();
            Duration.Companion companion = Duration.Companion;
            args2 = PollingActivity.this.getArgs();
            long duration = DurationKt.toDuration(args2.getTimeLimitInSeconds(), DurationUnit.SECONDS);
            Duration.Companion companion2 = Duration.Companion;
            args3 = PollingActivity.this.getArgs();
            long duration2 = DurationKt.toDuration(args3.getInitialDelayInSeconds(), DurationUnit.SECONDS);
            args4 = PollingActivity.this.getArgs();
            int maxAttempts = args4.getMaxAttempts();
            args5 = PollingActivity.this.getArgs();
            return new PollingViewModel.Args(clientSecret, duration, duration2, maxAttempts, args5.getCtaText(), null);
        }
    });

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

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

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

            public final CreationExtras m502invoke() {
                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 PollingContract.Args getArgs() {
        return (PollingContract.Args) this.args.getValue();
    }

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

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

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

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
        ComponentActivityKt.setContent$default((ComponentActivity) this, (CompositionContext) null, ComposableLambdaKt.composableLambdaInstance(-684927091, 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 PollingActivity this$0;

                AnonymousClass1(PollingActivity pollingActivity) {
                    super(2);
                    this.this$0 = pollingActivity;
                }

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

                public final void invoke(Composer composer, int i2) {
                    PollingViewModel viewModel;
                    if ((i2 & 11) != 2 || !composer.getSkipping()) {
                        if (ComposerKt.isTraceInProgress()) {
                            ComposerKt.traceEventStart(1217612191, i2, -1, "com.stripe.android.paymentsheet.paymentdatacollection.polling.PollingActivity.onCreate.<anonymous>.<anonymous> (PollingActivity.kt:48)");
                        }
                        viewModel = this.this$0.getViewModel();
                        final State collectAsState = SnapshotStateKt.collectAsState(viewModel.getUiState(), (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.paymentdatacollection.polling.PollingActivity$onCreate$1.AnonymousClass1.invoke(androidx.compose.runtime.Composer, int):void");
                        }

                        public static final PollingUiState invoke$lambda$0(State<PollingUiState> state) {
                            return (PollingUiState) 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.paymentsheet.paymentdatacollection.polling.PollingActivity$onCreate$1$1$2", f = "PollingActivity.kt", i = {0}, l = {73}, m = "invokeSuspend", n = {"result"}, s = {"L$0"})
                        static final class AnonymousClass2 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
                            final BottomSheetState $state;
                            final State<PollingUiState> $uiState$delegate;
                            Object L$0;
                            int label;
                            final PollingActivity this$0;

                            AnonymousClass2(PollingActivity pollingActivity, BottomSheetState bottomSheetState, State<PollingUiState> state, Continuation<? super AnonymousClass2> continuation) {
                                super(2, continuation);
                                this.this$0 = pollingActivity;
                                this.$state = bottomSheetState;
                                this.$uiState$delegate = state;
                            }

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

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

                            public final Object invokeSuspend(Object obj) {
                                PollingContract.Args args;
                                PaymentFlowResult.Unvalidated unvalidated;
                                Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
                                int i2 = this.label;
                                if (i2 == 0) {
                                    ResultKt.throwOnFailure(obj);
                                    PollingState pollingState = AnonymousClass1.invoke$lambda$0(this.$uiState$delegate).getPollingState();
                                    args = this.this$0.getArgs();
                                    PaymentFlowResult.Unvalidated flowResult = PollingViewModelKt.toFlowResult(pollingState, args);
                                    if (flowResult != null) {
                                        this.L$0 = flowResult;
                                        this.label = 1;
                                        if (this.$state.hide((Continuation) this) == coroutine_suspended) {
                                            return coroutine_suspended;
                                        }
                                        unvalidated = flowResult;
                                    }
                                    return Unit.INSTANCE;
                                }
                                if (i2 != 1) {
                                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                }
                                unvalidated = (PaymentFlowResult.Unvalidated) this.L$0;
                                ResultKt.throwOnFailure(obj);
                                this.this$0.finishWithResult(unvalidated);
                                return Unit.INSTANCE;
                            }
                        }
                    }

                    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(-684927091, i2, -1, "com.stripe.android.paymentsheet.paymentdatacollection.polling.PollingActivity.onCreate.<anonymous> (PollingActivity.kt:47)");
                            }
                            StripeThemeKt.StripeTheme(null, null, null, ComposableLambdaKt.composableLambda(composer, 1217612191, true, new AnonymousClass1(PollingActivity.this)), composer, 3072, 7);
                            if (ComposerKt.isTraceInProgress()) {
                                ComposerKt.traceEventEnd();
                                return;
                            }
                            return;
                        }
                        composer.skipToGroupEnd();
                    }
                }), 1, (Object) null);
            }

            public final void finishWithResult(PaymentFlowResult.Unvalidated result) {
                setResult(-1, new Intent().putExtras(result.toBundle()));
                finish();
                overridePendingTransition(0, AnimationConstants.INSTANCE.getFADE_OUT());
            }
        }