Skip to content

Commit

Permalink
Fix hot loop when creating a subscription to remote backups.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and greyson-signal committed Dec 9, 2024
1 parent 5e10ccc commit 0c86ff1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ class MessageBackupsFlowViewModel(
Log.d(TAG, "Got successful purchase result for purchase at ${result.purchaseTime}")
val id = internalStateFlow.value.inAppPayment!!.id

if (result.isAcknowledged) {
Log.w(TAG, "Payment is already acknowledged. Ignoring.")

internalStateFlow.update {
it.copy(
stage = MessageBackupsStage.COMPLETED
)
}

return@collect
}

try {
Log.d(TAG, "Attempting to handle successful purchase.")

Expand Down
2 changes: 0 additions & 2 deletions billing/src/main/java/org/signal/billing/BillingApiImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ internal class BillingApiImpl(
billingClient.queryPurchasesAsync(param)
}

purchasesUpdatedListener.onPurchasesUpdated(result.billingResult, result.purchasesList)

val purchase = result.purchasesList.maxByOrNull { it.purchaseTime } ?: return BillingPurchaseResult.None

return BillingPurchaseResult.Success(
Expand Down

0 comments on commit 0c86ff1

Please sign in to comment.