Skip to content
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

[Android] inform the host app when an Image Block is deleted #1595

Closed
mzorz opened this issue Nov 19, 2019 · 2 comments · Fixed by WordPress/gutenberg#61251
Closed

[Android] inform the host app when an Image Block is deleted #1595

mzorz opened this issue Nov 19, 2019 · 2 comments · Fixed by WordPress/gutenberg#61251

Comments

@mzorz
Copy link
Contributor

mzorz commented Nov 19, 2019

Describe the bug
When an Image block contains an image and the image upload fails for whatever reason, the host app typically keeps track of that somehow to allow the user to retry an upload and to let Gutenberg know which Image Blocks have a failed image within (so the editor knows and is able to correspondingly show the upload error UI to the user). Currently, tapping on the block's trash icon (to remove a failed image) is not informed to the host app, so the app can't update its state to know which images should be retried. This leads to UX communication artifacts, for example the host app's upload error and progress notifications being inconsistent with what can be seen in the editor.

To Reproduce
Steps to reproduce the behavior:

  1. use WPAndroid (preferably on a clean installation to avoid potentially confusing other media failed issues):
  2. Create a new draft on the Block editor
  3. turn airplane mode ON
  4. add an image block and assign an image to it
  5. add another image block and assign another image to it
  6. now remove once of the blocks by tapping on the block's trash icon
  7. tap on the image on the other block, to get the "retry/remove/retry all" dialog
  8. tap on "retry all"
  9. Observe the error notification will still say "2 files not uploaded", when in reality we only wanted to upload 1 image, not 2 (as we removed one of the blocks).

Expected behavior
When removing an Image Block that contains a failed to upload image, then retrying other failed uploads, count in the notifications should be consistent.

Smartphone (please complete the following information):

  • Device: [Pixel emulator]
  • OS: [8.0]
  • Version [1.17, c6d095e]

Additional context
First spotted while testing this wordpress-mobile/WordPress-Android#10791 (comment) , and related to the work done in #715,
and https://github.com/WordPress/gutenberg/pull/14391/files#diff-a61b3f346c11f42236eb2b1a783bf9bfR93.

Potential solution:

  1. on the Gutenberg side, the detection of an image block being removed is already made here. We should also let the callback know not only when an in progress upload is happening (i.e. remove the check for this.state.isUploadInProgress), but also for any other case (and let the host app decide what to do there).
  2. on the host app side and specifically the WPAndroid app should remove the mediaId from mFailedMediaIds array in GutenbergEditorFragment, and also call the fragment listener's onMediaDeleted when the user taps on the trash icon on an ImageBlock (pretty much follow the retry Dialog's REMOVE action onClick body ). Otherwise, artifacts in upload progress notification count and upload error notifications may happen, as these rely on what that array contains.
@mzorz mzorz added [Type] Bug Something isn't working [OS] Android Media labels Nov 19, 2019
@hypest hypest added this to Triage in Mobile Gutenberg via automation Jun 11, 2020
@hypest hypest moved this from Triage to Backlog (unscheduled/unassigned) in Mobile Gutenberg Jun 11, 2020
@hypest
Copy link
Contributor

hypest commented Jun 11, 2020

Verified still happening as of WPAndroid v15.0-rc-3.

@jhnstn
Copy link
Member

jhnstn commented Feb 22, 2022

Verified still happening

  • WPAndroid v19.2 rc-3

Mobile Gutenberg automation moved this from Backlog (unscheduled/unassigned) to Done (keep clean, manually) May 16, 2024
Block Editor Writing Flow Issues automation moved this from To do to Done May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Mobile Gutenberg
  
Done (keep clean, manually)
3 participants