导航菜单

页面标题

页面副标题

Biko v2.0.23 - QrPaymentService.java 源代码

正在查看: Biko v2.0.23 应用的 QrPaymentService.java JAVA 源代码文件

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


package app.callpe.service;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import androidx.core.app.ServiceCompat;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.RxBus;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.ui.call.ZegoVideoCallActivity;
import app.callpe.ui.payment.PaymentDetailsActivity;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;

@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0007\u0018\u0000 \u001e2\u00020\u0001:\u0001\u001eB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u000e\u001a\u00020\u000fH\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0003J\u0010\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0015H\u0002J\u0012\u0010\u0016\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u0018\u001a\u00020\u0019H\u0016J\b\u0010\u001a\u001a\u00020\u0011H\u0016J\"\u0010\u001b\u001a\u00020\u00132\b\u0010\u0018\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u001c\u001a\u00020\u00132\u0006\u0010\u001d\u001a\u00020\u0013H\u0016R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010\u0005\u001a\u00020\u00068\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\nR\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u001f"}, d2 = {"Lapp/callpe/service/QrPaymentService;", "Landroid/app/Service;", "()V", "job", "Lkotlinx/coroutines/Job;", "rxBus", "Lapp/callpe/common/utils/RxBus;", "getRxBus", "()Lapp/callpe/common/utils/RxBus;", "setRxBus", "(Lapp/callpe/common/utils/RxBus;)V", "timeLeft", "", "topUpId", "createNotification", "Landroid/app/Notification;", "createNotificationChanel", "", "getNotificationIcon", "", "notificationBuilder", "Landroidx/core/app/NotificationCompat$Builder;", "onBind", "Landroid/os/IBinder;", "intent", "Landroid/content/Intent;", "onDestroy", "onStartCommand", "flags", "startId", "Companion", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class QrPaymentService extends Hilt_QrPaymentService {
    public static final long INTERVAL = 2000;
    public static final String TIME_LEFT = "TIME_LEFT";
    public static final String TOP_UP_ID = "TOP_UP_ID";
    private Job job;

    @Inject
    public RxBus rxBus;
    private long topUpId = -1;
    private long timeLeft = -1;

    @Override
    public IBinder onBind(Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        return null;
    }

    public final RxBus getRxBus() {
        RxBus rxBus = this.rxBus;
        if (rxBus != null) {
            return rxBus;
        }
        Intrinsics.throwUninitializedPropertyAccessException("rxBus");
        return null;
    }

    public final void setRxBus(RxBus rxBus) {
        Intrinsics.checkNotNullParameter(rxBus, "<set-?>");
        this.rxBus = rxBus;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);
        this.topUpId = intent != null ? intent.getLongExtra(TOP_UP_ID, -1L) : -1L;
        this.timeLeft = intent != null ? intent.getLongExtra(TIME_LEFT, -1L) : -1L;
        this.job = BuildersKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getDefault()), (CoroutineContext) null, (CoroutineStart) null, new QrPaymentService$onStartCommand$1(null), 3, (Object) null);
        if (Build.VERSION.SDK_INT > 26) {
            createNotificationChanel();
            return 1;
        }
        startForeground(150, createNotification());
        return 1;
    }

    private final Notification createNotification() {
        QrPaymentService qrPaymentService = this;
        Intent intent = new Intent(qrPaymentService, (Class<?>) ZegoVideoCallActivity.class);
        intent.putExtra(Constants.FROM_NOTIFICATION_CLICK, true);
        intent.putExtra(Constants.KEY_CALLING_VIDEO_ID, this.topUpId);
        PendingIntent activity = PendingIntent.getActivity(qrPaymentService, 0, intent, 201326592);
        NotificationCompat.Builder priority = new NotificationCompat.Builder(qrPaymentService, "payment_channel").setUsesChronometer(true).setShowWhen(true).setContentText("Payment in progress").setPriority(0);
        Intrinsics.checkNotNullExpressionValue(priority, "Builder(this, \"payment_c…nCompat.PRIORITY_DEFAULT)");
        priority.setSmallIcon(getNotificationIcon(priority));
        priority.setContentIntent(activity);
        Notification build = priority.build();
        Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
        return build;
    }

    private final void createNotificationChanel() {
        QrPaymentService qrPaymentService = this;
        Intrinsics.areEqual(SharedPref.getString(qrPaymentService, PrefKeys.USER_ROLE), "STREAMER");
        Intent intent = new Intent(qrPaymentService, (Class<?>) PaymentDetailsActivity.class);
        intent.putExtra(Constants.FROM_NOTIFICATION_CLICK, true);
        intent.putExtra("topUpId", this.topUpId);
        intent.putExtra(TIME_LEFT, this.timeLeft);
        PendingIntent activity = PendingIntent.getActivity(qrPaymentService, 0, intent, 201326592);
        Object systemService = getSystemService("notification");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        NotificationChannel notificationChannel = new NotificationChannel("9002", "Payment", 4);
        notificationChannel.enableLights(true);
        notificationChannel.enableVibration(true);
        notificationChannel.setLightColor(2131099815);
        notificationChannel.setLockscreenVisibility(1);
        notificationChannel.setDescription("Payment");
        notificationManager.createNotificationChannel(notificationChannel);
        NotificationCompat.Builder ongoing = new NotificationCompat.Builder(qrPaymentService, "9002").setContentText("Payment in progress").setAutoCancel(false).setContentIntent(activity).setUsesChronometer(true).setShowWhen(true).setOngoing(true);
        Intrinsics.checkNotNullExpressionValue(ongoing, "Builder(this, \"9002\")\n  …        .setOngoing(true)");
        ongoing.setSmallIcon(getNotificationIcon(ongoing));
        Notification build = ongoing.build();
        Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
        notificationManager.notify(150, build);
        if (Build.VERSION.SDK_INT >= 34) {
            ServiceCompat.startForeground(this, 150, build, 4);
        } else {
            startForeground(150, build);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Job job = this.job;
        if (job != null) {
            Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
        }
    }

    private final int getNotificationIcon(NotificationCompat.Builder notificationBuilder) {
        notificationBuilder.setColor(32768);
        return 2131231746;
    }
}