Skip to content

Add X-Preferred-Locales header#4008

Merged
vegaro merged 4 commits into
mainfrom
add-locale-header
Jul 2, 2024
Merged

Add X-Preferred-Locales header#4008
vegaro merged 4 commits into
mainfrom
add-locale-header

Conversation

@vegaro

@vegaro vegaro commented Jul 1, 2024

Copy link
Copy Markdown
Member

Added a new X-Supported-Locales header to be used in the new customer center feature

@vegaro vegaro added the refactor label Jul 1, 2024

@tonidero tonidero left a comment

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.

Just a couple comments but looks good!

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 would rename the file to the implementation, so PreferredLocalesProvider.

var defaultHeaders: RequestHeaders {
let supportedLocales = self.systemInfo.preferredLanguages.map {
$0.replacingOccurrences(of: "-", with: "_")
}.joined(separator: ",")

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 would add a maximum here... Maybe first 3? Just so this header can't grow indefinitely.

@vegaro vegaro changed the title Add X-Supported-Locales header Add X-Preferred-Locales header Jul 1, 2024
@vegaro vegaro force-pushed the add-locale-header branch 2 times, most recently from 577f8d4 to d6d9508 Compare July 1, 2024 20:40
@vegaro vegaro force-pushed the add-locale-header branch from d6d9508 to 80af22a Compare July 1, 2024 20:59
@vegaro vegaro requested a review from tonidero July 2, 2024 11:33

// Visible for tests
var defaultHeaders: RequestHeaders {
let supportedLocales = self.systemInfo.preferredLanguages.prefix(3).map {

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.

Maybe rename to preferredLocales?

@vegaro vegaro merged commit 29250a4 into main Jul 2, 2024
@vegaro vegaro deleted the add-locale-header branch July 2, 2024 15:32
joshdholtz added a commit that referenced this pull request Jul 16, 2024
**This is an automatic release.**

### New Features
* Paywalls with custom purchase and restore logic handlers (#3973) via
James Borthwick (@jamesrb1)
### Bugfixes
* Prevent paywall PurchaseHandler from being cleared on rerender (#4035)
via Josh Holtz (@joshdholtz)
* Update Purchase Tester for 5.0.0 (#4015) via Will Taylor
(@fire-at-will)
### Dependency Updates
* Bump fastlane from 2.221.0 to 2.221.1 (#3977) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Bring official `xcodes` back to CI (#4029) via Cesar de la Vega
(@vegaro)
* Paywalls tester with sandbox purchases (#4024) via James Borthwick
(@jamesrb1)
* Update v5 migration guide to contain current latest version (#4019)
via Toni Rico (@tonidero)
* CI Build Docs Improvements (#4014) via Will Taylor (@fire-at-will)
* Use available resource class for backend-integration-tests-offline-job
(#4013) via Will Taylor (@fire-at-will)
* Add `X-Preferred-Locales` header (#4008) via Cesar de la Vega
(@vegaro)

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
nyeu pushed a commit that referenced this pull request Oct 2, 2024
Added a new `X-Supported-Locales` header to be used in the new customer
center feature
nyeu pushed a commit that referenced this pull request Oct 2, 2024
**This is an automatic release.**

### New Features
* Paywalls with custom purchase and restore logic handlers (#3973) via
James Borthwick (@jamesrb1)
### Bugfixes
* Prevent paywall PurchaseHandler from being cleared on rerender (#4035)
via Josh Holtz (@joshdholtz)
* Update Purchase Tester for 5.0.0 (#4015) via Will Taylor
(@fire-at-will)
### Dependency Updates
* Bump fastlane from 2.221.0 to 2.221.1 (#3977) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Bring official `xcodes` back to CI (#4029) via Cesar de la Vega
(@vegaro)
* Paywalls tester with sandbox purchases (#4024) via James Borthwick
(@jamesrb1)
* Update v5 migration guide to contain current latest version (#4019)
via Toni Rico (@tonidero)
* CI Build Docs Improvements (#4014) via Will Taylor (@fire-at-will)
* Use available resource class for backend-integration-tests-offline-job
(#4013) via Will Taylor (@fire-at-will)
* Add `X-Preferred-Locales` header (#4008) via Cesar de la Vega
(@vegaro)

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants