这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/ProMotion/iap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ def transaction_product_id(transaction)
transaction.respond_to?(:payment) ? transaction.payment.productIdentifier : "all"
end

def transaction_complete?(transactions)
states = transactions.map(&:transactionState)
return true unless states.include?(SKPaymentTransactionStatePurchasing)
false
end

public

# SKProductsRequestDelegate methods
Expand Down Expand Up @@ -160,6 +166,7 @@ def paymentQueue(_, updatedTransactions:transactions)
end
end
end
iap_shutdown if transaction_complete?(transactions)
end

def paymentQueue(_, restoreCompletedTransactionsFailedWithError:error)
Expand Down