WordPress-iOS icon indicating copy to clipboard operation
WordPress-iOS copied to clipboard

Add a new Core Data write API

Open crazytonyli opened this issue 3 years ago • 5 comments
trafficstars

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.txt if necessary.

crazytonyli avatar Aug 10 '22 09:08 crazytonyli

Warnings
:warning: PR is not assigned to a milestone.

Generated by :no_entry_sign: dangerJS

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-5e20183 on your iPhone
If you need access to App Center, please ask a maintainer to add you.

wpmobilebot avatar Aug 10 '22 09:08 wpmobilebot

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-5e20183 on your iPhone
If you need access to App Center, please ask a maintainer to add you.

wpmobilebot avatar Aug 10 '22 09:08 wpmobilebot

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 avatar Aug 10 '22 15:08 AliSoftware

@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).

crazytonyli avatar Aug 10 '22 21:08 crazytonyli