导航菜单

页面标题

页面副标题

Rilo v2.0.21 - StripeBrowserLauncherActivity.java 源代码

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

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


package com.stripe.android.payments;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.auth.PaymentBrowserAuthContract;
import com.stripe.android.payments.StripeBrowserLauncherViewModel;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;

@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\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0002J\u0010\u0010\r\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0002J\u0010\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0002J\u0012\u0010\u000f\u001a\u00020\n2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0011H\u0014R\u001b\u0010\u0003\u001a\u00020\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0012"}, d2 = {"Lcom/stripe/android/payments/StripeBrowserLauncherActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "viewModel", "Lcom/stripe/android/payments/StripeBrowserLauncherViewModel;", "getViewModel", "()Lcom/stripe/android/payments/StripeBrowserLauncherViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "finishWithFailure", "", "args", "Lcom/stripe/android/auth/PaymentBrowserAuthContract$Args;", "finishWithSuccess", "launchBrowser", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "payments-core_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class StripeBrowserLauncherActivity extends AppCompatActivity {

    private final Lazy viewModel;

    public StripeBrowserLauncherActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        Function0<ViewModelProvider.Factory> function0 = new Function0<ViewModelProvider.Factory>() {
            public final ViewModelProvider.Factory m192invoke() {
                return new StripeBrowserLauncherViewModel.Factory();
            }
        };
        final Function0 function02 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(StripeBrowserLauncherViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

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

            public final ViewModelProvider.Factory m189invoke() {
                ViewModelProvider.Factory defaultViewModelProviderFactory = componentActivity.getDefaultViewModelProviderFactory();
                Intrinsics.checkNotNullExpressionValue(defaultViewModelProviderFactory, "defaultViewModelProviderFactory");
                return defaultViewModelProviderFactory;
            }
        } : function0, new Function0<CreationExtras>() {
            {
                super(0);
            }

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

    private final StripeBrowserLauncherViewModel getViewModel() {
        return (StripeBrowserLauncherViewModel) this.viewModel.getValue();
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        PaymentBrowserAuthContract.Companion companion = PaymentBrowserAuthContract.Companion;
        Intent intent = getIntent();
        Intrinsics.checkNotNullExpressionValue(intent, "intent");
        PaymentBrowserAuthContract.Args parseArgs$payments_core_release = companion.parseArgs$payments_core_release(intent);
        if (parseArgs$payments_core_release == null) {
            finish();
        } else if (getViewModel().getHasLaunched()) {
            finishWithSuccess(parseArgs$payments_core_release);
        } else {
            launchBrowser(parseArgs$payments_core_release);
        }
    }

    private final void launchBrowser(final PaymentBrowserAuthContract.Args args) {
        ActivityResultLauncher registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
            public final void onActivityResult(ActivityResult activityResult) {
                StripeBrowserLauncherActivity.this.finishWithSuccess(args);
            }
        });
        Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "private fun launchBrowse…ure(args)\n        }\n    }");
        Intent createLaunchIntent = getViewModel().createLaunchIntent(args);
        if (createLaunchIntent != null) {
            registerForActivityResult.launch(createLaunchIntent);
            getViewModel().setHasLaunched(true);
        } else {
            finishWithFailure(args);
        }
    }

    public final void finishWithSuccess(PaymentBrowserAuthContract.Args args) {
        setResult(-1, getViewModel().getResultIntent(args));
        finish();
    }

    private final void finishWithFailure(PaymentBrowserAuthContract.Args args) {
        setResult(-1, getViewModel().getFailureIntent(args));
        finish();
    }
}