-
Notifications
You must be signed in to change notification settings - Fork 121
[Privacy Choices] Use a consolidated API to fetch the user ip country code #9851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Collaborator
You can test the changes from this Pull Request by:
|
b9f84b9 to
24b9505
Compare
rachelmcr
approved these changes
Jun 2, 2023
| return onCompletion(.failure(IPLocationError.malformedURL)) // Should not happen. | ||
| } | ||
|
|
||
| let request = UnauthenticatedRequest(request: .init(url: url)) |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be adding the custom user-agent header with .asURLRequest() here?
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I totally missed it!
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.
closes #9845
Why
We found a public WPCom API to get the user's IP country code:
https://public-api.wordpress.com/geo/. This PR updates the feature to rely solely on this API for WPCom and non-WPCom users.How
Adds a new
IPLocationRemotetype to fetch and parse from the new endpoint.Update the
PrivacyBannerPresentationUseCaseto:Removes the now unused
ipCountryCodeproperty from theAccounttype. (I'm glad I didn't save this on core data!)Demo
WPCom - EU
wpcom-eu.mov
WPCom - NO EU
wpcom-no-eu.mov
Non WPCom - EU
non-wpcom-eu.mov
Non WPCom - NO EU
non-epcom-no-eu.mov
Testing Steps
Prerequisite before each scenario
WPCom - EU
WPCom - NO EU
Non-WPCom - EU
Non-WPCom - NO EU
RELEASE-NOTES.txtif necessary.