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

[RNMobile] Audio block capability now enables/disables media upload's media sources #31966

Merged
merged 72 commits into from
Jun 3, 2021

Conversation

jd-alexander
Copy link
Contributor

@jd-alexander jd-alexander commented May 19, 2021

WordPress iOS wordpress-mobile/WordPress-iOS#16533
WordPress Android wordpress-mobile/WordPress-Android#14680
Gutenberg Mobile wordpress-mobile/gutenberg-mobile#3523

Description

The Insert from URL functionality that is available on free plans was added in #27817 This PR removes the hook that was showing/hiding the Audio block depending on the value from the Audio block capability that is passed over the bridge. Now that capability is utilized in the main apps to determine which media upload options are shown.

Free Plans Paid Plans Self Hosted
Insert from URL Insert from URL Insert from URL
- Choose from device Choose from device
- WordPress Media Library WordPress Media Library

Manual Testing

WP.com sites

Note:

Support for Audio block audio uploads, and access to the media library is restricted to sites that are on a paid plan.

Free Plan

  1. Create a new post.
  2. Add the Audio block.
  3. Notice that only the Insert from URL option is available as users aren't able to upload audio on free plans.

Paid plan

  1. Create a new post.
  2. Add the Audio block.
  3. Notice that all media options are available as users are able to upload audio on paid plans.
Free Plan Paid Plan

Self hosted sites

  1. Create a new post.
  2. Add the Audio block.
  3. Notice that all media options are available as users are able to upload audio on self hosted sites.

Automated Testing

  1. npm run test-unit:native to verify the media-upload (file) test changes.

  2. I did not add any additional tests in this file since it doesn't seem like we are utilizing enzyme in our newer tests.

Regression

Note

The blocks Cover, File, Gallery, Video, Media & Text all utilise the media-upload component that was modified. Verify that these blocks function as expected and all the relevant options are still shown for them in both paid and free plans.

Types of changes

  1. The hook that would show/hide the Audio block was removed.
  2. The Audio block capability was accessed within the media-upload component and utilized within a filter to determine which media options should be shown whether the capability is enabled or not.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

etoledom and others added 30 commits December 7, 2020 13:22
@jd-alexander jd-alexander force-pushed the rnmobile/add/audio-block-capability branch from 66511fa to f4aa392 Compare May 27, 2021 03:26
@jd-alexander
Copy link
Contributor Author

@fluiddot sorry for the long commit history. I had branched from another PR so I think because of the squash and merge the history is still here.

@jd-alexander jd-alexander requested a review from fluiddot May 27, 2021 05:14
@jd-alexander
Copy link
Contributor Author

This is ready for another review @fluiddot Thanks! 🙇🏾

@fluiddot
Copy link
Contributor

fluiddot commented May 27, 2021

@jd-alexander I've spotted an error when uploading an audio file via the "Choose from device" option, it happened on the installable builds of both platforms iOS - build 49021 and Android - Build 107449. Here are the steps to reproduce it and video capture.

Steps:

  1. Go to a premium site
  2. Add an Audio block
  3. Tap on "Choose from device" option on Android or "Other Apps" on iOS
  4. Select an audio file
  5. Observe that an error is presented in the generic red error screen
audio-block-device-file-error.mp4

@jd-alexander
Copy link
Contributor Author

jd-alexander commented May 27, 2021

@jd-alexander I've spotted an error when uploading an audio file via the "Choose from device" option, it happened on the installable builds of both platforms iOS - build 49021 and Android - Build 107449. Here are the steps to reproduce it and video capture.

Thanks for spotting. I will address this in another PR. It's a simple fix that involves reverting to the current URL parsing logic for the time being and adding a test case for the URLs that caused this issue so they will be covered so there isn't a future occurrence of this.

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

I've just added a couple of comments related to formatting, apart from that from my side the PR is ready to go. Nevertheless, before giving the approval, I'd like to run a final test but I won't be able to do that before next Monday, sorry 🙏 .

@jd-alexander
Copy link
Contributor Author

I've just added a couple of comments related to formatting, apart from that from my side the PR is ready to go. Nevertheless, before giving the approval, I'd like to run a final test but I won't be able to do that before next Monday, sorry 🙏 .

No problem @fluiddot . I will update all the PRs so you can do your final tests then. Thanks much for the reviews so far. They have been thorough and helpful 🙇🏾‍♂️

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

LGTM 🎊 !

  • Tested on iPhone 11 (iOS 14.2) with build 49354
  • Tested on Samsung Galaxy S20 FE 5G (Android 10) with build 108007

# Conflicts:
#	packages/react-native-editor/CHANGELOG.md
@fluiddot fluiddot self-assigned this Jun 3, 2021
fluiddot added 2 commits June 3, 2021 11:13
# Conflicts:
#	packages/react-native-editor/CHANGELOG.md
# Conflicts:
#	packages/react-native-editor/CHANGELOG.md
@fluiddot fluiddot merged commit 7e360e4 into trunk Jun 3, 2021
@fluiddot fluiddot deleted the rnmobile/add/audio-block-capability branch June 3, 2021 10:32
@github-actions github-actions bot added this to the Gutenberg 10.9 milestone Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants