Releases: CyonCode/MonetizationKit
0.2.0 — Critical fixes
Addresses 5 critical findings from the post-0.1.0 code review.
Critical fixes:
- Concurrency:
MonetizationEngine,TransactionObserver, andProductCatalogare now@MainActor-isolated. The backgroundTransaction.updateslistener task runs asTask { @MainActor in ... }. All@unchecked Sendableremoved from production code. Delegate callbacks andeventListenerare guaranteed main-thread. - Testable purchase flow: New
PurchaseClientprotocol abstractsProduct.purchase(options:).MockPurchaseClientlets 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 throwsMonetizationError.missingAppAccountTokenifUIDevice.current.identifierForVendorreturns nil at purchase time, preventing the silent-unjoinable-revenue failure mode for the AttributionKit bridge. - Type erasure correctness:
AnyAsyncSequencenow captures the wrapped sequence (not its iterator) and creates a fresh iterator on eachmakeAsyncIterator()call. PreviouslyrefreshEntitlements()would silently consume a shared iterator on second iteration. - Removed
EnvironmentValues.monetization:MainActor.assumeIsolatedinEnvironmentKey.defaultValuewas unsafe in preview/test contexts. Host apps should reachMonetizationKit.shareddirectly.
Other:
- README quick start uses
Loggerinstead ofprint(matches the no-printconstraint 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
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-
appAccountTokenfor server-side join with AttributionKit via Apple Server Notifications V2.
First integrated in Love Counter (Lifetime Unlock, NonConsumable).