Storefront: added sk1CurrentStorefront for Objective-C#1614
Merged
Conversation
Fixes https://community.revenuecat.com/sdks-51/objective-c-how-to-access-rcstorefront-1647?postid=5154#post5154 `RCStoreFront` does have a `currentStorefront` property which supports StoreKit 1 and StoreKit 2, but due to the fact that the SK2 way of obtaining the current storefront is `async`, this property is only `async`, which means that it indeed isn’t available on Objective-C. This adds a way to be able to access the current storefront from Objective-C.
aboedo
requested changes
May 31, 2022
| /// The current App Store storefront for the device obtained from StoreKit 1 only. | ||
| /// - Note: this method is intended to be used only from Objective-C. | ||
| /// In Swift, ``Storefront/currentStorefront`` is preferred. | ||
| @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *) |
Member
There was a problem hiding this comment.
Maybe we can also enforce this at the compiler level? I.e.:
Suggested change
| @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *) | |
| @available(swift, obsoleted: 0.0.1, message: "In Swift, ``Storefront/currentStorefront`` is preferred.") | |
| @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *) |
Contributor
Author
There was a problem hiding this comment.
OMG that's right!
Contributor
Author
There was a problem hiding this comment.
'unavailable' cannot be used in 'available' attribute for platform 'swift'
LOL okay...
Contributor
Author
Collaborator
There was a problem hiding this comment.
yeah I tried unavailable before posting, then I went with obsoleted when I ran into the same thing 😂
the rename is a great idea!
Member
There was a problem hiding this comment.
that comment was from me ^ I logged into that account to set up an automation and forgot 😅
Contributor
Author
There was a problem hiding this comment.
Haha I remain unconvinced you're not a robot 🙃
dbbc58c to
35f563d
Compare
aboedo
approved these changes
May 31, 2022
Merged
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)
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes https://community.revenuecat.com/sdks-51/objective-c-how-to-access-rcstorefront-1647?postid=5154#post5154
RCStoreFrontdoes have acurrentStorefrontproperty which supports StoreKit 1 and StoreKit 2, but due to the fact that the SK2 way of obtaining the current storefront isasync, this property is onlyasync, which means that it indeed isn’t available on Objective-C.This adds a way to be able to access the current storefront from Objective-C.