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] Release 1.16.0 to master #18261

Merged
merged 10 commits into from
Nov 4, 2019
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ branches:
only:
- master
- rnmobile/master
- rnmobile/releases
- /wp\/.*/

env:
Expand Down
18 changes: 11 additions & 7 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,18 @@ export class ImageEdit extends React.Component {
console.warn( 'Attributes has id with no url.' );
}

// Detect any pasted image and start an upload
if ( ! attributes.id && attributes.url && attributes.url.indexOf( 'file:' ) === 0 ) {
requestMediaImport( attributes.url, ( id, url ) => {
if ( url ) {
setAttributes( { id, url } );
}
} );
}

// Make sure we mark any temporary images as failed if they failed while
// the editor wasn't open
if ( attributes.id && attributes.url && ! isURL( attributes.url ) ) {
if ( attributes.url.indexOf( 'file:' ) === 0 ) {
requestMediaImport( attributes.url, ( id, url ) => {
if ( url ) {
setAttributes( { id, url } );
}
} );
}
mediaUploadSync();
}
}
Expand Down
17 changes: 5 additions & 12 deletions packages/block-library/src/media-text/media-container.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { View, ImageBackground, Text, TouchableWithoutFeedback } from 'react-native';
import {
requestMediaImport,
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
Expand Down Expand Up @@ -62,17 +61,11 @@ class MediaContainer extends Component {
}

componentDidMount() {
const { mediaId, mediaUrl, onMediaUpdate, mediaType } = this.props;

if ( mediaId && mediaUrl && ! isURL( mediaUrl ) ) {
if ( mediaUrl.indexOf( 'file:' ) === 0 && mediaType === MEDIA_TYPE_IMAGE ) {
// We don't want to call this for video because it is starting a media upload for the cover url
requestMediaImport( mediaUrl, ( id, url ) => {
if ( url ) {
onMediaUpdate( { id, url } );
}
} );
}
const { mediaId, mediaUrl } = this.props;

// Make sure we mark any temporary images as failed if they failed while
// the editor wasn't open
if ( mediaId && mediaUrl && mediaUrl.indexOf( 'file:' ) === 0 ) {
mediaUploadSync();
}
}
Expand Down