-
Notifications
You must be signed in to change notification settings - Fork 1.3k
WP Stories integration: UploadService trigger #12031
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
Merged
jd-alexander
merged 40 commits into
feature/wp-stories-base
from
feature/wp-stories-part8-upload-service
Jun 22, 2020
Merged
WP Stories integration: UploadService trigger #12031
jd-alexander
merged 40 commits into
feature/wp-stories-base
from
feature/wp-stories-part8-upload-service
Jun 22, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ress class so we can trigger the UploadService from there
… payload to the FrameSaveService and get it back when a SaveResult is ready
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
You can test the changes on this Pull Request by downloading the APK here. |
…ch of the StoryFrameItem composed frame files
…t will hold the contents of the Story
…files and add them as Media and insert them into a Post, then upload
…ploadBridge registers itself
…y unneeded Post from the database when the user exits without creating anything
…n existing backing Post
…y is complete and successfully saved - avoid processing individual frame retries
This was referenced May 28, 2020
… with PostUploadNotifier
…nted loader interface for loading notification dismiss PendingIntent
Base automatically changed from
feature/wp-stories-part6-mediapicker-wpmedia2
to
feature/wp-stories-base
June 19, 2020 13:30
Builds on top of #11987
This PR implements the needed changes to listen to a StorySaveResult and then triggering the UploadService to upload the composed images.
For this, a new class is introduced, called
StoryMediaSaveUploadBridge
that is both aLifecycleObserver
and aEditorMediaListener
, which carries with this responsibility.How it works
First, the StoryComposerActivity is now creating a backing Post, which will contain the story content in the format of a Gallery.
The post is instantiated and kept empty, given we won't populate its content until later when we know the media Ids for each of the saved story frames.
The StoryMediaSaveUploadBridge is registered as a LifeycleObserver of the Application class, and subscribes to EventBus
StorySaveResult
events in itsonCreate()
observer override.When all of a Story's frames are successfully saved to disk (which is the responsibility of FrameSaveManager and FrameSaveService in the stories library), this class will then:
mediaId
for each (this is simply theid
in the MediaStore).mediaId
field in FluxC's MediaStore) and the post content is updated by replacing the placeholders with each remoteId correspondingly, for example:once media is finished uploading, the UploadService also takes care of uploading the corresponding Post.
in the case the user decides to abandon the Story creation screen without pubslishing, the backing Post will be discarded. Any frames saved to that point will remain as media in their device (not media in the WP libraries, just on their device as raw image / video files)
Error handling
Videos
Videos are not supported yet, given the Gallery only supports images. There's no code in this PR or in the stories library in general to prevent this, given it'd be just adding unnecessary work. If you add a video to a Story, and it gets saved correctly, etc. it will be uploaded to the site and added to the Gallery, but it won't show in the resulting Post.
To test:
PR submission checklist:
RELEASE-NOTES.txt
if necessary.