mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Don't fail backup redemption pipeline after 24hrs.
This commit is contained in:
@@ -38,6 +38,7 @@ import org.thoughtcrime.securesms.util.parcelers.MillisecondDurationParceler
|
||||
import org.thoughtcrime.securesms.util.parcelers.NullableSubscriberIdParceler
|
||||
import org.whispersystems.signalservice.api.subscriptions.SubscriberId
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
@@ -184,6 +185,20 @@ class InAppPaymentTable(context: Context, databaseHelper: SignalDatabase) : Data
|
||||
AppDependencies.databaseObserver.notifyInAppPaymentsObservers(inAppPayment)
|
||||
}
|
||||
|
||||
fun getOldPendingPayments(type: InAppPaymentType): List<InAppPayment> {
|
||||
val oneDayAgo = System.currentTimeMillis().milliseconds - 24.hours
|
||||
return readableDatabase
|
||||
.select()
|
||||
.from(TABLE_NAME)
|
||||
.where(
|
||||
"$STATE = ? AND $TYPE = ? AND $UPDATED_AT <= ${oneDayAgo.inWholeSeconds}",
|
||||
State.serialize(State.PENDING),
|
||||
InAppPaymentType.serialize(type)
|
||||
)
|
||||
.run()
|
||||
.readToList(mapper = InAppPayment::deserialize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the user has submitted a pre-pending recurring donation.
|
||||
* In this state, the user would have had to cancel their subscription or be in the process of trying
|
||||
|
||||
Reference in New Issue
Block a user