DebugPurchaseTracker
public class DebugPurchaseTracker : PurchaseTracker, PurchaseTrackerObserver
A purchase tracker that allows manually setting of purchase status.
This can be used standalone as a fake in-memory purchase tracker, or to proxy another purchase tracker implementation so that you can provide overrides at runtime for easier testing.
On iOS you can use the FlintUI PurchaseBrowserFeature
to show a simple UI in your app
that will let you view the status of purchases, and if this tracker is used, override the
purchase status at runtime for testing.
See
seePurchaseBrowserFeature
See
seeStoreKitPurchaseTracker
-
Undocumented
See moreDeclaration
Swift
public enum OverrideStatus
-
Undocumented
Declaration
Swift
public private(set) var purchaseOverrides: [String : DebugPurchaseTracker.OverrideStatus]
-
Initiliase a debug tracker that overrides another purchase tracker, if overrides are applied.
- param targetPurchaseTracker: The original purchase tracker that will be proxied to override purchase results.
Declaration
Swift
public init(targetPurchaseTracker: PurchaseTracker)
-
Initiliase a debug tracker that acts as the source of truth typically in development builds only. You must call
overridePurchase()
to enable or disable individual products, or use the FlintUIDebugPurchasesViewController
on iOS to toggle them at run time.Declaration
Swift
public init()
-
Called to force the purchase tracker This must betrue even if the user’s real purchase history indicates otherwise.
Declaration
Swift
public func overridePurchase(product: NonConsumableProduct, with result: OverrideStatus)
-
Called to indicate that the purchase tracker should behave as if this purchase has not been performed. This must be true even if the user’s real purchase history indicates otherwise.
Declaration
Swift
public func invalidatePurchaseOverride(product: NonConsumableProduct)
-
Called to force the purchase tracker This must betrue even if the user’s real purchase history indicates otherwise.
Declaration
Swift
public func overridePurchase(product: SubscriptionProduct, with result: OverrideStatus)
-
Called to indicate that the purchase tracker should behave as if this purchase has not been performed. This must be true even if the user’s real purchase history indicates otherwise.
Declaration
Swift
public func invalidatePurchaseOverride(product: SubscriptionProduct)
-
- return: The current overriden status of the specified product. This may
be
nil
indicating that there is no override in effect. - param product: The product for which you want to check the override status
Declaration
Swift
public func overridenStatus(for product: Product) -> OverrideStatus?
- return: The current overriden status of the specified product. This may
be
-
- return: The current actual status of the specified product, from the real target
purchase tracker. If there is no real purchase tracker, the result will always be
nil
. - param product: The product for which you want to check the real status
Declaration
Swift
public func realStatus(for product: Product) -> Bool?
- return: The current actual status of the specified product, from the real target
purchase tracker. If there is no real purchase tracker, the result will always be
-
Remove all the overrides in effect
Declaration
Swift
public func invalidateAllPurchaseOverrides()
-
Undocumented
Declaration
Swift
public func purchaseStatusDidChange(productID: String, isPurchased: Bool)
-
Declaration
Swift
public func addObserver(_ observer: PurchaseTrackerObserver)
-
Declaration
Swift
public func removeObserver(_ observer: PurchaseTrackerObserver)
-
Declaration
Swift
public func isPurchased(_ product: NonConsumableProduct) -> Bool?
-
Declaration
Swift
public func isSubscriptionActive(_ product: SubscriptionProduct) -> Bool?
-
We don’t support debug overrides for features as a whole currently
Declaration
Swift
public func isFeatureEnabledByPastPurchases(_ feature: FeatureDefinition.Type) -> Bool