导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - GooglePayPaymentMethodLauncherActivity.java 源代码

正在查看: BodyTech v7.6.4 应用的 GooglePayPaymentMethodLauncherActivity.java JAVA 源代码文件

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


package com.stripe.android.googlepaylauncher;

import android.content.Intent;
import android.os.Bundle;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.appcompat.app.AppCompatActivity;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.core.os.BundleKt;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.google.android.gms.common.api.Status;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import com.newrelic.agent.android.background.ApplicationStateMonitor;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.tracing.Trace;
import com.newrelic.agent.android.tracing.TraceMachine;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherViewModel;
import com.stripe.android.googlepaylauncher.j;
import com.stripe.android.payments.core.analytics.ErrorReporter;
import java.util.ArrayList;
import java.util.Map;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.collections.g0;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.r;
import kotlin.jvm.internal.v;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;

@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b*\u0010+J\u0016\u0010\u0006\u001a\u00020\u00052\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0002H\u0002J\u0010\u0010\b\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\u0003H\u0002J\u0010\u0010\u000b\u001a\u00020\u00052\u0006\u0010\n\u001a\u00020\tH\u0002J\u0010\u0010\f\u001a\u00020\u00052\u0006\u0010\n\u001a\u00020\tH\u0002J\b\u0010\r\u001a\u00020\u0005H\u0002J&\u0010\u0012\u001a\u00020\u00052\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u00022\u0006\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0002J\u0015\u0010\u0016\u001a\u00070\u0013¢\u0006\u0002\b\u00152\u0006\u0010\u0014\u001a\u00020\u0013H\u0002J\u0012\u0010\u0019\u001a\u00020\u00052\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0014J\b\u0010\u001a\u001a\u00020\u0005H\u0016R\u001b\u0010 \u001a\u00020\u001b8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001c\u0010\u001d\u001a\u0004\b\u001e\u0010\u001fR\u001b\u0010%\u001a\u00020!8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\"\u0010\u001d\u001a\u0004\b#\u0010$R\u0016\u0010)\u001a\u00020&8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b'\u0010(¨\u0006,"}, d2 = {"Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lhb/a;", "Lfb/i;", "taskResult", "", "M", "paymentData", "L", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$d;", "result", "O", "F", "N", "Lcom/stripe/android/payments/core/analytics/ErrorReporter$c;", "errorEvent", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$d$c;", "failedResult", "K", "", "googlePayStatusCode", "Lom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$ErrorCod;", "I", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "finish", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherViewModel;", "c", "Lkotlin/Lazy;", "H", "()Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherViewModel;", "viewModel", "Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "d", "G", "()Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "errorReporter", "Lcom/stripe/android/googlepaylauncher/j$a;", "e", "Lcom/stripe/android/googlepaylauncher/j$a;", "args", "<init>", "()V", "payments-core_release"}, k = 1, mv = {1, 9, 0})
@Instrumented
public final class GooglePayPaymentMethodLauncherActivity extends AppCompatActivity implements TraceFieldInterface {

    private final Lazy viewModel;

    private final Lazy errorReporter;

    private j.Args args;
    public Trace k;

    public GooglePayPaymentMethodLauncherActivity() {
        Lazy b;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(v.b(GooglePayPaymentMethodLauncherViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            @Override
            public final ViewModelStore invoke() {
                return this.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            @Override
            public final ViewModelProvider.Factory invoke() {
                j.Args args;
                args = GooglePayPaymentMethodLauncherActivity.this.args;
                if (args == null) {
                    r.A("args");
                    args = null;
                }
                return new GooglePayPaymentMethodLauncherViewModel.Factory(args);
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            @Override
            public final CreationExtras invoke() {
                CreationExtras creationExtras;
                Function0 function02 = Function0.this;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? this.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
        b = kotlin.d.b(new Function0<ErrorReporter>() {
            {
                super(0);
            }

            @Override
            public final ErrorReporter invoke() {
                return ErrorReporter.Companion.b(ErrorReporter.INSTANCE, GooglePayPaymentMethodLauncherActivity.this, null, 2, null);
            }
        });
        this.errorReporter = b;
    }

    public final void F(GooglePayPaymentMethodLauncher.d result) {
        setResult(-1, new Intent().putExtras(BundleKt.bundleOf(new Pair[]{gj.i.a("extra_result", result)})));
        finish();
    }

    private final ErrorReporter G() {
        return (ErrorReporter) this.errorReporter.getValue();
    }

    public final GooglePayPaymentMethodLauncherViewModel H() {
        return (GooglePayPaymentMethodLauncherViewModel) this.viewModel.getValue();
    }

    private final int I(int googlePayStatusCode) {
        if (googlePayStatusCode != 7) {
            return googlePayStatusCode != 10 ? 1 : 2;
        }
        return 3;
    }

    public static final void J(GooglePayPaymentMethodLauncherActivity this$0, hb.a aVar) {
        r.i(this$0, "this$0");
        r.f(aVar);
        this$0.M(aVar);
    }

    private final void K(hb.a<fb.i> taskResult, ErrorReporter.c errorEvent, GooglePayPaymentMethodLauncher.d.Failed failedResult) {
        Map n;
        Status b = taskResult.b();
        r.h(b, "getStatus(...)");
        String n2 = b.n();
        if (n2 == null) {
            n2 = "";
        }
        String valueOf = String.valueOf(b.m());
        ErrorReporter G = G();
        n = g0.n(gj.i.a("status_message", n2), gj.i.a("status_code", valueOf));
        ErrorReporter.b.a(G, errorEvent, null, n, 2, null);
        O(failedResult);
    }

    private final void L(fb.i paymentData) {
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new GooglePayPaymentMethodLauncherActivity$onGooglePayResult$1(this, paymentData, null), 3, null);
    }

    private final void M(hb.a<fb.i> taskResult) {
        int m = taskResult.b().m();
        if (m == 0) {
            fb.i iVar = (fb.i) taskResult.a();
            if (iVar != null) {
                L(iVar);
                return;
            } else {
                ErrorReporter.b.a(G(), ErrorReporter.UnexpectedErrorEvent.r, null, null, 6, null);
                O(new GooglePayPaymentMethodLauncher.d.Failed(new RuntimeException("Google Pay failed with missing data."), 1));
                return;
            }
        }
        if (m != 1) {
            if (m != 16) {
                K(taskResult, ErrorReporter.UnexpectedErrorEvent.p, new GooglePayPaymentMethodLauncher.d.Failed(new RuntimeException("Google Pay returned an unexpected result code."), 1));
                return;
            } else {
                O(GooglePayPaymentMethodLauncher.d.a.c);
                return;
            }
        }
        Status b = taskResult.b();
        r.h(b, "getStatus(...)");
        ErrorReporter.ExpectedErrorEvent expectedErrorEvent = ErrorReporter.ExpectedErrorEvent.A;
        int m2 = b.m();
        String n = b.n();
        if (n == null) {
            n = "";
        }
        K(taskResult, expectedErrorEvent, new GooglePayPaymentMethodLauncher.d.Failed(new RuntimeException("Google Pay failed with error " + m2 + ": " + n), I(b.m())));
    }

    private final void N() {
        com.stripe.android.uicore.utils.c.a(this);
    }

    public final void O(GooglePayPaymentMethodLauncher.d result) {
        H().i(result);
    }

    public void finish() {
        super/*android.app.Activity*/.finish();
        N();
    }

    protected void onCreate(Bundle savedInstanceState) {
        TraceMachine.startTracing("GooglePayPaymentMethodLauncherActivity");
        try {
            TraceMachine.enterMethod(this.k, "GooglePayPaymentMethodLauncherActivity#onCreate", (ArrayList) null);
        } catch (NoSuchFieldError unused) {
            TraceMachine.enterMethod((Trace) null, "GooglePayPaymentMethodLauncherActivity#onCreate", (ArrayList) null);
        }
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(savedInstanceState);
        N();
        j.Args.Companion companion = j.Args.INSTANCE;
        Intent intent = getIntent();
        r.h(intent, "getIntent(...)");
        j.Args a = companion.a(intent);
        if (a == null) {
            F(new GooglePayPaymentMethodLauncher.d.Failed(new RuntimeException("GooglePayPaymentMethodLauncherActivity was started without arguments."), 2));
            TraceMachine.exitMethod();
            return;
        }
        this.args = a;
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new GooglePayPaymentMethodLauncherActivity$onCreate$1(this, null), 3, null);
        ActivityResultLauncher registerForActivityResult = registerForActivityResult(new hb.c(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                GooglePayPaymentMethodLauncherActivity.J(GooglePayPaymentMethodLauncherActivity.this, (hb.a) obj);
            }
        });
        r.h(registerForActivityResult, "registerForActivityResult(...)");
        if (!H().e()) {
            BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new GooglePayPaymentMethodLauncherActivity$onCreate$2(this, registerForActivityResult, null), 3, null);
        }
        TraceMachine.exitMethod();
    }

    protected void onStart() {
        super.onStart();
        ApplicationStateMonitor.getInstance().activityStarted();
    }

    protected void onStop() {
        super.onStop();
        ApplicationStateMonitor.getInstance().activityStopped();
    }
}