导航菜单

页面标题

页面副标题

Rilo v2.0.21 - PaymentLauncherConfirmationActivity.java 源代码

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

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


package com.stripe.android.payments.paymentlauncher;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcherKt;
import androidx.activity.result.ActivityResultCaller;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.payments.paymentlauncher.InternalPaymentResult;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel;
import com.stripe.android.utils.AnimationConstants;
import com.stripe.android.view.AuthActivityStarterHost;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;

@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\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\u0003\b\u0000\u0018\u0000 \u001f2\u00020\u0001:\u0001\u001fB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0016\u001a\u00020\u0017H\u0016J\u0010\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0019\u001a\u00020\u001aH\u0002J\u0012\u0010\u001b\u001a\u00020\u00172\b\u0010\u001c\u001a\u0004\u0018\u00010\u001dH\u0015J\b\u0010\u001e\u001a\u00020\u0017H\u0002R\u001d\u0010\u0003\u001a\u0004\u0018\u00010\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006R!\u0010\t\u001a\u00020\n8@X\u0081\u0084\u0002¢\u0006\u0012\n\u0004\b\u000e\u0010\b\u0012\u0004\b\u000b\u0010\u0002\u001a\u0004\b\f\u0010\rR$\u0010\u000f\u001a\u00020\u00108\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u0011\u0010\u0002\u001a\u0004\b\u0012\u0010\u0013\"\u0004\b\u0014\u0010\u0015¨\u0006 "}, d2 = {"Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherConfirmationActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "starterArgs", "Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherContract$Args;", "getStarterArgs", "()Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherContract$Args;", "starterArgs$delegate", "Lkotlin/Lazy;", "viewModel", "Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherViewModel;", "getViewModel$payments_core_release$annotations", "getViewModel$payments_core_release", "()Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherViewModel;", "viewModel$delegate", "viewModelFactory", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelFactory$payments_core_release$annotations", "getViewModelFactory$payments_core_release", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelFactory$payments_core_release", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "finish", "", "finishWithResult", "result", "Lcom/stripe/android/payments/paymentlauncher/InternalPaymentResult;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "setFadeAnimations", "Companion", "payments-core_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PaymentLauncherConfirmationActivity extends AppCompatActivity {
    public static final String EMPTY_ARG_ERROR = "PaymentLauncherConfirmationActivity was started without arguments";

    private final Lazy viewModel;

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

        public final PaymentLauncherContract.Args m251invoke() {
            PaymentLauncherContract.Args.Companion companion = PaymentLauncherContract.Args.INSTANCE;
            Intent intent = PaymentLauncherConfirmationActivity.this.getIntent();
            Intrinsics.checkNotNullExpressionValue(intent, "intent");
            return companion.fromIntent(intent);
        }
    });
    private ViewModelProvider.Factory viewModelFactory = new PaymentLauncherViewModel.Factory(new Function0<PaymentLauncherContract.Args>() {
        {
            super(0);
        }

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

    public static void getViewModel$payments_core_release$annotations() {
    }

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

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

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

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

            public final CreationExtras m250invoke() {
                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 PaymentLauncherContract.Args getStarterArgs() {
        return (PaymentLauncherContract.Args) this.starterArgs.getValue();
    }

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

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

    public final PaymentLauncherViewModel getViewModel$payments_core_release() {
        return (PaymentLauncherViewModel) this.viewModel.getValue();
    }

    protected void onCreate(Bundle savedInstanceState) {
        Object m1547constructorimpl;
        PaymentLauncherContract.Args starterArgs;
        super.onCreate(savedInstanceState);
        setFadeAnimations();
        try {
            Result.Companion companion = Result.INSTANCE;
            PaymentLauncherConfirmationActivity paymentLauncherConfirmationActivity = this;
            starterArgs = getStarterArgs();
        } catch (Throwable th) {
            Result.Companion companion2 = Result.INSTANCE;
            m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
        }
        if (starterArgs != null) {
            m1547constructorimpl = Result.m1547constructorimpl(starterArgs);
            Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
            if (m1550exceptionOrNullimpl != null) {
                finishWithResult(new InternalPaymentResult.Failed(m1550exceptionOrNullimpl));
                return;
            }
            PaymentLauncherContract.Args args = (PaymentLauncherContract.Args) m1547constructorimpl;
            OnBackPressedDispatcher onBackPressedDispatcher = getOnBackPressedDispatcher();
            Intrinsics.checkNotNullExpressionValue(onBackPressedDispatcher, "onBackPressedDispatcher");
            OnBackPressedDispatcherKt.addCallback$default(onBackPressedDispatcher, (LifecycleOwner) null, false, new Function1<OnBackPressedCallback, Unit>() {
                public final void invoke(OnBackPressedCallback onBackPressedCallback) {
                    Intrinsics.checkNotNullParameter(onBackPressedCallback, "$this$addCallback");
                }

                public Object invoke(Object obj) {
                    invoke((OnBackPressedCallback) obj);
                    return Unit.INSTANCE;
                }
            }, 3, (Object) null);
            LifecycleOwner lifecycleOwner = (LifecycleOwner) this;
            BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope(lifecycleOwner), (CoroutineContext) null, (CoroutineStart) null, new PaymentLauncherConfirmationActivity$onCreate$2(this, null), 3, (Object) null);
            getViewModel$payments_core_release().register$payments_core_release((ActivityResultCaller) this, lifecycleOwner);
            AuthActivityStarterHost create$payments_core_release = AuthActivityStarterHost.INSTANCE.create$payments_core_release((ComponentActivity) this, args.getStatusBarColor());
            if (args instanceof PaymentLauncherContract.Args.IntentConfirmationArgs) {
                getViewModel$payments_core_release().confirmStripeIntent$payments_core_release(((PaymentLauncherContract.Args.IntentConfirmationArgs) args).getConfirmStripeIntentParams(), create$payments_core_release);
                return;
            } else if (args instanceof PaymentLauncherContract.Args.PaymentIntentNextActionArgs) {
                getViewModel$payments_core_release().handleNextActionForStripeIntent$payments_core_release(((PaymentLauncherContract.Args.PaymentIntentNextActionArgs) args).getPaymentIntentClientSecret(), create$payments_core_release);
                return;
            } else {
                if (args instanceof PaymentLauncherContract.Args.SetupIntentNextActionArgs) {
                    getViewModel$payments_core_release().handleNextActionForStripeIntent$payments_core_release(((PaymentLauncherContract.Args.SetupIntentNextActionArgs) args).getSetupIntentClientSecret(), create$payments_core_release);
                    return;
                }
                return;
            }
        }
        throw new IllegalArgumentException(EMPTY_ARG_ERROR.toString());
    }

    public void finish() {
        super.finish();
        setFadeAnimations();
    }

    private final void setFadeAnimations() {
        overridePendingTransition(AnimationConstants.INSTANCE.getFADE_IN(), AnimationConstants.INSTANCE.getFADE_OUT());
    }

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