WordPress-iOS
WordPress-iOS copied to clipboard
Add a new Core Data write API
Fixes #15821
This change is part of paaHJt-1I7-p2. This PR only introduces the new write API and doesn't update the app code to use it.
Two functions are introduced in ContextManager; one is a synchronous call, and the other is an asynchronous call. I'm aware this doesn't follow the existing pattern: saveContext: and saveContextAndWait:. The fact that saveUsingBlock: doesn't take a completion block implies it's synchronous. I'm keen to hear what you all think about these new functions. Does it simplify the API, or on the contrary, make the API confusing?
The implementation of both functions reuses the existing saving context method to ensure database changes are propagated through to the mainContext and writerContext.
Regression Notes
No regression needed, since no app code uses this new API yet.
PR submission checklist:
- [x] I have completed the Regression Notes.
- [x] I have considered adding unit tests for my changes.
- [x] I have considered adding accessibility improvements for my changes.
- [x] I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txtif necessary.
You can test the changes in Jetpack from this Pull Request by:
- Clicking here or scanning the QR code below to access App Center
- Then installing the build number
pr19169-5e20183on your iPhone
You can test the changes in WordPress from this Pull Request by:
- Clicking here or scanning the QR code below to access App Center
- Then installing the build number
pr19169-5e20183on your iPhone
I'm keen to hear what you all think about these new functions. Does it simplify the API, or on the contrary, make the API confusing?
I wonder if it might be worth adding some random WPiOS devs as reviewers to this PR to get their thoughts about this here 🙃
@AliSoftware Very good point!
Hi @Gio2018 , @dvdchr , and @momo-ozawa , I'm not sure if you all are actively working on this codebase, please feel free to ignore this ping if you aren't. If you are, can you please have a look at this small PR? I would appreciate your thoughts on not having a "AndWait" function in the new writer APIs. Thanks! (Feel free to add others to review this PR).