-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
My Site Dashboard: cache the response #17945
Conversation
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.
Works as described!
func persist(cards: NSDictionary, for wpComID: Int) { | ||
do { | ||
let directory = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) | ||
let fileURL = directory.appendingPathComponent("cards_\(wpComID).json") |
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.
What do you think of defining the file path as a constant since we also use it in getCards?
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.
Done in 4d76493
Was a bit slow: started testing the PR earlier today, but it got merged while I was on a lunch break 🥫 Just wanted to retroactively leave a note that I noticed no issues while testing, besides one thing, which does not contradict the PR description, but I still wanted to be sure that it's expected. On the video below, it's clearly seen that the cards content does get cached, but you can briefly see the spinner after the site switch. Only mentioning this because I noticed no spinner in the video from the PR description. Screen.Recording.2022-02-14.at.13.42.12.mov |
@pachlava you don't see the spinner on the PR description because I was offline while recording it! But yes, this spinner will be gone in a subsequent task! Thanks for pointing that out. :) |
Part of #17873
Simulator.Screen.Recording.-.iPhone.13.-.2022-02-11.at.13.43.10.mp4
To test:
Important: make sure to enable My Site Dashboard flag and to sandbox the API.
Switching sites
Offline
Regression Notes
Potential unintended areas of impact
n/a
What I did to test those areas of impact (or what existing automated tests I relied on)
n/a
What automated tests I added (or what prevented me from doing so)
Added unit tests for the persistence logic.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.