Managers and Utils

Purchase Manager

PurchaseManager

PurchaseManager.swift

Purpose:
Manages the purchase lifecycle, which includes loading available products, making purchases, restoring purchases, and keeping track of what the user purchased.

Key Functions:

  • loadProducts: Fetches products from the App Store based on given product IDs and makes them available for purchase.
  • purchase: Initiates a purchase of a selected product and handles the result, which can be successful, pending, or failed due to user cancellation.
  • updatePurchasedProducts: Updates the user's purchased products based on completed transactions.
  • observeTransactionUpdates: A background task that listens for updates from StoreKit regarding transactions and reacts accordingly.

Usage:
Mainly used within paywall views (Paywall1View, Paywall2View, Paywall3View) to present the user with purchase options and handle their transaction responses. It's also used in the SettingsView to give users the option to restore purchases or upgrade their subscription.

Previous
AuthManager