mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-19 06:59:10 +00:00
Adjust eligibility conditionals to Catalyst
- Replace os(iOS) with targetEnvironment(macCatalyst) - Reuse same beta condition on Catalyst (must test to confirm)
This commit is contained in:
parent
f1aa192c9c
commit
adbc086061
@ -70,25 +70,20 @@ extension Constants {
|
||||
return isBeta ? .beta : .freemium
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
static let lastFullVersionBuild: (Int, LocalProduct) = (2016, .fullVersion_iOS)
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
static let lastFullVersionBuild: (Int, LocalProduct) = (0, .fullVersion_macOS)
|
||||
#else
|
||||
static let lastFullVersionBuild: (Int, LocalProduct) = (2016, .fullVersion_iOS)
|
||||
#endif
|
||||
|
||||
static let lastNetworkSettingsBuild = 2999
|
||||
|
||||
private static var isBeta: Bool {
|
||||
#if os(iOS)
|
||||
#if targetEnvironment(simulator)
|
||||
return true
|
||||
#else
|
||||
return Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
|
||||
#endif
|
||||
#else
|
||||
// TODO: production, skip TestFlight on macOS until beta condition is clearly determined
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,10 +251,10 @@ extension Constants {
|
||||
}
|
||||
|
||||
enum Rating {
|
||||
#if os(iOS)
|
||||
static let eventCount = 3
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
static let eventCount = 10
|
||||
#else
|
||||
static let eventCount = 3
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -183,10 +183,10 @@ class ProductManager: NSObject, ObservableObject {
|
||||
// MARK: In-app eligibility
|
||||
|
||||
private func isCurrentPlatformVersion() -> Bool {
|
||||
#if os(iOS)
|
||||
return purchasedFeatures.contains(.fullVersion_iOS)
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
return purchasedFeatures.contains(.fullVersion_macOS)
|
||||
#else
|
||||
return purchasedFeatures.contains(.fullVersion_iOS)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -206,10 +206,10 @@ class ProductManager: NSObject, ObservableObject {
|
||||
return true
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
return isFullVersion() || purchasedFeatures.contains(feature)
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
return isFullVersion()
|
||||
#else
|
||||
return isFullVersion() || purchasedFeatures.contains(feature)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -299,12 +299,12 @@ extension ProductManager {
|
||||
let hasCancelledFullVersion: Bool
|
||||
let hasCancelledTrustedNetworks: Bool
|
||||
|
||||
#if os(iOS)
|
||||
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_iOS))
|
||||
hasCancelledTrustedNetworks = !isEligibleForFullVersion && isCancelledPurchase(.trustedNetworks)
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_macOS))
|
||||
hasCancelledTrustedNetworks = false
|
||||
#else
|
||||
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_iOS))
|
||||
hasCancelledTrustedNetworks = !isEligibleForFullVersion && isCancelledPurchase(.trustedNetworks)
|
||||
#endif
|
||||
|
||||
// review features and potentially revert them if they were used (Siri is handled in AppDelegate)
|
||||
|
@ -189,21 +189,21 @@ extension PaywallView.PurchaseView {
|
||||
}
|
||||
|
||||
private var skPlatformVersion: SKProduct? {
|
||||
#if os(iOS)
|
||||
return productManager.product(withIdentifier: .fullVersion_iOS)
|
||||
#else
|
||||
#if targetEnvironment(macCatalyst)
|
||||
return productManager.product(withIdentifier: .fullVersion_macOS)
|
||||
#else
|
||||
return productManager.product(withIdentifier: .fullVersion_iOS)
|
||||
#endif
|
||||
}
|
||||
|
||||
// hide full version if already bought the other platform version
|
||||
private var skFullVersion: SKProduct? {
|
||||
#if os(iOS)
|
||||
guard !productManager.hasPurchased(.fullVersion_macOS) else {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
guard !productManager.hasPurchased(.fullVersion_iOS) else {
|
||||
return nil
|
||||
}
|
||||
#else
|
||||
guard !productManager.hasPurchased(.fullVersion_iOS) else {
|
||||
guard !productManager.hasPurchased(.fullVersion_macOS) else {
|
||||
return nil
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user