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

Bugfix FXIOS-10832 - Made pocket provider fetchStories to be async to fix withCheckedContinuation crash #23680

Merged

Conversation

nbhasin2
Copy link
Contributor

📜 Tickets

Jira ticket
Github issue

💡 Description

Made pocket provider fetchStories to be async to fix withCheckedContinuation crash

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

@nbhasin2 nbhasin2 requested a review from a team as a code owner December 10, 2024 23:45
Copy link
Collaborator

@ih-codes ih-codes left a comment

Choose a reason for hiding this comment

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

A few cleanup nits!

Comment on lines 41 to 48
func data(from urlRequest: URLRequest) async throws -> (Data, URLResponse) {
if let error = error {
throw error
}

return (data ?? Data(), response ?? URLResponse())
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't called anywhere is it...? 🤔 Can be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes & No
I know that wasn't the answer you were looking for but basically WallpaperURLSessionMock conforms to URLSessionProtocol, which has this additional method. Now we don't really need this for wallpaper but I added it for now to test if everything works fine. This is why I said "Yes" we need it for now but "No" if there is a better way to make it optional other than obj-c type protocol method then we can remove it. Going to tag Roux as he has been in this area more than me.

@adudenamedruby feel free to chime in here as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahh ok, that makes sense then! I think I wasn't looking close enough to see it was in the unit tests. 🙂

Comment on lines 17 to 20
do {
return try await fetchStories(items: items)
} catch {
throw error
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
do {
return try await fetchStories(items: items)
} catch {
throw error
return try await fetchStories(items: items)

nit: I think I spotted one more! But I'm going to approve anyway. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You spoke too soon @ih-codes, I have more changes coming because tests are broken 🤣 (which I had a feeling anyways)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh no!! 😂 Well you can just re-flag me for review if needed but I'm sure your tests will be great! 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All done! Its not hard to fix these but had to find time. Please double check in case I missed something in my cleanup 🙈

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me @nbhasin2 ! 👌

@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Dec 12, 2024

Messages
📖 Project coverage: 32.97%
📖 Edited 5 files
📖 Created 0 files

Client.app: Coverage: 31.97

File Coverage
URLSessionProtocol.swift 25.0% ⚠️
PocketProvider.swift 79.83%

Generated by 🚫 Danger Swift against f7e4cd4

@nbhasin2 nbhasin2 merged commit 9872456 into mozilla-mobile:main Dec 12, 2024
9 of 10 checks passed
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.

5 participants