From 3fb1a607cf0868153854ea73eba967385ada563b Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 4 Feb 2021 13:34:42 +0100 Subject: [PATCH] Extend features retrieval with excluding filter --- .../App/iOS/Scenes/Purchase/PurchaseViewController.swift | 2 +- Passepartout/Core/Sources/Model/ProductManager.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Passepartout/App/iOS/Scenes/Purchase/PurchaseViewController.swift b/Passepartout/App/iOS/Scenes/Purchase/PurchaseViewController.swift index dd6a822c..1073af79 100644 --- a/Passepartout/App/iOS/Scenes/Purchase/PurchaseViewController.swift +++ b/Passepartout/App/iOS/Scenes/Purchase/PurchaseViewController.swift @@ -70,7 +70,7 @@ class PurchaseViewController: UITableViewController, StrongTableHost { rows.append(.restore) 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)" }.sortedCaseInsensitive() let featureBullets = featureBulletsList.joined(separator: "\n") diff --git a/Passepartout/Core/Sources/Model/ProductManager.swift b/Passepartout/Core/Sources/Model/ProductManager.swift index 601d54a6..c166efa5 100644 --- a/Passepartout/Core/Sources/Model/ProductManager.swift +++ b/Passepartout/Core/Sources/Model/ProductManager.swift @@ -118,12 +118,12 @@ public class ProductManager: NSObject { return inApp.product(withIdentifier: identifier) } - public func featureProducts(includingFullVersion: Bool) -> [SKProduct] { + public func featureProducts(excluding: [Product]) -> [SKProduct] { return inApp.products.filter { guard let p = Product(rawValue: $0.productIdentifier) else { return false } - guard includingFullVersion || p != .fullVersion else { + guard !excluding.contains(p) else { return false } guard p.isFeature else {