Skip to content

PurchasesOrchestrator: removed lazy hack for properties with @available#1596

Merged
NachoSoto merged 1 commit into
mainfrom
lazy-var-workaround-2
May 26, 2022
Merged

PurchasesOrchestrator: removed lazy hack for properties with @available#1596
NachoSoto merged 1 commit into
mainfrom
lazy-var-workaround-2

Conversation

@NachoSoto

@NachoSoto NachoSoto commented May 20, 2022

Copy link
Copy Markdown
Contributor

Fixes CF-682, and probably #1528.
Looks like possibly something was broken demangling lazy properties with @available in iOS 15.0 (per the 2 bug reports).

This changes the approach to simply having Any? as the value, and making the exposed @available property a derived one.

@NachoSoto NachoSoto requested a review from a team May 20, 2022 22:58
@NachoSoto NachoSoto force-pushed the lazy-var-workaround-2 branch from 12716c8 to 68378e2 Compare May 20, 2022 23:01
@@ -66,11 +66,23 @@ class PurchasesOrchestrator {
private let beginRefundRequestHelper: BeginRefundRequestHelper
private let lock = NSRecursiveLock()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a great workaround, but another possible solution could be to create an object that encapsulates all this logic, something like StoreKit2Listeners without @available, and it's only initialised if StoreKit2 is available

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StoreKit2TransactionListener is already a wrapper, so that feels like creating a wrapper for a wrapper :P

…ailable`

Fixes [CF-682], and probably #1528.
Looks like possibly something was broken demangling `lazy` properties with `@available` in iOS 15.0 (per the 2 bug reports).

This changes the approach to simply having `Any?` as the value, and making the exposed `@available` property a derived one.
@NachoSoto NachoSoto force-pushed the lazy-var-workaround-2 branch from 5a2deae to fb460af Compare May 26, 2022 18:17
@NachoSoto NachoSoto merged commit ea20aed into main May 26, 2022
@NachoSoto NachoSoto deleted the lazy-var-workaround-2 branch May 26, 2022 21:59
NachoSoto added a commit that referenced this pull request May 26, 2022
NachoSoto added a commit that referenced this pull request May 26, 2022
…ns` only if SK2 is enabled (#1618)

Follow up to #1593 and #1596.

This adds a fair amount of complexity, but I guess it's important to test.
@NachoSoto NachoSoto mentioned this pull request Jun 2, 2022
NachoSoto added a commit that referenced this pull request Jun 2, 2022
### New Features
* `Purchases.customerInfo()`: added overload with a new `CacheFetchPolicy` (#1608) via NachoSoto (@NachoSoto)
* `Storefront`: added `sk1CurrentStorefront` for Objective-C (#1614) via NachoSoto (@NachoSoto)

### Bug Fixes
* Fix for not being able to read receipts on watchOS (#1625) via Patrick Busch (@patrickbusch)

### Other Changes
* Added tests for `PurchasesOrchestrator` invoking `listenForTransactions` only if SK2 is enabled (#1618) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: removed `lazy` hack for properties with `@available` (#1596) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator.purchase(sk2Product:promotionalOffer:)`: simplified implementation with new operator (#1602) via NachoSoto (@NachoSoto)
@aboedo aboedo mentioned this pull request Jun 3, 2022
NachoSoto added a commit that referenced this pull request Jun 6, 2022
Fixes #1660.
This is the same approach used in #1596.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants