-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Gutenberg] media upload progress reattach #9129
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
[Gutenberg] media upload progress reattach #9129
Conversation
…o JS on reattachment
…to gb/media_upload_progress_reattach
… progress updates right when componentDidMount
| } | ||
|
|
||
| mWPAndroidGlueCode.setContent(title.toString(), null); | ||
| mWPAndroidGlueCode.setTitle(title.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm not sure why this change is part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry and thanks! @mzorz
| } | ||
|
|
||
| String postContent = removeVisualEditorProgressTag(text.toString()); | ||
| mWPAndroidGlueCode.setContent(null, postContent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also for this one, not sure why is changed here?
| private WPAndroidGlueCode mWPAndroidGlueCode; | ||
|
|
||
| private ConcurrentHashMap<String, Float> mUploadingMediaProgressMax = new ConcurrentHashMap<>(); | ||
| private Set<String> mFailedMediaIds = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use interface Set instead of HashSet ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, just copied the code to represent the same functionality we had as parity with Aztec from here https://github.com/wordpress-mobile/WordPress-Android/blob/develop/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java#L172
| new OnReattachQueryListener() { | ||
| @Override | ||
| public void onQueryCurrentProgressForUploadingMedia() { | ||
| for (String mediaId : mUploadingMediaProgressMax.keySet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mzorz, what about moving this into a separate method (e.g. updateMediaProgress or similar)
and also maybe we can put this mUploadingMediaProgressMax.get(mediaId) into variable (e.g. int currentProgress) before passing it to method ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, addressed moving into a new method in 6cb4c90 - I think the intermediate local variable is unnecessary as it's only going to be used in 1 place; we can use that when it's referenced in more than 1 place so the .get() method doesn't get called on every reference. Does it make sense?
marecar3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
This PR introduces upload progress reattachment so the progress updates are reflected on the UI when you exit and enter the Editor again.
Related PRs
To test:
Note:
@marecar3 the base branch corresponds to PR #9120, which also needs to be updated with latest
developto clear the commit history difference seen here.Update release notes:
RELEASE-NOTES.txt.