mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Implement happy path for backups subscriptions.
This commit is contained in:
committed by
Greyson Parrelli
parent
c80ebd5658
commit
81d99c9d30
@@ -177,6 +177,11 @@ class InAppPaymentPurchaseTokenJob private constructor(
|
||||
info("Scheduling retry.")
|
||||
throw InAppPaymentRetryException()
|
||||
}
|
||||
|
||||
else -> {
|
||||
warning("An unknown error occurred.", applicationError)
|
||||
throw IOException(applicationError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.jobs
|
||||
|
||||
import okio.ByteString.Companion.toByteString
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.donations.InAppPaymentType
|
||||
import org.signal.libsignal.zkgroup.VerificationFailedException
|
||||
import org.signal.libsignal.zkgroup.receipts.ReceiptCredential
|
||||
import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialPresentation
|
||||
@@ -65,11 +66,17 @@ class InAppPaymentRecurringContextJob private constructor(
|
||||
* meaning the job will always load the freshest data it can about the payment.
|
||||
*/
|
||||
fun createJobChain(inAppPayment: InAppPaymentTable.InAppPayment, makePrimary: Boolean = false): Chain {
|
||||
return AppDependencies.jobManager
|
||||
.startChain(create(inAppPayment))
|
||||
.then(InAppPaymentRedemptionJob.create(inAppPayment, makePrimary))
|
||||
.then(RefreshOwnProfileJob())
|
||||
.then(MultiDeviceProfileContentUpdateJob())
|
||||
return if (inAppPayment.type == InAppPaymentType.RECURRING_BACKUP) {
|
||||
AppDependencies.jobManager
|
||||
.startChain(create(inAppPayment))
|
||||
.then(InAppPaymentRedemptionJob.create(inAppPayment, makePrimary))
|
||||
} else {
|
||||
AppDependencies.jobManager
|
||||
.startChain(create(inAppPayment))
|
||||
.then(InAppPaymentRedemptionJob.create(inAppPayment, makePrimary))
|
||||
.then(RefreshOwnProfileJob())
|
||||
.then(MultiDeviceProfileContentUpdateJob())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.thoughtcrime.securesms.jobs
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.donations.InAppPaymentType
|
||||
import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialPresentation
|
||||
import org.thoughtcrime.securesms.backup.v2.MessageBackupTier
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository.requireSubscriberType
|
||||
import org.thoughtcrime.securesms.database.InAppPaymentTable
|
||||
@@ -252,6 +253,12 @@ class InAppPaymentRedemptionJob private constructor(
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if (inAppPayment.type == InAppPaymentType.RECURRING_BACKUP) {
|
||||
Log.i(TAG, "Enabling backups and setting backup tier to PAID", true)
|
||||
SignalStore.backup.areBackupsEnabled = true
|
||||
SignalStore.backup.backupTier = MessageBackupTier.PAID
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> verifyServiceResponse(serviceResponse: ServiceResponse<T>, onFatalError: (Int) -> Unit = {}) {
|
||||
|
||||
Reference in New Issue
Block a user