Skip to content

Commit

Permalink
Fix: sometimes the completion of restoring is queued earlier than upd…
Browse files Browse the repository at this point in the history
…ating transactions.
  • Loading branch information
mshibanami committed Jul 4, 2021
1 parent ecaddfc commit e5bb4a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/SwiftyStoreKit/PaymentQueueController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
}

func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: Error) {
restorationDispatchQueue.async { [weak self] in
restorationDispatchQueue.asyncAfter(deadline: .now() + 0.0001) { [weak self] in
self?.restorePurchasesController.restoreCompletedTransactionsFailed(withError: error)
}
}

func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
restorationDispatchQueue.async { [weak self] in
restorationDispatchQueue.asyncAfter(deadline: .now() + 0.0001) { [weak self] in
self?.restorePurchasesController.restoreCompletedTransactionsFinished()
}
}
Expand Down

0 comments on commit e5bb4a5

Please sign in to comment.