Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

UI refactor and store improvements#4

Merged
hyochan merged 5 commits intomainfrom
feat/ui-refactor-and-store-improvements
Sep 8, 2025
Merged

UI refactor and store improvements#4
hyochan merged 5 commits intomainfrom
feat/ui-refactor-and-store-improvements

Conversation

@hyochan
Copy link
Member

@hyochan hyochan commented Sep 7, 2025

This series of commits refactors the OpenIAP module by introducing structured concurrency and standardizing public models. IapState and ProductManager are now actors, with events and listeners marked @sendable and UIKit access restricted to MainActor. Public APIs adopt consistent OpenIap* naming, with typealiases provided for backward compatibility, while serialization is consolidated under OpenIapSerialization for safer bridging and analytics. The restorePurchases() method has been removed in favor of refreshPurchases(forceSync:), and error handling is centralized in OpenIapError. Supporting types like IapStatus are nested under OpenIapStore for a cleaner structure. These changes remove outdated availability checks and legacy fallbacks, aligning the codebase with the declared baselines (iOS 15+/tvOS 15+/macOS 14+), reducing maintenance overhead, and ensuring more predictable behavior without altering most external APIs.

@hyochan hyochan force-pushed the feat/ui-refactor-and-store-improvements branch from 0cc1a55 to 779631a Compare September 7, 2025 16:29
Align code with package platform baselines (iOS 15+, macOS 14+).\n\n- Remove redundant runtime availability checks and legacy fallbacks\n- Replace  with direct access\n- Always use ; drop URL fallback\n- Call  on main actor\n- Simplify  to return current  or error\n- Simplify  using compiler check; map verified/unverified\n\nMotivation: reduce dead code paths, avoid misleading behavior, and lower maintenance/testing burden.\nImpact: no public API changes; behavior consistent with supported platforms.\nNotes: Requires iOS 15+/tvOS 15+/macOS 14+ as declared in .
- Concurrency/events:
  - Introduce IapState actor for module state; convert ProductManager to actor
  - Make emit methods fire-and-forget; mark listeners @sendable
  - Restrict UIKit access to MainActor; set isInitialized before starting listeners; ignore Transaction.updates before init

- Public models:
  - Standardize on OpenIap* types and filenames (Product, Purchase, ActiveSubscription, ProductRequest, RequestPurchaseProps, ReceiptValidation, Receipt, AppTransaction)
  - Add typealiases to preserve source compatibility

- getAvailablePurchases props:
  - Rename OpenIapPurchaseOptions → OpenIapGetAvailablePurchasesProps (alias retained)

- Store/UI:
  - Move IapStatus and related types under OpenIapStore as nested types
  - Add temporary typealias shim for CocoaPods path stability
  - Remove restorePurchases(); add refreshPurchases(forceSync:)

- Error codes:
  - Centralize OpenIAP string codes in OpenIapError (constants + errorCodes())
  - Reintroduce PurchaseError.emptySkuList(); remove redundant PurchaseError.toDictionary()

- Serialization:
  - Add OpenIapSerialization (product, purchase, list helpers, errorCodes)
  - Pure/non‑MainActor serialization for bridges/analytics

- Docs:
  - Update CONTRIBUTING.md with “public models use OpenIap prefix”

BREAKING CHANGE:
- OpenIapStore.restorePurchases() removed; use refreshPurchases(forceSync: true)

Migration:
- Run pod install after file renames (Pods caches file paths)
- Prefer OpenIap* type names going forward; old names remain via typealias
- Replace manual serialization with OpenIapSerialization helpers
@hyochan hyochan merged commit 9dac6fe into main Sep 8, 2025
1 check passed
@hyochan hyochan deleted the feat/ui-refactor-and-store-improvements branch September 8, 2025 03:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant