Skip to content

SK2StoreProduct.priceFormatter: use locale from StoreKit.Product#3278

Merged
NachoSoto merged 1 commit into
mainfrom
sk2-product-formatter-locale
Oct 5, 2023
Merged

SK2StoreProduct.priceFormatter: use locale from StoreKit.Product#3278
NachoSoto merged 1 commit into
mainfrom
sk2-product-formatter-locale

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Oct 5, 2023

Copy link
Copy Markdown
Contributor

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.

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 NachoSoto added the pr:fix A bug fix label Oct 5, 2023
@NachoSoto NachoSoto requested a review from a team October 5, 2023 16:07
}

@available(iOS 16.0, tvOS 16.0, macOS 13.0, watchOS 9.0, *)
func testSk2PriceFormatterGetsLocaleFromStoreKit() async throws {

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.

This is equivalent to the previous test testSk2PriceFormatterReactsToStorefrontChanges, except it doesn't need to manually change the locale in the priceFormatter

@codecov

codecov Bot commented Oct 5, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (0bec5b9) 85.82% compared to head (23efe4b) 85.82%.
Report is 2 commits behind head on main.

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     
Files Coverage Δ
...chasing/StoreKitAbstractions/SK2StoreProduct.swift 78.94% <63.63%> (-3.15%) ⬇️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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+.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lol classic storekit

@NachoSoto NachoSoto merged commit 5db3bcb into main Oct 5, 2023
@NachoSoto NachoSoto deleted the sk2-product-formatter-locale branch October 5, 2023 17:15
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants