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

Prevent processing media if the Uri is null or if mLocalMediaUris is … #19947

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

geriux
Copy link
Contributor

@geriux geriux commented Jan 15, 2024

Fixes #19943
Fixes #19944

This is a regression from #19754

It will prevent the app from crashing when mLocalMediaUris is empty.

There are a few cases where the media image can't be fetched and this prevents the app from crashing, the image won't be added but at least the app remains open. This is a known issue.


To Test:

Note

I could only reproduce it on a Redmi Note 8T using Android 11 while sharing an image from the File Explorer app. This prevents a crash when the media can't be added, now the app will remain open but the Image won't be added, hopefully will work on fixing this issue soon. So I propose testing the sharing feature overall:

  • Precondition: Have different kinds of files on your device: PDF, jpg, and mp4.
  • NOTE: The editor takes a bit of time to load when adding media. GitHub ticket.
  • Install the app from this PR
  • Open your Files app
  • Multiselect an image and a PDF file
  • Tap on the Share button
  • Select the Jetpack app
  • Expect the editor to be loaded with just the supported media types (images, and videos)

Extra test case

  • Open your Files app
  • Select one image
  • Select the Jetpack app
  • Expect the editor to be loaded with the selected image
Test Case 1 Test Case 2
TestCase1.mov
TestCase2.mov

Regression Notes

  1. Potential unintended areas of impact

    • Sharing Media
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual testing
  3. What automated tests I added (or what prevented me from doing so)

N/A

PR Submission Checklist:

  • I have completed the Regression Notes.
  • 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 this to the 24.0 ❄️ milestone Jan 15, 2024
@geriux geriux marked this pull request as ready for review January 15, 2024 14:19
@geriux geriux requested a review from antonis January 15, 2024 14:19
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 15, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr19947-e837837
Commite837837
Direct Downloadwordpress-prototype-build-pr19947-e837837.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 15, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr19947-e837837
Commite837837
Direct Downloadjetpack-prototype-build-pr19947-e837837.apk
Note: Google Login is not supported on these builds.

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Thank you for the quick fix @geriux 🙇
I wasn't able to reproduce the issue but checking the crash stack traces your fixes look good to me 👍
I left a suggestion at https://github.com/wordpress-mobile/WordPress-Android/pull/19947/files#r1452499476

@peril-wordpress-mobile
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@geriux
Copy link
Contributor Author

geriux commented Jan 15, 2024

I wasn't able to reproduce the issue but checking the crash stack traces your fixes look good to me 👍

Yeah I only was able to reproduce it on one of my testing devices, here's a recording of the steps I followed to get it to crash:

Screenrecorder-2024-01-15-17-36-07-701.mp4

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 24.0 ❄️. The due date for this milestone has already passed.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@antonis
Copy link
Contributor

antonis commented Jan 15, 2024

Yeah I only was able to reproduce it on one of my testing devices, here's a recording of the steps I followed to get it to crash

Thank you for the recording @geriux 🙇
I was able to trigger the crash on debug mode an verified the fix :)

@antonis antonis self-requested a review January 15, 2024 16:44
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Awesome work @geriux!
Thank you for fixing this so quickly. I verified that the code changes fix both #19943 and #19944 🎉

@geriux geriux merged commit 9812efc into release/24.0 Jan 15, 2024
19 checks passed
@geriux geriux deleted the fix/sharing-media-crash branch January 15, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants