SK2StoreProduct.priceFormatter: use locale from StoreKit.Product#3278
Merged
Conversation
This only works in iOS 16+ (because it needs `StoreKit.Product.priceFormatStyle`, but it's a good improvement which ensures consistent formatting of prices in paywalls, where sometimes `StoreProduct.localizedPrice` would have a different format compared to formatting `pricePerMonth` using `StoreProduct.priceFormatter`.
NachoSoto
commented
Oct 5, 2023
| } | ||
|
|
||
| @available(iOS 16.0, tvOS 16.0, macOS 13.0, watchOS 9.0, *) | ||
| func testSk2PriceFormatterGetsLocaleFromStoreKit() async throws { |
Contributor
Author
There was a problem hiding this comment.
This is equivalent to the previous test testSk2PriceFormatterReactsToStorefrontChanges, except it doesn't need to manually change the locale in the priceFormatter
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3278 +/- ##
=======================================
Coverage 85.82% 85.82%
=======================================
Files 236 236
Lines 16790 16799 +9
=======================================
+ Hits 14410 14418 +8
- Misses 2380 2381 +1
☔ View full report in Codecov by Sentry. |
aboedo
approved these changes
Oct 5, 2023
Comment on lines
-106
to
+115
| // This is marked as `@_backDeploy`, but it's only visible when compiling with Xcode 14.x | ||
| // and for some reason only returning a non-empty string on iOS 16+. | ||
| // This is marked as `@_backDeploy` but for some reason only returns a non-empty string on iOS 16+. |
This was referenced Oct 6, 2023
NachoSoto
pushed a commit
that referenced
this pull request
Oct 6, 2023
**This is an automatic release.** ### RevenueCatUI * `Paywalls`: improved purchase-in-progress UI (#3279) via NachoSoto (@NachoSoto) ### Bugfixes * `SK2StoreProduct.priceFormatter`: use locale from `StoreKit.Product` (#3278) via NachoSoto (@NachoSoto) ### Performance Improvements * `AAAttribution.attributionToken`: avoid using on main thread (#3281) via NachoSoto (@NachoSoto) ### Other Changes * `Paywalls Tester`: group live paywalls by template (#3276) via NachoSoto (@NachoSoto)
NachoSoto
added a commit
that referenced
this pull request
Dec 8, 2023
Thanks to #3278, this can now never be `nil` starting from iOS 16.
NachoSoto
added a commit
that referenced
this pull request
Dec 8, 2023
Thanks to #3278, this can now never be `nil` starting from iOS 16.
NachoSoto
added a commit
that referenced
this pull request
Dec 8, 2023
Thanks to #3278, this can now never be `nil` starting from iOS 16.
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.
This only works in iOS 16+ (because it needs
StoreKit.Product.priceFormatStyle), but it's a good improvement which ensures consistent formatting of prices in paywalls, where sometimesStoreProduct.localizedPricewould have a different format compared to formattingpricePerMonthusingStoreProduct.priceFormatter.