Prevent multi-platform purchase when redundant

This commit is contained in:
Davide De Rosa 2021-02-07 15:28:30 +01:00
parent 96189b410f
commit a41aa6d35e
3 changed files with 6 additions and 2 deletions

View File

@ -72,7 +72,7 @@ class PurchaseViewController: UITableViewController, StrongTableHost {
}.sortedCaseInsensitive() }.sortedCaseInsensitive()
platformVersionExtra = bullets.joined(separator: "\n") platformVersionExtra = bullets.joined(separator: "\n")
} }
if let skFullVersion = pm.product(withIdentifier: .fullVersion) { if !pm.hasPurchased(.fullVersion_macOS), let skFullVersion = pm.product(withIdentifier: .fullVersion) {
self.skFullVersion = skFullVersion self.skFullVersion = skFullVersion
rows.append(.fullVersion) rows.append(.fullVersion)

View File

@ -80,7 +80,7 @@ class PurchaseViewController: NSViewController {
}.sortedCaseInsensitive() }.sortedCaseInsensitive()
platformVersionExtra = bullets.joined(separator: "\n") platformVersionExtra = bullets.joined(separator: "\n")
} }
if let skFullVersion = pm.product(withIdentifier: .fullVersion) { if !pm.hasPurchased(.fullVersion_iOS), let skFullVersion = pm.product(withIdentifier: .fullVersion) {
self.skFullVersion = skFullVersion self.skFullVersion = skFullVersion
rows.append(.fullVersion) rows.append(.fullVersion)

View File

@ -232,6 +232,10 @@ public class ProductManager: NSObject {
} }
} }
public func hasPurchased(_ product: Product) -> Bool {
return purchasedFeatures.contains(product)
}
public func isCancelledPurchase(_ product: Product) -> Bool { public func isCancelledPurchase(_ product: Product) -> Bool {
return cancelledPurchases.contains(product) return cancelledPurchases.contains(product)
} }