Editing from local serialized Story #445
Labels
[Type] Enhancement
An improvement to existing functionality.
[Type] Task
Something that needs be done, but is not necessarily a feature/bugfix itself.
In order to allow editing, this is how things will work:
Quick summary of convos from this week around how to handle Stories after they’ve been published.
*To be determined if this will be included for the initial release or shortly thereafter. Need to determine how much extra effort is required.
Technical description / flowEDIT: THIS CHANGED! Read below 👇🏻every time a Post is published, we save its serialized Story data and a calculated Post content hash to shared preferences.Also check: maybe the background picture / video for each slide will need to exist as local Media, otherwise we can't let the user edit it. Also, I think the content provider URIs provided by apps like Google Photos are only valid for some time, so if they want to edit again the background image / video will no longer be accessible (they can only by adding them to the app again).when the user taps on a story post list item (how we detect this has as story is for now by inspection) we check if there's a matching serialized story in shared prefs for this Post. If there is such a thing, we inflate the Story and load it on the Story Creator. Only do this if the hash calculated on the Post content results in the same hash, because we can't possibly allow editing on a Post that has been edited.if not, we create a new Story with the background slides being the same as per in the Post, and show the Dialog that says "Limited Story Editing".then again every time they tap UPDATE, the Post gets saved, a hash gets calculated for the Post content and stored along with the serialized Story data.Also:
deleting a Post will need to check whether there's shared pref for this post, and also delete that information.NEW definitions for technical implementation after conversations with @aforcier, @bjtitus :
We no longer check the Post hash or make any checks prior to opening a Post. We just let them open posts and edit them freely.
We'll be using the flattened produced
mediaId
as the key to Story slides.SAVING:
mediaId
, but the new media resulting from saving in the composer). This ID is the one being kept in the block as well. [key = flattened mediaID -> serialized slide.]The repository should be something that is easy to use on each platform. Caveat: remember that mediaIds are also dependent on the siteId.
EDITING:
-> mobile gutenberg passes the
mediaFiles
attribute from the block to the host app through the bridge-> for each
mediaId
we go and check with our local repository to see if we have a match for this siteId/mediaId.-> if we have a match and the original background media as pointed to by the serialized object is also still available, bingo this is a fully editable slide.
-> if we don't, we can still present the flattened background image with its mediaId and warn the user with the dialog ("Limited story editing"). We may want to adjust the wording there because it may have been the case the story was actually fully created on this device, but somehow the original background image for a given slide is now not available (for example, with Google Photos temporal Uris?)
ToDo checklist
mediaFiles
array)siteId-mediaId
key representing a unique slide.Other:
[ ] ideally we just hide the Story block from the block picker in mobile gutenberg so the only way to insert a new Story in a Post is by means of the current flows in place (FAB for new post/page/story on the main screen, and FAB on the app's Posts list)- we're letting users insert and add from the block pickerprovide a way to clean old preferences (probably add a ShredPreferences.editor.clear() method call when logging out, and also do some checks when a Post is deleted -> check its media associations -> check if any prefs exist -> remove the prefs). Also, check if media is deleted from the Media library -> check if any prefs exist -> remove the prefs.(moved to Clean Stories preferences in WPAndroid #627)For Later:
These items are being worked on the following PRs:
The text was updated successfully, but these errors were encountered: