Skip to content
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

Fix broken invalid url handling on iOS 17 #136

Merged
merged 3 commits into from
Jan 10, 2024
Merged

Conversation

ajaysubra
Copy link
Contributor

@ajaysubra ajaysubra commented Jan 9, 2024

Description

In iOS 17 apple changes how url's string initializer works and this was causing one of our tests that validates invalid urls to fail. I reverted the URL initializer to not use the new decoding and sticking with the pre iOS 17 logic of keeping invalid characters from decoding. This is fine since the string we are using the URL initializer is a static one and the idea is to align the code with the tests we had.

Change in iOS 17 for more context.

Check List

  • Are you changing anything with the public API?
  • Have you tested this change on real device?
  • Are your changes backwards compatible with previous SDK Versions?
  • Have you added unit test coverage for your changes?
  • Have you verified that your changes are compatible with all the operating system version this SDK currently supports?

Manual Test Plan

Supporting Materials

@ajaysubra ajaysubra requested a review from a team as a code owner January 9, 2024 15:40
@ajaysubra ajaysubra requested a review from ndurell January 9, 2024 15:40
@@ -103,7 +103,11 @@ extension KlaviyoAPI.KlaviyoRequest {
var url: URL? {
switch endpoint {
case .createProfile, .createEvent, .registerPushToken, .unregisterPushToken:
return URL(string: "\(environment.analytics.apiURL)/\(path)/?company_id=\(apiKey)")
if #available(iOS 17.0, *) {
return URL(string: "\(environment.analytics.apiURL)/\(path)/?company_id=\(apiKey)", encodingInvalidCharacters: false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@@ -19,7 +19,7 @@ jobs:
runs-on: macos-13
strategy:
matrix:
xcode: ['14.3']
xcode: ['15.1']
Copy link
Contributor

Choose a reason for hiding this comment

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

is this change related?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, since the breaking code is related to a new swift version, he had to update the runner XCode version to access that new swift version.

@evan-masseau
Copy link
Contributor

@ajaysubra assume you won't mind, i updated this against master so we can see if CI 100% is fixed now.

@evan-masseau
Copy link
Contributor

hm CI is hung on 14.3 tests, which I think you removed. Might have to force-merge this one, maybe those tests are cached or something?

@ajaysubra
Copy link
Contributor Author

hm CI is hung on 14.3 tests, which I think you removed. Might have to force-merge this one, maybe those tests are cached or something?

Thanks for updating with master. You are probably right that GH is caching something. Manually triggered the jobs 🤞🏽

@ajaysubra
Copy link
Contributor Author

Actions is passing but it's not updating the PR so I'm going to just merge this bypassing the checks.
image

@ajaysubra ajaysubra merged commit 98f096f into master Jan 10, 2024
7 checks passed
@ajaysubra ajaysubra deleted the as/chnl-1009-url-ios17 branch January 10, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants