正在查看: Crafto v9.3.3 应用的 GooglePayLauncherActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 GooglePayLauncherActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.googlepaylauncher;
import Hk.k;
import Hk.p;
import Hk.q;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.J;
import androidx.lifecycle.T;
import androidx.lifecycle.u0;
import androidx.lifecycle.v0;
import androidx.lifecycle.x0;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.wallet.PaymentData;
import com.stripe.android.camera.scanui.CameraView;
import com.stripe.android.googlepaylauncher.GooglePayLauncher;
import com.stripe.android.googlepaylauncher.GooglePayLauncherContract;
import com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.view.AuthActivityStarterHost;
import dl.g;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@Metadata
public final class GooglePayLauncherActivity extends AppCompatActivity {
@NotNull
private static final Companion Companion = new Companion(null);
@Deprecated
private static final int LOAD_PAYMENT_DATA_REQUEST_CODE = 4444;
private GooglePayLauncherContract.Args args;
@NotNull
private final k viewModel$delegate = new u0(Reflection.getOrCreateKotlinClass(GooglePayLauncherViewModel.class), new Function0<x0>() {
{
super(0);
}
@NotNull
public final x0 m146invoke() {
x0 viewModelStore = this.getViewModelStore();
Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
return viewModelStore;
}
}, new Function0<v0.b>() {
{
super(0);
}
@NotNull
public final v0.b m147invoke() {
GooglePayLauncherContract.Args args;
Application application = GooglePayLauncherActivity.this.getApplication();
Intrinsics.checkNotNullExpressionValue(application, "application");
args = GooglePayLauncherActivity.this.args;
if (args == null) {
Intrinsics.throwUninitializedPropertyAccessException("args");
args = null;
}
return new GooglePayLauncherViewModel.Factory(application, args, false, null, 12, null);
}
});
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
private final void disableAnimations() {
overridePendingTransition(0, 0);
}
private final void finishWithResult(GooglePayLauncher.Result result) {
setResult(-1, new Intent().putExtras(Q1.c.a(new Pair[]{new Pair("extra_result", result)})));
finish();
}
public final GooglePayLauncherViewModel getViewModel() {
return (GooglePayLauncherViewModel) this.viewModel$delegate.getValue();
}
public static final void m144onCreate$lambda3(GooglePayLauncherActivity googlePayLauncherActivity, GooglePayLauncher.Result result) {
Intrinsics.checkNotNullParameter(googlePayLauncherActivity, "this$0");
if (result != null) {
googlePayLauncherActivity.finishWithResult(result);
}
}
private final void onGooglePayResult(Intent intent) {
PaymentData paymentData;
if (intent != null) {
Parcelable.Creator creator = PaymentData.CREATOR;
byte[] byteArrayExtra = intent.getByteArrayExtra("com.google.android.gms.wallet.PaymentData");
paymentData = (PaymentData) (byteArrayExtra == null ? null : he.b.a(byteArrayExtra, creator));
} else {
paymentData = null;
}
if (paymentData == null) {
getViewModel().updateResult(new GooglePayLauncher.Result.Failed(new IllegalArgumentException("Google Pay data was not available")));
} else {
g.b(J.a(this), (CoroutineContext) null, (dl.J) null, new GooglePayLauncherActivity$onGooglePayResult$1(this, AuthActivityStarterHost.Companion.create$payments_core_release(this), PaymentMethodCreateParams.Companion.createFromGooglePay(new JSONObject(paymentData.g)), null), 3);
}
}
public final void payWithGoogle(Task<PaymentData> task) {
Ee.c.a(task, this);
}
public void finish() {
super/*android.app.Activity*/.finish();
disableAnimations();
}
public void onActivityResult(int i, int i2, Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
if (i != LOAD_PAYMENT_DATA_REQUEST_CODE) {
g.b(J.a(this), (CoroutineContext) null, (dl.J) null, new GooglePayLauncherActivity$onActivityResult$1(this, i, intent, null), 3);
return;
}
if (i2 == -1) {
onGooglePayResult(intent);
return;
}
if (i2 == 0) {
getViewModel().updateResult(GooglePayLauncher.Result.Canceled.INSTANCE);
return;
}
if (i2 != 1) {
getViewModel().updateResult(new GooglePayLauncher.Result.Failed(new RuntimeException("Google Pay returned an expected result code.")));
return;
}
int i3 = Ee.c.c;
Status parcelableExtra = intent == null ? null : intent.getParcelableExtra("com.google.android.gms.common.api.AutoResolveHelper.status");
String str = parcelableExtra != null ? parcelableExtra.b : null;
if (str == null) {
str = CameraView.FILL_ASPECT_RATIO;
}
getViewModel().updateResult(new GooglePayLauncher.Result.Failed(new RuntimeException("Google Pay failed with error: ".concat(str))));
}
public void onCreate(Bundle bundle) {
GooglePayLauncherContract.Args a;
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
disableAnimations();
try {
p.a aVar = p.b;
GooglePayLauncherContract.Args.Companion companion = GooglePayLauncherContract.Args.Companion;
Intent intent = getIntent();
Intrinsics.checkNotNullExpressionValue(intent, "intent");
a = companion.fromIntent$payments_core_release(intent);
} catch (Throwable th) {
p.a aVar2 = p.b;
a = q.a(th);
}
if (a == null) {
throw new IllegalArgumentException("GooglePayLauncherActivity was started without arguments.".toString());
}
Throwable a2 = p.a(a);
if (a2 != null) {
finishWithResult(new GooglePayLauncher.Result.Failed(a2));
return;
}
this.args = a;
int intExtra = getIntent().getIntExtra("extra_status_bar_color", -1);
if (intExtra != -1) {
getWindow().setStatusBarColor(intExtra);
}
getViewModel().getGooglePayResult$payments_core_release().observe(this, new T() {
public final void onChanged(Object obj) {
GooglePayLauncherActivity.m144onCreate$lambda3(GooglePayLauncherActivity.this, (GooglePayLauncher.Result) obj);
}
});
if (getViewModel().getHasLaunched()) {
return;
}
getViewModel().setHasLaunched(true);
g.b(J.a(this), (CoroutineContext) null, (dl.J) null, new GooglePayLauncherActivity$onCreate$4(this, null), 3);
}
}