-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add discrete onMediaUploadPaused handler to media uploads when offline #19884
Changes from 1 commit
b22021a
d8a7bff
8d46802
8ed6850
ad1ca04
594f989
00df84c
b1f7e3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -298,6 +298,10 @@ class EditorMedia @Inject constructor( | |
listener.onMediaUploadFailed(media.id.toString(), error.type.name) | ||
} | ||
|
||
fun onMediaUploadPaused(listener: EditorMediaUploadListener, media: MediaModel) = launch { | ||
listener.onMediaUploadPaused(media.id.toString()) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imagine we should still track an event of |
||
|
||
sealed class AddMediaToPostUiState( | ||
val editorOverlayVisibility: Boolean, | ||
val progressDialogUiState: ProgressDialogUiState | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1431,6 +1431,10 @@ public void onMediaUploadFailed(final String localMediaId, final String errorTyp | |||||||||||
mUploadingMediaProgressMax.remove(localMediaId); | ||||||||||||
} | ||||||||||||
|
||||||||||||
public void onMediaUploadPaused(final String localMediaId) { | ||||||||||||
mUploadingMediaProgressMax.remove(localMediaId); | ||||||||||||
} | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like avoiding a need to pass the error type and entangle the paused and error methods, but I worry about modify Aztec. We likely need to test Aztec to avoid regressions. Additionally, I note this method lacks an Lastly, how confident are we that we only need to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that it is necessary, as both Aztec and Gutenberg share a common interface to which they must adhere. For Aztec, the latest implementation of this merely passes the invocation onto the existing failed method. So, the regression risk should be fairly low. It is likely still worth testing the Aztec editor via editing classic posts in the app. WordPress-Android/libs/editor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java Lines 1434 to 1438 in b97dbec
|
||||||||||||
|
||||||||||||
@Override | ||||||||||||
public void onVideoInfoRequested(final AztecAttributes attrs) { | ||||||||||||
// VideoPress special case here | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,4 +9,5 @@ public interface EditorMediaUploadListener { | |||||
void onMediaUploadProgress(String localId, float progress); | ||||||
void onMediaUploadFailed(String localId, String errorType); | ||||||
void onGalleryMediaUploadSucceeded(long galleryId, long remoteId, int remaining); | ||||||
void onMediaUploadPaused(String toString); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an odd parameter name, presumably a typo.
Suggested change
|
||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1488,14 +1488,14 @@ public void onMediaUploadProgress(final String localMediaId, final float progres | |||||||||||||
|
||||||||||||||
@Override | ||||||||||||||
public void onMediaUploadFailed(final String localMediaId, String errorType) { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this approach, we no longer require the
Suggested change
|
||||||||||||||
switch (errorType) { | ||||||||||||||
case "CONNECTION_ERROR": | ||||||||||||||
getGutenbergContainerFragment().mediaFileUploadPaused(Integer.valueOf(localMediaId)); | ||||||||||||||
break; | ||||||||||||||
default: | ||||||||||||||
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(localMediaId)); | ||||||||||||||
break; | ||||||||||||||
} | ||||||||||||||
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(localMediaId)); | ||||||||||||||
mFailedMediaIds.add(localMediaId); | ||||||||||||||
mUploadingMediaProgressMax.remove(localMediaId); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
@Override | ||||||||||||||
public void onMediaUploadPaused(final String localMediaId) { | ||||||||||||||
getGutenbergContainerFragment().mediaFileUploadPaused(Integer.valueOf(localMediaId)); | ||||||||||||||
mFailedMediaIds.add(localMediaId); | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really wish to add these localMediaIds to Lines 1591 to 1596 in 234db29
Semantically, this should probably be called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree a refactor is likely beneficial but unnecessary at this time. That said, I do not believe overloading |
||||||||||||||
mUploadingMediaProgressMax.remove(localMediaId); | ||||||||||||||
} | ||||||||||||||
|
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 worry that if we do not check for an error as well, we might erroneously mark successfully uploaded media as paused. WDYT?