Extend features retrieval with excluding filter

This commit is contained in:
Davide De Rosa 2021-02-04 13:34:42 +01:00
parent 9566bac598
commit 3fb1a607cf
2 changed files with 3 additions and 3 deletions

View File

@ -70,7 +70,7 @@ class PurchaseViewController: UITableViewController, StrongTableHost {
rows.append(.restore) rows.append(.restore)
model.set(rows, forSection: .products) model.set(rows, forSection: .products)
let featureBulletsList: [String] = ProductManager.shared.featureProducts(includingFullVersion: false).map { let featureBulletsList: [String] = ProductManager.shared.featureProducts(excluding: [.fullVersion, .fullVersion_iOS]).map {
return "- \($0.localizedTitle)" return "- \($0.localizedTitle)"
}.sortedCaseInsensitive() }.sortedCaseInsensitive()
let featureBullets = featureBulletsList.joined(separator: "\n") let featureBullets = featureBulletsList.joined(separator: "\n")

View File

@ -118,12 +118,12 @@ public class ProductManager: NSObject {
return inApp.product(withIdentifier: identifier) return inApp.product(withIdentifier: identifier)
} }
public func featureProducts(includingFullVersion: Bool) -> [SKProduct] { public func featureProducts(excluding: [Product]) -> [SKProduct] {
return inApp.products.filter { return inApp.products.filter {
guard let p = Product(rawValue: $0.productIdentifier) else { guard let p = Product(rawValue: $0.productIdentifier) else {
return false return false
} }
guard includingFullVersion || p != .fullVersion else { guard !excluding.contains(p) else {
return false return false
} }
guard p.isFeature else { guard p.isFeature else {