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

Add autosave attributes to Core Data #12826

Merged

Conversation

guarani
Copy link
Contributor

@guarani guarani commented Nov 1, 2019

Post autosave attributes are saved to Core Data upon retrieval from the remote service.

Issue: #12141
Related PR: wordpress-mobile/WordPressKit-iOS#192

Although the changes in the WordPressKit PR map all autosave attributes, only those necessary for #12141 are now persisted to Core Data.

Testing Details

  1. On WordPress.com, create a new post or open an existing post for editing
  2. Set the title to “Hello, world!”, the body to “One.”, and the excerpt to "An excerpt"
  3. Publish the post
  4. Re-open the post and add a new line, “Two.” – then close the browser tab without saving
  5. Again, re-open the post and notice the following message -
 “The backup of this post in your browser is different from the version below. Restore the backup”
 – this signifies that an autosave was made
  6. Run the iOS app from Xcode and locate the path to iOS app Core Data's sqlite file, WordPress.sqlite and open a database browser at this location
  7. On the WordPress for iOS app, under the My Sites tab, navigate to the list of posts containing the post
  8. Run the query SELECT ZAUTOSAVETITLE, ZAUTOSAVEEXCERPT, ZAUTOSAVECONTENT, ZAUTOSAVEMODIFIEDDATE FROM ZBASEPOST; and observe that the title, excerpt, content, and timestamp contain the expected values:

Screen Shot 2019-11-01 at 12 23 02 AM

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Post autosave properties are now persisted via Core Data to
`AbstractPost`.
It is desirable for all post service API calls to fetch autosave data,
so `autosave` has been set as the default value for `meta`.
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Nov 1, 2019

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@shiki shiki self-requested a review November 1, 2019 12:05
@shiki shiki self-assigned this Nov 1, 2019
@shiki shiki added this to the 13.7 milestone Nov 1, 2019
@guarani
Copy link
Contributor Author

guarani commented Nov 2, 2019

Warnings
⚠️ PR is missing at least one label.
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.
Generated by 🚫 dangerJS

  • The "Do Not Merge" label needs to be added, but I don't have permission. The changes made to Podfile and Podfile.lock are temporary - they only serve to point to the feature branch of WordPressKit-iOS - and should be reverted once the feature branch PR is merged.
  • Most of the new line count comes from WordPress 93.xcdatamodel, changes to Core Data required a new data model version.

Copy link
Member

@shiki shiki left a comment

Choose a reason for hiding this comment

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

Good job, @guarani!

A few things that need to be done before we can merge this:

I marked the items that I'll take care of.

@guarani
Copy link
Contributor Author

guarani commented Nov 6, 2019

Very helpful list, thanks @shiki! I'll reply to each of my items in turn as I can't mark them off directly due to permissions.

Finish discussions in wordpress-mobile/WordPressKit-iOS#192

Done ✅

Increment the WordPressKit pod version. See wordpress-mobile/WordPressKit-iOS#192 (comment).

Done ✅

Fix the conflicts in this PR

Done ✅

Update this branch with the released WordPressKit version. Version number waiting for @shiki.

I'll be on this once the new release of WordPressKit is ready.

@guarani guarani requested a review from shiki November 6, 2019 01:46
@shiki
Copy link
Member

shiki commented Nov 6, 2019

@guarani WordPressKit-iOS 4.5.3-beta.2 has been released. You should be able to update the Podfile to point to that now. Please let me know if you run into any issues.

@guarani
Copy link
Contributor Author

guarani commented Nov 6, 2019

r.e. #12826 (review)

Update this branch with the released WordPressKit version.

@shiki, I've updated this project to point to https://github.com/wordpress-mobile/WordPressKit-iOS/releases/tag/4.5.3-beta.2 👍

Copy link
Member

@shiki shiki left a comment

Choose a reason for hiding this comment

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

Thank you, @guarani!

@shiki shiki merged commit 2e31c49 into wordpress-mobile:develop Nov 7, 2019
@guarani
Copy link
Contributor Author

guarani commented Nov 8, 2019

Thank you, @shiki!

@guarani guarani deleted the issue/12141-autosave-attributes branch November 9, 2019 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants