Skip to content

Commit

Permalink
Merge pull request #19803 from wordpress-mobile/feat/automatically-re…
Browse files Browse the repository at this point in the history
…try-pending-media-uploads

feat: Retry failed media uploads when re-establishing network connection
  • Loading branch information
derekblank authored Dec 28, 2023
2 parents 0d069d0 + d459991 commit c719762
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3300,7 +3300,7 @@ public void onRequestDragAndDropPermissions(DragEvent dragEvent) {
}

@Override
public void onMediaRetryAllClicked(Set<String> failedMediaIds) {
public void onMediaRetryAll(Set<String> failedMediaIds) {
UploadService.cancelFinalNotification(this, mEditPostRepository.getPost());
UploadService.cancelFinalNotificationForMedia(this, mSite);
ArrayList<Integer> localMediaIds = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public interface EditorFragmentListener extends DialogVisibilityProvider {
void onAddDeviceMediaClicked(boolean allowMultipleSelection);
void onCaptureVideoClicked();
boolean onMediaRetryClicked(String mediaId);
void onMediaRetryAllClicked(Set<String> mediaIdSet);
void onMediaRetryAll(Set<String> mediaIdSet);
void onMediaUploadCancelClicked(String mediaId);
void onMediaDeleted(String mediaId);
void onUndoMediaCheck(String undoedContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ private void showRetryMediaUploadDialog(final int mediaId) {
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
mEditorFragmentListener.onMediaRetryAllClicked(mFailedMediaIds);
mEditorFragmentListener.onMediaRetryAll(mFailedMediaIds);
}
});

Expand Down Expand Up @@ -1583,5 +1583,8 @@ public void onGutenbergDialogNegativeClicked(@NonNull String instanceTag) {
@Override
public void onConnectionStatusChange(boolean isConnected) {
getGutenbergContainerFragment().onConnectionStatusChange(isConnected);
if (BuildConfig.DEBUG && isConnected && hasFailedMediaUploads()) {
mEditorFragmentListener.onMediaRetryAll(mFailedMediaIds);
}
}
}

0 comments on commit c719762

Please sign in to comment.