Wrap/refine a few OS conditionals
This commit is contained in:
parent
16d618df0e
commit
f5e01f9768
|
@ -173,11 +173,7 @@ class ProductManager: NSObject, ObservableObject {
|
||||||
// MARK: In-app eligibility
|
// MARK: In-app eligibility
|
||||||
|
|
||||||
private func isCurrentPlatformVersion() -> Bool {
|
private func isCurrentPlatformVersion() -> Bool {
|
||||||
#if targetEnvironment(macCatalyst)
|
purchasedFeatures.contains(isMac ? .fullVersion_macOS : .fullVersion_iOS)
|
||||||
return purchasedFeatures.contains(.fullVersion_macOS)
|
|
||||||
#else
|
|
||||||
return purchasedFeatures.contains(.fullVersion_iOS)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func isFullVersion() -> Bool {
|
private func isFullVersion() -> Bool {
|
||||||
|
@ -196,11 +192,11 @@ class ProductManager: NSObject, ObservableObject {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if targetEnvironment(macCatalyst)
|
if isMac {
|
||||||
return isFullVersion()
|
return isFullVersion()
|
||||||
#else
|
} else {
|
||||||
return isFullVersion() || purchasedFeatures.contains(feature)
|
return isFullVersion() || purchasedFeatures.contains(feature)
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isEligible(forProvider providerName: ProviderName) -> Bool {
|
func isEligible(forProvider providerName: ProviderName) -> Bool {
|
||||||
|
@ -289,15 +285,25 @@ extension ProductManager {
|
||||||
let hasCancelledFullVersion: Bool
|
let hasCancelledFullVersion: Bool
|
||||||
let hasCancelledTrustedNetworks: Bool
|
let hasCancelledTrustedNetworks: Bool
|
||||||
|
|
||||||
#if targetEnvironment(macCatalyst)
|
if isMac {
|
||||||
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_macOS))
|
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_macOS))
|
||||||
hasCancelledTrustedNetworks = false
|
hasCancelledTrustedNetworks = false
|
||||||
#else
|
} else {
|
||||||
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_iOS))
|
hasCancelledFullVersion = !isEligibleForFullVersion && (isCancelledPurchase(.fullVersion) || isCancelledPurchase(.fullVersion_iOS))
|
||||||
hasCancelledTrustedNetworks = !isEligibleForFullVersion && isCancelledPurchase(.trustedNetworks)
|
hasCancelledTrustedNetworks = !isEligibleForFullVersion && isCancelledPurchase(.trustedNetworks)
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// review features and potentially revert them if they were used (Siri is handled in AppDelegate)
|
// review features and potentially revert them if they were used (Siri is handled in AppDelegate)
|
||||||
return hasCancelledFullVersion || hasCancelledTrustedNetworks
|
return hasCancelledFullVersion || hasCancelledTrustedNetworks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension ProductManager {
|
||||||
|
private var isMac: Bool {
|
||||||
|
#if targetEnvironment(macCatalyst)
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue