导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - GooglePayLauncherActivity.java 源代码

正在查看: BodyTech v7.6.4 应用的 GooglePayLauncherActivity.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.GooglePayLauncher;
import com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel;
import com.stripe.android.googlepaylauncher.h;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.payments.core.analytics.ErrorReporter;
import com.stripe.android.view.i;
import java.util.ArrayList;
import java.util.Map;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Result;
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;
import org.json.JSONObject;

@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\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\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\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\u000b\u001a\u00020\u00052\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u00022\u0006\u0010\b\u001a\u00020\u00072\u0006\u0010\n\u001a\u00020\tH\u0002J\u0010\u0010\u000e\u001a\u00020\u00052\u0006\u0010\r\u001a\u00020\fH\u0002J\u0012\u0010\u0011\u001a\u00020\u00052\b\u0010\u0010\u001a\u0004\u0018\u00010\u000fH\u0014J\b\u0010\u0012\u001a\u00020\u0005H\u0016J\"\u0010\u0018\u001a\u00020\u00052\u0006\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0015\u001a\u00020\u00132\b\u0010\u0017\u001a\u0004\u0018\u00010\u0016H\u0017R\u001b\u0010\u001e\u001a\u00020\u00198BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001a\u0010\u001b\u001a\u0004\b\u001c\u0010\u001dR\u001b\u0010#\u001a\u00020\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b \u0010\u001b\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/GooglePayLauncherActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lhb/a;", "Lfb/i;", "taskResult", "", "J", "Lcom/stripe/android/payments/core/analytics/ErrorReporter$c;", "errorEvent", "Lcom/stripe/android/googlepaylauncher/GooglePayLauncher$d$c;", "failedResult", "I", "Lcom/stripe/android/googlepaylauncher/GooglePayLauncher$d;", "result", "E", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "finish", "", "requestCode", "resultCode", "Landroid/content/Intent;", "data", "onActivityResult", "Lcom/stripe/android/googlepaylauncher/GooglePayLauncherViewModel;", "c", "Lkotlin/Lazy;", "G", "()Lcom/stripe/android/googlepaylauncher/GooglePayLauncherViewModel;", "viewModel", "Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "d", "F", "()Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "errorReporter", "Lcom/stripe/android/googlepaylauncher/h$a;", "e", "Lcom/stripe/android/googlepaylauncher/h$a;", "args", "<init>", "()V", "payments-core_release"}, k = 1, mv = {1, 9, 0})
@Instrumented
public final class GooglePayLauncherActivity extends AppCompatActivity implements TraceFieldInterface {

    private final Lazy viewModel;

    private final Lazy errorReporter;

    private h.a args;
    public Trace k;

    public GooglePayLauncherActivity() {
        Lazy b;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(v.b(GooglePayLauncherViewModel.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() {
                h.a aVar;
                aVar = GooglePayLauncherActivity.this.args;
                if (aVar == null) {
                    r.A("args");
                    aVar = null;
                }
                return new GooglePayLauncherViewModel.Factory(aVar, false, null, 6, null);
            }
        }, 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, GooglePayLauncherActivity.this, null, 2, null);
            }
        });
        this.errorReporter = b;
    }

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

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

    public final GooglePayLauncherViewModel G() {
        return (GooglePayLauncherViewModel) this.viewModel.getValue();
    }

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

    private final void I(hb.a<fb.i> taskResult, ErrorReporter.c errorEvent, GooglePayLauncher.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 F = F();
        n = g0.n(gj.i.a("status_message", n2), gj.i.a("status_code", valueOf));
        ErrorReporter.b.a(F, errorEvent, null, n, 2, null);
        G().u(failedResult);
    }

    private final void J(hb.a<fb.i> taskResult) {
        int m = taskResult.b().m();
        if (m == 0) {
            fb.i iVar = (fb.i) taskResult.a();
            if (iVar == null) {
                ErrorReporter.b.a(F(), ErrorReporter.UnexpectedErrorEvent.r, null, null, 6, null);
                G().u(new GooglePayLauncher.d.Failed(new RuntimeException("Google Pay missing result data.")));
                return;
            } else {
                G().h(i.Companion.b(com.stripe.android.view.i.INSTANCE, this, null, 2, null), PaymentMethodCreateParams.INSTANCE.l(new JSONObject(iVar.i())));
                return;
            }
        }
        if (m != 1) {
            if (m != 16) {
                I(taskResult, ErrorReporter.UnexpectedErrorEvent.p, new GooglePayLauncher.d.Failed(new RuntimeException("Google Pay returned an unexpected result code.")));
                return;
            } else {
                G().u(GooglePayLauncher.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 = "";
        }
        I(taskResult, expectedErrorEvent, new GooglePayLauncher.d.Failed(new RuntimeException("Google Pay failed with error " + m2 + ": " + n)));
    }

    public void finish() {
        super/*android.app.Activity*/.finish();
        com.stripe.android.uicore.utils.c.a(this);
    }

    @gj.c
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case 50000:
            case 50001:
                GooglePayLauncherViewModel G = G();
                if (data == null) {
                    data = new Intent();
                }
                G.r(requestCode, data);
                break;
        }
    }

    protected void onCreate(Bundle savedInstanceState) {
        Object b;
        h.a a;
        TraceMachine.startTracing("GooglePayLauncherActivity");
        try {
            TraceMachine.enterMethod(this.k, "GooglePayLauncherActivity#onCreate", (ArrayList) null);
        } catch (NoSuchFieldError unused) {
            TraceMachine.enterMethod((Trace) null, "GooglePayLauncherActivity#onCreate", (ArrayList) null);
        }
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(savedInstanceState);
        try {
            Result.Companion companion = Result.INSTANCE;
            h.a.Companion companion2 = h.a.INSTANCE;
            Intent intent = getIntent();
            r.h(intent, "getIntent(...)");
            a = companion2.a(intent);
        } catch (Throwable th2) {
            Result.Companion companion3 = Result.INSTANCE;
            b = Result.b(kotlin.f.a(th2));
        }
        if (a == null) {
            IllegalArgumentException illegalArgumentException = new IllegalArgumentException("GooglePayLauncherActivity was started without arguments.".toString());
            TraceMachine.exitMethod();
            throw illegalArgumentException;
        }
        b = Result.b(a);
        Throwable e = Result.e(b);
        if (e != null) {
            E(new GooglePayLauncher.d.Failed(e));
            TraceMachine.exitMethod();
            return;
        }
        this.args = (h.a) b;
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new GooglePayLauncherActivity$onCreate$3(this, null), 3, null);
        ActivityResultLauncher registerForActivityResult = registerForActivityResult(new hb.c(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                GooglePayLauncherActivity.H(GooglePayLauncherActivity.this, (hb.a) obj);
            }
        });
        r.h(registerForActivityResult, "registerForActivityResult(...)");
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new GooglePayLauncherActivity$onCreate$4(this, registerForActivityResult, null), 3, null);
        TraceMachine.exitMethod();
    }

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

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