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

Post/Pages: Better handling of local only post. #3786

Closed
4 tasks done
aerych opened this issue Jun 2, 2015 · 10 comments
Closed
4 tasks done

Post/Pages: Better handling of local only post. #3786

aerych opened this issue Jun 2, 2015 · 10 comments
Assignees
Milestone

Comments

@aerych
Copy link
Member

aerych commented Jun 2, 2015

When creating new post or page we create a local "draft" to save in core data. This presents a few UX challenges dealing with where the local "draft" appears, the features available, how its sorted, and how it behaves in certain failure states (see #3737 for @koke's examples).

  • local only posts/pages should show local badge of some sort
  • local only posts/pages should appear first in list until there is a remote counterpart
  • local only posts/pages should have no "remote" options e.g. stats
  • fix issues with deleting a local only post/page that failed to publish

cc @diegoreymendez and @bummytime as I want to make sure this plays nice with all our editor concerns.
cc @mnt to keep in the loop regarding the local UX and appearance.

@aerych
Copy link
Member Author

aerych commented Jun 4, 2015

First pass at improving the appearance of a local post.
ios simulator screen shot jun 4 2015 1 02 05 pm

@koke
Copy link
Member

koke commented Jun 4, 2015

But, if it's local, Trash won't trash it but delete it, and View will take you to a non-existant post 🐇 ⛳

@aerych
Copy link
Member Author

aerych commented Jun 4, 2015

Trash won't trash it but delete it

This is what we want tho.

View will take you to a non-existant post.

It should just show a local preview.

@aerych
Copy link
Member Author

aerych commented Jun 4, 2015

Trash won't trash it but delete it

I guess we should make the label say "delete"

@aerych
Copy link
Member Author

aerych commented Jun 4, 2015

Sorting is being a little tricky. I'm not seeing any other way to sort accurately with the properties we currently have.

To fix the sorting issue, I think its going to take adding two new fields to the data model, one field to act as a "publish immediately" flag, another field to act as a "local only" flag. NSSortDescriptors can target these properties to make sure post with a nil date (our convention for publish immediately) or that have no remote version appear at the proper place in the list.

I'm thinking we can override the setters for date_created_gmt and remoteStatusNumber (using willChangeValueForKey and didChangeValueForKey) to ensure that the new flags always properly updated.

Thoughts? I'm definitely open to other ideas.

@koke
Copy link
Member

koke commented Jun 5, 2015

In the past, we've used postID != nil as a flag for local posts. Would having different sections in the results controller (instead of using sort descriptors) help?

@aerych
Copy link
Member Author

aerych commented Jun 5, 2015

Would having different sections in the results controller (instead of using sort descriptors) help

Dunno, but that's an idea worth exploring.

In the past, we've used postID != nil as a flag for local posts

I think something changed. postID defaults to -1 for local posts now.

@aerych
Copy link
Member Author

aerych commented Jun 5, 2015

I looked into sections to see if there was a way we could use them but it seems like another dead end.

As best I can tell results need to already be sorted correctly. Sections seem to just group the already sorted items vs change the sort order.

@koke
Copy link
Member

koke commented Jun 5, 2015

As best I can tell results need to already be sorted correctly. Sections seem to just group the already sorted items vs change the sort order.

Correct 😞

If this key path is not the same as that specified by the first sort descriptor in fetchRequest, they must generate the same relative orderings. For example, the first sort descriptor in fetchRequest might specify the key for a persistent property; sectionNameKeyPath might specify a key for a transient property derived from the persistent property.

aerych added a commit that referenced this issue Jun 10, 2015
@aerych
Copy link
Member Author

aerych commented Jun 10, 2015

Closed in #3805

@aerych aerych closed this as completed Jun 10, 2015
aerych added a commit that referenced this issue Jun 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants