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
Extract media related code from EditPostActivity to a new class #10664
Extract media related code from EditPostActivity to a new class #10664
Conversation
This commit attempts to copy over the some (most?) of media related methods of EditPostActivity to a new class EditorMedia. If the dependencies are resolved, this will provide a basis for extracting media logic from EditPostActivity.
This is an attempt to create the communicatino between the EditPostActivity and EditorMedia. Some, if not all, of the functions in EditorMediaListener are temporary, because they are not the ideal way to communicate the information. We'll need to move a lot of logic between EditPostActivity and EditorMedia to have more meaningful functions in the listener.
…edia-from-edit-post-activity
WordPress/src/main/java/org/wordpress/android/ui/posts/editor/EditorMedia.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/posts/editor/EditorMedia.kt
Outdated
Show resolved
Hide resolved
You can test the changes on this Pull Request by downloading the APK here. |
@@ -916,6 +894,7 @@ public void onPhotoPickerHidden() { | |||
public void onPhotoPickerMediaChosen(@NonNull final List<Uri> uriList) { | |||
mEditorPhotoPicker.hidePhotoPicker(); | |||
|
|||
// TODO: It looks like we might be calling addMediaList twice |
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.
I'm not sure I understand this comment correctly but haven't you just missed the return
statement after WPMediaUtils.advertiseImageOptimization(this, () -> mEditorMedia.addMediaList(uriList, false));
?
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.
I don't really remember what I was thinking with this. The TODO
doesn't make sense 😕 Removed in 48f8d02.
Thanks @oguzkocer! I've reviewed the code as best I could and it LGTM as a first iteration. Tbh I don't think we need to test this branch before we merge it into the working branch. We'll change big chunks of the code anyway so it feels like a waste of time. SideNote: I've already started refactoring
|
Generated by 🚫 dangerJS |
@malinajirka I fixed the lint issues and removed that |
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, thanks!
This PR is a part of the ongoing refactor for the
EditPostActivity
. Borrowing from the very similar photo picker PR:This extraction is a lot trickier than the photo picker one and considering we are planning to refactor the
EditorMedia
component further, I think it's best to merge this PR into a feature branch instead ofdevelop
. This branch shouldn't live for a long time, so merge conflicts shouldn't be a big deal. I am also unsure about how best to test these changes, I just don't know enough about theEditPostActivity
.P.S: I have not been able to test this PR yet due to a crash I am experiencing in
develop
and in this branch. I'll mark the PR as draft for now.PR submission checklist:
RELEASE-NOTES.txt
if necessary.