Skip to content

Releases: CyonCode/MonetizationKit

0.2.0 — Critical fixes

14 May 10:27

Choose a tag to compare

Addresses 5 critical findings from the post-0.1.0 code review.

Critical fixes:

  • Concurrency: MonetizationEngine, TransactionObserver, and ProductCatalog are now @MainActor-isolated. The background Transaction.updates listener task runs as Task { @MainActor in ... }. All @unchecked Sendable removed from production code. Delegate callbacks and eventListener are guaranteed main-thread.
  • Testable purchase flow: New PurchaseClient protocol abstracts Product.purchase(options:). MockPurchaseClient lets tests drive purchase outcomes (success/cancelled/pending/unverified) without StoreKit. The 0.1.0 purchase code path was effectively untested — 0.2.0 closes that gap.
  • IDFV bridge safety: New configure(requiresAppAccountToken: true) flag. When set, the SDK throws MonetizationError.missingAppAccountToken if UIDevice.current.identifierForVendor returns nil at purchase time, preventing the silent-unjoinable-revenue failure mode for the AttributionKit bridge.
  • Type erasure correctness: AnyAsyncSequence now captures the wrapped sequence (not its iterator) and creates a fresh iterator on each makeAsyncIterator() call. Previously refreshEntitlements() would silently consume a shared iterator on second iteration.
  • Removed EnvironmentValues.monetization: MainActor.assumeIsolated in EnvironmentKey.defaultValue was unsafe in preview/test contexts. Host apps should reach MonetizationKit.shared directly.

Other:

  • README quick start uses Logger instead of print (matches the no-print constraint that the SDK itself enforces).
  • AGENTS.md documents the new concurrency model and the IDFV bridge.

Tests: 53 → 64. Added purchase flow coverage (success / cancelled / pending / unverified / IDFV pass-through / IDFV-required-but-nil), AnyAsyncSequence multi-iteration safety, and requiresAppAccountToken config tests.

Backwards compatibility: configure(requiresAppAccountToken:) defaults to false, preserving 0.1.0 behavior. Public facade methods (configure, purchase(_ product:), restore, etc.) unchanged. Removing EnvironmentValues.monetization is a breaking change for SwiftUI consumers — none known so far.

Original review report on file in the consumer project's PROJECT_STATUS.md.

0.1.0

14 May 08:33

Choose a tag to compare

Initial release of MonetizationKit.

Highlights:

  • Native StoreKit 2 subscription / IAP wrapper, zero dependencies.
  • 11 analytics events with snake_case schema.
  • Protocol-driven design (ProductLoading / TransactionStreaming) for fully mockable tests — 53 tests, 6 suites, all green.
  • SwiftUI @Environment(\.monetization) bridge.
  • IDFV-as-appAccountToken for server-side join with AttributionKit via Apple Server Notifications V2.

First integrated in Love Counter (Lifetime Unlock, NonConsumable).