Clean up IAP receipt loop

This commit is contained in:
Davide De Rosa 2019-11-09 18:29:23 +01:00
parent 2c6033f20a
commit 4ee56d8e7b
1 changed files with 6 additions and 9 deletions

View File

@ -139,18 +139,15 @@ class ProductManager: NSObject {
if let iapReceipts = receipt.inAppPurchaseReceipts {
log.debug("In-app receipts:")
iapReceipts.forEach {
guard let pid = $0.productIdentifier, let purchaseDate = $0.originalPurchaseDate else {
guard let pid = $0.productIdentifier, let product = Product(rawValue: pid) else {
return
}
log.debug("\t\(pid) [purchased on: \(purchaseDate)]")
}
for r in iapReceipts {
guard let pid = r.productIdentifier, let product = Product(rawValue: pid) else {
continue
}
if let cancellationDate = r.cancellationDate {
if let cancellationDate = $0.cancellationDate {
log.debug("\t\(pid) [cancelled on: \(cancellationDate)]")
continue
return
}
if let purchaseDate = $0.originalPurchaseDate {
log.debug("\t\(pid) [purchased on: \(purchaseDate)]")
}
purchasedFeatures.insert(product)
}