Skip to content

Gutenberg - Media Inserter - Check for internet connection#14140

Merged
geriux merged 3 commits intodevelopfrom
gutenberg/fix-media-uploads-offline
May 20, 2020
Merged

Gutenberg - Media Inserter - Check for internet connection#14140
geriux merged 3 commits intodevelopfrom
gutenberg/fix-media-uploads-offline

Conversation

@geriux
Copy link
Copy Markdown
Contributor

@geriux geriux commented May 19, 2020

Fixes wordpress-mobile/gutenberg-mobile#2106

When uploading media from the block editor without internet connection, the placeholder will hang instead of showing the retry message. This affects any block that handles media upload, Image, Video, Media & Text, and Cover.

This PR adds an internet connection check in the thumbnailReady state to avoid showing the progress bar when it is not uploading anything and display the retry message instead.

For a bit more insight, when uploading media from the media library outside the editor it won't let the user upload anything without an internet connection. In this case, we do want to start the upload process but let the user know if it failed by having no connection.

To test

  • Open the app.
  • Open the editor.
  • Add one of these blocks: Image, Video, Media & Text or Cover.
  • Turn on Airplane mode or disable any internet connection from the device.
  • Tap on the block and upload a file from the device.
  • Expect the block to display a retry message.
  • Turn on the internet connection.
  • Tap on the block and retry the upload.
  • Expect the media to be uploaded successfully.
Before After

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@geriux geriux added [Status] In Progress Gutenberg Editing and display of Gutenberg blocks. labels May 19, 2020
@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented May 19, 2020

You can test the changes on this Pull Request by downloading it from AppCenter here with build number: 28749. IPA is available here. If you need access to this, you can ask a maintainer to add you.

@geriux geriux changed the title Gutenberg - Uploading media - Check for internet connection Gutenberg - Media Inserter - Check for internet connection May 19, 2020
@peril-wordpress-mobile
Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@geriux geriux added this to the 15.0 milestone May 19, 2020
@geriux geriux requested a review from chipsnyder May 19, 2020 13:35
@geriux geriux marked this pull request as ready for review May 19, 2020 13:35
Copy link
Copy Markdown
Contributor

@chipsnyder chipsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I was able to hit an edge case where I killed the connect right when the upload finished. The image made it to the server; however, the editor showed a failed message. However, this seems like a separate issue.

@geriux geriux merged commit ce2da96 into develop May 20, 2020
@geriux
Copy link
Copy Markdown
Contributor Author

geriux commented May 20, 2020

Thanks for the review @chipsnyder !

@geriux geriux deleted the gutenberg/fix-media-uploads-offline branch May 20, 2020 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Media & Text block upload progress hangs with airplane mode

3 participants