mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Add several registered checks.
This commit is contained in:
committed by
Cody Henthorne
parent
076b47e695
commit
629f5a3a3d
@@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobmanager.JobManager.Chain
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.whispersystems.signalservice.internal.ServiceResponse
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.InAppPaymentReceiptCredentialError
|
||||
import java.io.IOException
|
||||
@@ -112,6 +113,11 @@ class InAppPaymentOneTimeContextJob private constructor(
|
||||
}
|
||||
|
||||
override fun onRun() {
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
warning("User is not registered. Failing.")
|
||||
throw Exception("Unregistered users cannot perform this job.")
|
||||
}
|
||||
|
||||
val (inAppPayment, requestContext) = getAndValidateInAppPayment()
|
||||
|
||||
info("Submitting request context to server...")
|
||||
|
||||
@@ -140,6 +140,11 @@ class InAppPaymentRecurringContextJob private constructor(
|
||||
}
|
||||
|
||||
private fun doRun() {
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
warning("User is not registered. Failing.")
|
||||
throw Exception("Unregistered users cannot perform this job.")
|
||||
}
|
||||
|
||||
val (inAppPayment, requestContext) = getAndValidateInAppPayment()
|
||||
val activeSubscription = getActiveSubscription(inAppPayment)
|
||||
val subscription = activeSubscription.activeSubscription
|
||||
|
||||
@@ -142,6 +142,11 @@ class InAppPaymentRedemptionJob private constructor(
|
||||
}
|
||||
|
||||
override fun onRun() {
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
Log.w(TAG, "User is not registered. Failing.")
|
||||
throw Exception("Unregistered users cannot perform this job.")
|
||||
}
|
||||
|
||||
if (jobData.inAppPaymentId != null) {
|
||||
onRunForInAppPayment(InAppPaymentTable.InAppPaymentId(jobData.inAppPaymentId))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user