From d76a248bd029130d3ebcfd1e69db42c00ae92e3f Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 5 Feb 2021 18:47:32 +0100 Subject: [PATCH] Make full version check for old builds nicer --- Passepartout/Core/Sources/AppConstants.swift | 4 ++-- Passepartout/Core/Sources/Model/ProductManager.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Passepartout/Core/Sources/AppConstants.swift b/Passepartout/Core/Sources/AppConstants.swift index bf305d35..67acb1de 100644 --- a/Passepartout/Core/Sources/AppConstants.swift +++ b/Passepartout/Core/Sources/AppConstants.swift @@ -357,11 +357,11 @@ public class AppConstants { return ProcessInfo.processInfo.environment["FULL_VERSION"] != nil } - static let lastFullVersionBuild = 2016 + static let lastFullVersionBuild: (Int, Product) = (2016, .fullVersion_iOS) #else static let isBetaFullVersion = false - static let lastFullVersionBuild = 0 + static let lastFullVersionBuild: (Int, Product) = (0, .fullVersion_macOS) #endif } } diff --git a/Passepartout/Core/Sources/Model/ProductManager.swift b/Passepartout/Core/Sources/Model/ProductManager.swift index 29a5f4ac..62b9dc14 100644 --- a/Passepartout/Core/Sources/Model/ProductManager.swift +++ b/Passepartout/Core/Sources/Model/ProductManager.swift @@ -44,12 +44,12 @@ public class ProductManager: NSObject { public let isBetaFullVersion: Bool - public let lastFullVersionBuild: Int + public let lastFullVersionBuild: (Int, Product) public init( locksBetaFeatures: Bool, isBetaFullVersion: Bool, - lastFullVersionBuild: Int + lastFullVersionBuild: (Int, Product) ) { self.locksBetaFeatures = locksBetaFeatures self.isBetaFullVersion = isBetaFullVersion @@ -258,8 +258,8 @@ public class ProductManager: NSObject { log.debug("Original purchased build: \(buildNumber)") // treat former purchases as full versions - if buildNumber <= cfg.lastFullVersionBuild { - purchasedFeatures.insert(.fullVersion_iOS) + if buildNumber <= cfg.lastFullVersionBuild.0 { + purchasedFeatures.insert(cfg.lastFullVersionBuild.1) } } if let iapReceipts = receipt.inAppPurchaseReceipts {