正在查看: Biko v2.0.23 应用的 QRPaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 QRPaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.payment;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import app.callpe.common.utils.AppsFlyerAnalyticsHelper;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.helper_functions.AnalyticsHelper;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.APIError;
import app.callpe.data.model.ErrorHandler;
import app.callpe.data.model.OrderSuccess;
import app.callpe.data.model.SuccessModel;
import app.callpe.databinding.ActivityQrPaymentBinding;
import app.callpe.db.LocalDB;
import app.callpe.service.ApiService;
import app.callpe.ui.home.BaseActivity;
import com.adjust.sdk.Constants;
import dagger.hilt.android.AndroidEntryPoint;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Locale;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
@Metadata(d1 = {"\u0000j\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\t\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\u0018\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020(2\u0006\u0010)\u001a\u00020*H\u0002J\b\u0010+\u001a\u00020(H\u0002J+\u0010,\u001a\u00020&2\u0006\u0010-\u001a\u00020.2\b\u0010/\u001a\u0004\u0018\u00010.2\n\b\u0002\u0010\u0010\u001a\u0004\u0018\u00010\u0011H\u0002¢\u0006\u0002\u00100J\u0010\u00101\u001a\u00020\u00022\u0006\u00102\u001a\u000203H\u0016J\b\u00104\u001a\u00020&H\u0016J\b\u00105\u001a\u00020&H\u0002J\u0012\u00106\u001a\u00020&2\b\u00107\u001a\u0004\u0018\u000108H\u0014J\u0012\u00109\u001a\u00020&2\b\u0010:\u001a\u0004\u0018\u00010\u0011H\u0002J\u000e\u0010;\u001a\u00020&2\u0006\u0010<\u001a\u00020=J\u0018\u0010>\u001a\u00020&2\u0006\u0010'\u001a\u00020(2\u0006\u0010)\u001a\u00020*H\u0002J\b\u0010?\u001a\u00020&H\u0002J\b\u0010@\u001a\u00020&H\u0002J\b\u0010A\u001a\u00020&H\u0002J\b\u0010B\u001a\u00020&H\u0002J\u001c\u0010C\u001a\u00020&2\b\u0010:\u001a\u0004\u0018\u00010\u00112\b\b\u0002\u0010D\u001a\u00020=H\u0002J\u0012\u0010E\u001a\u00020&2\b\u0010:\u001a\u0004\u0018\u00010\u0011H\u0002R\u001e\u0010\u0004\u001a\u00020\u00058\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\tR\u001a\u0010\n\u001a\u00020\u000bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u0012\u001a\u0004\u0018\u00010\u0013X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\u001a\u0010\u0018\u001a\u00020\u0011X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u001a\"\u0004\b\u001b\u0010\u001cR\u0011\u0010\u001d\u001a\u00020\u001e¢\u0006\b\n\u0000\u001a\u0004\b\u001f\u0010 R$\u0010!\u001a\u00020\u00118\u0006@\u0006X\u0087.¢\u0006\u0014\n\u0000\u0012\u0004\b\"\u0010\u0003\u001a\u0004\b#\u0010\u001a\"\u0004\b$\u0010\u001c¨\u0006F"}, d2 = {"Lapp/callpe/ui/payment/QRPaymentActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityQrPaymentBinding;", "()V", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "count", "", "getCount", "()I", "setCount", "(I)V", "currency", "", "job", "Lkotlinx/coroutines/Job;", "getJob", "()Lkotlinx/coroutines/Job;", "setJob", "(Lkotlinx/coroutines/Job;)V", "orderId", "getOrderId", "()Ljava/lang/String;", "setOrderId", "(Ljava/lang/String;)V", "scope", "Lkotlinx/coroutines/CoroutineScope;", "getScope", "()Lkotlinx/coroutines/CoroutineScope;", "userId", "getUserId$annotations", "getUserId", "setUserId", "downloadAndSaveImage", "", "context", "Landroid/content/Context;", "imageView", "Landroid/widget/ImageView;", "getContext", "getOrderResponse", "topUpId", "", "couponCode", "(JLjava/lang/Long;Ljava/lang/String;)V", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onBackPressed", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "orderFiledResponse", "orderID", "setProgress", "isVisible", "", "shareImageToWhatsApp", "showFailedInfo", "showInfoMessage", "showSuccessInfo", "stopUpdate", "verifyOrderResponse", "isFailed", "verifyPayment", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class QRPaymentActivity extends BaseActivity<ActivityQrPaymentBinding> {
@Inject
public ApiService apiService;
private int count;
private Job job;
@Inject
public String userId;
private String orderId = "";
private final CoroutineScope scope = CoroutineScopeKt.MainScope();
private String currency = "INR";
public static void getUserId$annotations() {
}
public final String getOrderId() {
return this.orderId;
}
public final void setOrderId(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.orderId = str;
}
public final ApiService getApiService() {
ApiService apiService = this.apiService;
if (apiService != null) {
return apiService;
}
Intrinsics.throwUninitializedPropertyAccessException("apiService");
return null;
}
public final void setApiService(ApiService apiService) {
Intrinsics.checkNotNullParameter(apiService, "<set-?>");
this.apiService = apiService;
}
public final CoroutineScope getScope() {
return this.scope;
}
public final Job getJob() {
return this.job;
}
public final void setJob(Job job) {
this.job = job;
}
public final int getCount() {
return this.count;
}
public final void setCount(int i) {
this.count = i;
}
public final String getUserId() {
String str = this.userId;
if (str != null) {
return str;
}
Intrinsics.throwUninitializedPropertyAccessException("userId");
return null;
}
public final void setUserId(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.userId = str;
}
@Override
public ActivityQrPaymentBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityQrPaymentBinding inflate = ActivityQrPaymentBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Context context = (Context) this;
AnalyticsHelper.INSTANCE.sendScreenOpenEvent(context);
AppsFlyerAnalyticsHelper.sendScreenOpenEvent(context);
String string = SharedPref.getString(context, PrefKeys.INSTALL_SOURCE);
String str = string;
if (!(str == null || str.length() == 0)) {
Intrinsics.checkNotNullExpressionValue(string, "installSource");
String lowerCase = string.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
if (StringsKt.contains$default(lowerCase, Constants.REFERRER_API_GOOGLE, false, 2, (Object) null)) {
AnalyticsHelper.INSTANCE.sendScreenOpenEventGoogle(context);
}
}
this.currency = getIntent().getStringExtra("currency");
long longExtra = getIntent().getLongExtra("topUpId", -1L);
Long valueOf = Long.valueOf(getIntent().getLongExtra("couponCode", -1L));
Long l = valueOf.longValue() != -1 ? valueOf : null;
if (longExtra != -1) {
getOrderResponse(longExtra, l, this.currency);
}
onClicks();
}
static void getOrderResponse$default(QRPaymentActivity qRPaymentActivity, long j, Long l, String str, int i, Object obj) {
if ((i & 4) != 0) {
str = "INR";
}
qRPaymentActivity.getOrderResponse(j, l, str);
}
private final void getOrderResponse(long topUpId, Long couponCode, String currency) {
setProgress(true);
ApiService.DefaultImpls.createOrderV2$default(getApiService(), topUpId, "QR_CODE", null, null, null, null, couponCode, currency, 60, null).enqueue(new Callback<OrderSuccess>() {
public void onResponse(retrofit2.Call<app.callpe.data.model.OrderSuccess> r6, retrofit2.Response<app.callpe.data.model.OrderSuccess> r7) {
throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.payment.QRPaymentActivity$getOrderResponse$1.onResponse(retrofit2.Call, retrofit2.Response):void");
}
public void onFailure(Call<OrderSuccess> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
QRPaymentActivity.this.setProgress(false);
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) QRPaymentActivity.this, t);
}
});
}
public final void setProgress(boolean isVisible) {
ProgressBar progressBar = getBinding().progress;
Intrinsics.checkNotNullExpressionValue(progressBar, "binding.progress");
progressBar.setVisibility(isVisible ? 0 : 8);
}
private final void onClicks() {
getBinding().addBackPress.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
QRPaymentActivity.onClicks$lambda$0(QRPaymentActivity.this, view);
}
});
getBinding().share.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
QRPaymentActivity.onClicks$lambda$1(QRPaymentActivity.this, view);
}
});
getBinding().download.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
QRPaymentActivity.onClicks$lambda$2(QRPaymentActivity.this, view);
}
});
}
public static final void onClicks$lambda$0(QRPaymentActivity qRPaymentActivity, View view) {
Intrinsics.checkNotNullParameter(qRPaymentActivity, "this$0");
qRPaymentActivity.onBackPressed();
}
public static final void onClicks$lambda$1(QRPaymentActivity qRPaymentActivity, View view) {
Intrinsics.checkNotNullParameter(qRPaymentActivity, "this$0");
if (((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).upiQrImage.getDrawable() == null) {
ImageView imageView = ((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).qrImage;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.qrImage");
qRPaymentActivity.shareImageToWhatsApp((Context) qRPaymentActivity, imageView);
} else {
ImageView imageView2 = ((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).upiQrImage;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.upiQrImage");
qRPaymentActivity.shareImageToWhatsApp((Context) qRPaymentActivity, imageView2);
}
}
public static final void onClicks$lambda$2(QRPaymentActivity qRPaymentActivity, View view) {
Intrinsics.checkNotNullParameter(qRPaymentActivity, "this$0");
if (((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).upiQrImage.getDrawable() == null) {
ImageView imageView = ((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).qrImage;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.qrImage");
qRPaymentActivity.downloadAndSaveImage((Context) qRPaymentActivity, imageView);
} else {
ImageView imageView2 = ((ActivityQrPaymentBinding) qRPaymentActivity.getBinding()).upiQrImage;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.upiQrImage");
qRPaymentActivity.downloadAndSaveImage((Context) qRPaymentActivity, imageView2);
}
}
public final Context getContext() {
return (Context) this;
}
static void verifyOrderResponse$default(QRPaymentActivity qRPaymentActivity, String str, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
qRPaymentActivity.verifyOrderResponse(str, z);
}
private final void verifyOrderResponse(final String orderID, final boolean isFailed) {
getApiService().verifyPaymentStatus(orderID, getUserId()).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
SuccessModel successModel;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null && (successModel = (SuccessModel) response.body()) != null) {
boolean z = isFailed;
QRPaymentActivity qRPaymentActivity = QRPaymentActivity.this;
String str = orderID;
String paymentStatus = successModel.getPaymentStatus();
if (paymentStatus != null) {
Timber.e("payment success " + paymentStatus, new Object[0]);
if (z) {
switch (paymentStatus.hashCode()) {
case -1872451388:
if (!paymentStatus.equals("REFUND_INITIATED")) {
break;
}
qRPaymentActivity.orderFiledResponse(str);
break;
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
qRPaymentActivity.orderFiledResponse(str);
break;
case 35394935:
if (!paymentStatus.equals("PENDING")) {
break;
} else {
qRPaymentActivity.orderFiledResponse(str);
break;
}
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
qRPaymentActivity.orderFiledResponse(str);
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
qRPaymentActivity.orderFiledResponse(str);
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
qRPaymentActivity.orderFiledResponse(str);
break;
}
} else {
switch (paymentStatus.hashCode()) {
case -1872451388:
if (!paymentStatus.equals("REFUND_INITIATED")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
case -1149187101:
if (!paymentStatus.equals("SUCCESS")) {
break;
} else {
AnalyticsHelper.sendSuccessEvent$default(AnalyticsHelper.INSTANCE, (Context) qRPaymentActivity, false, 0.0d, 6, null);
Timber.e("QR Test " + successModel.getValue(), new Object[0]);
qRPaymentActivity.showSuccessInfo();
break;
}
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
case 1409057580:
if (!paymentStatus.equals("USER_DROPPED")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
qRPaymentActivity.showFailedInfo();
break;
}
}
}
}
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) QRPaymentActivity.this, QRPaymentActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) QRPaymentActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) QRPaymentActivity.this, t);
}
});
}
public final void orderFiledResponse(String orderID) {
getApiService().orderFiledResponse(orderID).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null) {
SuccessModel successModel = (SuccessModel) response.body();
String message = successModel != null ? successModel.getMessage() : null;
Timber.e("status message " + message, new Object[0]);
if (Intrinsics.areEqual(message, "PAYMENT_SUCCESSFUL")) {
QRPaymentActivity.this.showSuccessInfo();
return;
} else if (Intrinsics.areEqual(message, "PAYMENT_CANCELLED")) {
QRPaymentActivity.this.showFailedInfo();
return;
} else {
QRPaymentActivity qRPaymentActivity = QRPaymentActivity.this;
qRPaymentActivity.setJob(BuildersKt.launch$default(qRPaymentActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$orderFiledResponse$1$onResponse$1(QRPaymentActivity.this, null), 3, (Object) null));
return;
}
}
return;
}
try {
QRPaymentActivity qRPaymentActivity2 = QRPaymentActivity.this;
qRPaymentActivity2.setJob(BuildersKt.launch$default(qRPaymentActivity2.getScope(), (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$orderFiledResponse$1$onResponse$2(QRPaymentActivity.this, null), 3, (Object) null));
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) QRPaymentActivity.this, QRPaymentActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
Toast.makeText((Context) QRPaymentActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) QRPaymentActivity.this, t);
QRPaymentActivity qRPaymentActivity = QRPaymentActivity.this;
qRPaymentActivity.setJob(BuildersKt.launch$default(qRPaymentActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$orderFiledResponse$1$onFailure$1(QRPaymentActivity.this, null), 3, (Object) null));
}
});
}
public final void stopUpdate() {
Job job = this.job;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
this.job = null;
}
public final void showSuccessInfo() {
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(0);
getBinding().failed.setVisibility(4);
getBinding().success.setVisibility(0);
getBinding().paymentStatusMessage.setText(getString(2131952974));
ImageView imageView = getBinding().qrImage;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.qrImage");
imageView.setVisibility(8);
ImageView imageView2 = getBinding().upiQrImage;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.upiQrImage");
imageView2.setVisibility(8);
stopUpdate();
getBinding().timerText.stopTimer();
setResult(-1);
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$showSuccessInfo$1(this, null), 3, (Object) null);
}
public final void showFailedInfo() {
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(0);
getBinding().failed.setVisibility(0);
getBinding().success.setVisibility(4);
ImageView imageView = getBinding().qrImage;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.qrImage");
imageView.setVisibility(8);
ImageView imageView2 = getBinding().upiQrImage;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.upiQrImage");
imageView2.setVisibility(8);
getBinding().paymentStatusMessage.setText(getString(2131952973));
stopUpdate();
getBinding().timerText.stopTimer();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$showFailedInfo$1(this, null), 3, (Object) null);
}
private final void showInfoMessage() {
ImageView imageView = getBinding().upiQrImage;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.upiQrImage");
imageView.setVisibility(8);
ImageView imageView2 = getBinding().qrImage;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.qrImage");
imageView2.setVisibility(8);
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(8);
View view2 = getBinding().paymentWaitingParent;
Intrinsics.checkNotNullExpressionValue(view2, "binding.paymentWaitingParent");
view2.setVisibility(0);
getBinding().goBack.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
QRPaymentActivity.showInfoMessage$lambda$3(QRPaymentActivity.this, view3);
}
});
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$showInfoMessage$2(this, null), 3, (Object) null);
}
public static final void showInfoMessage$lambda$3(QRPaymentActivity qRPaymentActivity, View view) {
Intrinsics.checkNotNullParameter(qRPaymentActivity, "this$0");
qRPaymentActivity.stopUpdate();
qRPaymentActivity.finish();
}
private final void verifyPayment(String orderID) {
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new QRPaymentActivity$verifyPayment$1(this, orderID, null), 3, (Object) null);
}
private final void shareImageToWhatsApp(Context context, ImageView imageView) {
Drawable drawable = imageView.getDrawable();
if (drawable instanceof BitmapDrawable) {
try {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
File file = new File(context.getCacheDir(), "image.png");
file.createNewFile();
FileOutputStream fileOutputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
fileOutputStream.close();
Uri uriForFile = FileProvider.getUriForFile(context, "app.b1k0.provider", file);
grantUriPermission("com.whatsapp", uriForFile, 3);
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("image/*");
intent.putExtra("android.intent.extra.STREAM", uriForFile);
intent.setPackage("com.whatsapp");
intent.addFlags(1);
context.startActivity(Intent.createChooser(intent, "Share Image"));
return;
} catch (Exception e) {
Timber.e(e);
return;
}
}
Toast.makeText(context, "No image to share", 0).show();
}
private final void downloadAndSaveImage(final Context context, final ImageView imageView) {
LocalDB.databaseWriteExecutor.execute(new Runnable() {
@Override
public final void run() {
QRPaymentActivity.downloadAndSaveImage$lambda$10(imageView, this, context);
}
});
}
public static final void downloadAndSaveImage$lambda$10(ImageView imageView, QRPaymentActivity qRPaymentActivity, final Context context) {
FileOutputStream fileOutputStream;
OutputStream openOutputStream;
Intrinsics.checkNotNullParameter(imageView, "$imageView");
Intrinsics.checkNotNullParameter(qRPaymentActivity, "this$0");
Intrinsics.checkNotNullParameter(context, "$context");
try {
Drawable drawable = imageView.getDrawable();
if (drawable instanceof BitmapDrawable) {
try {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
String str = "img_" + System.currentTimeMillis();
if (qRPaymentActivity.getIntent().getStringExtra("fileName") != null) {
str = qRPaymentActivity.getIntent().getStringExtra("fileName");
}
if (Build.VERSION.SDK_INT >= 29) {
ContentValues contentValues = new ContentValues();
contentValues.put("_display_name", str);
contentValues.put("mime_type", "image/jpeg");
contentValues.put("relative_path", Environment.DIRECTORY_PICTURES);
ContentResolver contentResolver = context.getContentResolver();
Uri insert = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
if (insert != null && (openOutputStream = contentResolver.openOutputStream(insert)) != null) {
fileOutputStream = openOutputStream;
try {
Boolean.valueOf(bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream));
CloseableKt.closeFinally(fileOutputStream, (Throwable) null);
} finally {
try {
throw th;
} finally {
}
}
}
} else {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), str + ".jpg");
fileOutputStream = new FileOutputStream(file);
try {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
CloseableKt.closeFinally(fileOutputStream, (Throwable) null);
MediaScannerConnection.scanFile(context, new String[]{file.getAbsolutePath()}, null, null);
} finally {
}
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
QRPaymentActivity.downloadAndSaveImage$lambda$10$lambda$8(context);
}
});
} catch (Exception e) {
Timber.e(e);
}
}
} catch (Exception e2) {
Timber.e(e2);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
QRPaymentActivity.downloadAndSaveImage$lambda$10$lambda$9(context, e2);
}
});
}
}
public static final void downloadAndSaveImage$lambda$10$lambda$8(Context context) {
Intrinsics.checkNotNullParameter(context, "$context");
Toast.makeText(context, "Image saved in gallery.", 0).show();
}
public static final void downloadAndSaveImage$lambda$10$lambda$9(Context context, Exception exc) {
Intrinsics.checkNotNullParameter(context, "$context");
Intrinsics.checkNotNullParameter(exc, "$e");
Toast.makeText(context, "Error: " + exc.getMessage(), 0).show();
}
public void onBackPressed() {
DialogHelper.showReasonDialog((Context) this, getString(2131953083), getString(2131952110), false, new DialogHelper.Listener() {
@Override
public void onNegativeClick() {
}
@Override
public void onPositiveClick() {
String orderId = QRPaymentActivity.this.getOrderId();
if (orderId == null || orderId.length() == 0) {
QRPaymentActivity.this.finish();
} else {
QRPaymentActivity qRPaymentActivity = QRPaymentActivity.this;
qRPaymentActivity.orderFiledResponse(qRPaymentActivity.getOrderId());
}
}
});
}
}