diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f8941b4b3..47c3e28861 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -266,6 +266,7 @@ workflows: branches: ignore: - develop + - /^dependabot/submodules/.*/ - ios-device-checks: name: Test iOS on Device - Full requires: [ "Optional UI Tests" ] @@ -274,6 +275,18 @@ workflows: requires: [ "Optional UI Tests" ] - android-native-unit-tests: name: Android Native Unit Tests + - ios-device-checks: + name: Test iOS on Device - Full (Submodule Update) + post-to-slack: true + filters: + branches: + only: /^dependabot/submodules/.*/ + - android-device-checks: + name: Test Android on Device - Full (Submodule Update) + post-to-slack: true + filters: + branches: + only: /^dependabot/submodules/.*/ ui-tests-full-scheduled: jobs: diff --git a/gutenberg b/gutenberg index e65e5e4faf..85eecf58b1 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit e65e5e4faf34d172161fb7156cc6b429576170bb +Subproject commit 85eecf58b1f723fa575229b33bd60446b48edd83 diff --git a/jetpack b/jetpack index 664f02770c..81ec9fc23f 160000 --- a/jetpack +++ b/jetpack @@ -1 +1 @@ -Subproject commit 664f02770c117ec2a22250b3639afdc9533be41a +Subproject commit 81ec9fc23f8508c59b84599a7e6aac701588d371 diff --git a/src/index.js b/src/index.js index c7051c9c86..082bcea445 100644 --- a/src/index.js +++ b/src/index.js @@ -14,9 +14,12 @@ import correctTextFontWeight from './text-font-weight-correct'; import setupJetpackEditor from './jetpack-editor-setup'; import initialHtml from './initial-html'; -addAction( 'native.pre-render', 'gutenberg-mobile', ( props ) => { +addAction( 'native.pre-render', 'gutenberg-mobile', () => { require( './strings-overrides' ); correctTextFontWeight(); +} ); + +addAction( 'native.render', 'gutenberg-mobile', ( props ) => { setupJetpackEditor( props.jetpackState || { blogId: 1, isJetpackActive: true } ); diff --git a/src/initial-html.js b/src/initial-html.js index 5392f60169..edc7127836 100644 --- a/src/initial-html.js +++ b/src/initial-html.js @@ -12,4 +12,16 @@ export default `
Random Street
+ + +
+ + + +
+ + + +
+ `; diff --git a/src/jetpack-editor-setup.js b/src/jetpack-editor-setup.js index ae031d4050..dcc1e65c57 100644 --- a/src/jetpack-editor-setup.js +++ b/src/jetpack-editor-setup.js @@ -2,10 +2,17 @@ * Internal dependencies */ import { JETPACK_DATA_PATH } from '../jetpack/extensions/shared/get-jetpack-data'; +/** + * WordPress dependencies + */ +import { dispatch, select } from '@wordpress/data'; // When adding new blocks to this list please also consider updating ./block-support/supported-blocks.json const supportedJetpackBlocks = { 'contact-info': { + available: __DEV__, + }, + story: { available: true, }, }; @@ -37,9 +44,27 @@ export default ( jetpackState ) => { const jetpackData = setJetpackData( jetpackState ); - if ( __DEV__ ) { - require( '../jetpack/extensions/editor' ); - } + // Note on the use of setTimeout() here: + // We observed the settings may not be ready exactly when the native.render hooks get run but rather + // right after that execution cycle (because state hasn't changed yet). Hence, we're only checking for + // the actual settings to be loaded by using setTimeout without a delay parameter. This ensures the + // settings are loaded onto the store and we can use the core/block-editor selector by the time we do + // the actual check. + + // eslint-disable-next-line @wordpress/react-no-unsafe-timeout + setTimeout( () => { + const mediaFilesCollectionBlock = select( + 'core/block-editor' + ).getSettings( 'capabilities' ).mediaFilesCollectionBlock; + + if ( mediaFilesCollectionBlock !== true ) { + dispatch( 'core/edit-post' ).hideBlockTypes( [ 'jetpack/story' ] ); + } else { + dispatch( 'core/edit-post' ).showBlockTypes( [ 'jetpack/story' ] ); + } + } ); + + require( '../jetpack/extensions/editor' ); return jetpackData; }; diff --git a/src/test/index.js b/src/test/index.js index bc33b11eb1..098aeb66e9 100644 --- a/src/test/index.js +++ b/src/test/index.js @@ -3,7 +3,7 @@ describe( 'Test Jetpack blocks', () => { const mockRegisterBlockCollection = jest.fn(); jest.mock( '@wordpress/blocks', () => { return { - getCategories: () => [], + getCategories: () => [ { slug: 'media' } ], setCategories: jest.fn(), registerBlockCollection: mockRegisterBlockCollection, }; @@ -12,6 +12,9 @@ describe( 'Test Jetpack blocks', () => { '../../jetpack/extensions/blocks/contact-info/editor.js', () => jest.fn() ); + jest.mock( '../../jetpack/extensions/blocks/story/editor.js', () => + jest.fn() + ); const setupJetpackEditor = require( '../jetpack-editor-setup' ).default; setupJetpackEditor( { blogId: 1, isJetpackActive: true } );