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

Re-implement #2611 Support for story block rendering on 1.41.1 #2807

Merged
merged 126 commits into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
73c9f84
updated jetpack submodule commit hash
mzorz Sep 3, 2020
82d121e
Revert "updated jetpack submodule commit hash"
mzorz Sep 3, 2020
81677c0
Merge branch 'develop' of https://github.com/wordpress-mobile/gutenbe…
mzorz Sep 3, 2020
ddb9042
update jetpack to latest, containing the story block
mzorz Sep 4, 2020
71cd744
declaring the jetpack/story block supported in mobile
mzorz Sep 4, 2020
c7cbc03
added story block basic rendering, processing mediaFiles attribute
mzorz Sep 4, 2020
c82e06d
added StoryEditingButton for use in the story block in jetpack
mzorz Sep 9, 2020
13e3d83
updated gutenberg/jetpack commit hash for requestStoryCreatorLoad bri…
mzorz Sep 10, 2020
60088f8
udpated gutenberg commit hash with new WPANdroid bridge interface OnS…
mzorz Sep 10, 2020
4def44f
udpated commit hash for gutenberg and jetpack: making requestStoryCre…
mzorz Sep 11, 2020
00a0cc0
fixed merge conflict
mzorz Sep 15, 2020
0dcfe93
updated jetpac and gutenberg libs hashes to point to new StoryUpdateP…
mzorz Sep 21, 2020
1697f9f
updated commit hash for gutenebrg and jetpack; updated save progress …
mzorz Sep 24, 2020
7e0dc26
updated commit hashes for gutenberg and jetpack with stories block up…
mzorz Sep 25, 2020
888d6c8
updated commit hash for gutenberg and jetpack to use new onStorySaveR…
mzorz Sep 25, 2020
4cae822
updated hash for gutenebrg and jetpack with stories block updates
mzorz Sep 28, 2020
85bf8ac
updated gutenberg and jetpack commit hashes with mediaModelCreated br…
mzorz Sep 28, 2020
a7bc72c
updated commit hash for gutenebrg and jetpack libs, updating mediaID …
mzorz Sep 29, 2020
21b823b
updated commit hash for gutenebrg and jetpack, just removed commented…
mzorz Sep 29, 2020
7f9313f
updated gutenberg commit hash
mzorz Sep 30, 2020
430fd3c
updated jetpack commit hash
mzorz Sep 30, 2020
fd31777
updated commit hash for gutenberg with fix for mobile demo app
mzorz Oct 1, 2020
e39c4ea
updated jetpack commit hash:
mzorz Oct 1, 2020
d7f1140
fixed lint prettier warning
mzorz Oct 1, 2020
a3b108e
updated jetpack branch
mzorz Oct 1, 2020
22c192d
updated jetpack commit hash
mzorz Oct 1, 2020
b268544
updated commit hash for gutenberg
mzorz Oct 1, 2020
f422a64
Merge branch 'develop' into try/jetpack-stories-block
mzorz Oct 1, 2020
33f2add
updated gutenberg and jetpack commit hashes
mzorz Oct 1, 2020
f78b24f
fixed merge conflicts
mzorz Oct 1, 2020
b1de4df
updated commit hash
mzorz Oct 1, 2020
c456f91
fixed merge conflicts and updated gutenberg and jetpack submodules
mzorz Oct 9, 2020
0f8916f
moved jetpack/story block examples to initial-html for demo loader
mzorz Oct 9, 2020
8409426
fixed merge conflicts and updated gutenberg and jetpack submodules
mzorz Oct 9, 2020
bd29f74
fixed merge conflict
mzorz Oct 9, 2020
7c7430c
fix getCategories mock
mzorz Oct 9, 2020
6360f4c
fixed prettier error
mzorz Oct 9, 2020
8eb4501
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Oct 9, 2020
e4031f4
only set initialData with demo initialHtml example if initialData not…
mzorz Oct 10, 2020
aa1b58b
only set initialData with demo initialHtml example if initialData not…
mzorz Oct 10, 2020
aa296b8
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Oct 10, 2020
445bdec
Merge branch 'try/jetpack-stories-block-on-done' into try/jetpack-sto…
mzorz Oct 10, 2020
5e87399
updated commit hashes for guetnberg and jetpack
mzorz Oct 10, 2020
c631969
upated gutenberg commit hash
mzorz Oct 10, 2020
e8aea4a
updated jetpack and gutenberg commit hashes with new method renames
mzorz Oct 10, 2020
be942f0
updated gutenberg commit hash, fixed prettier error
mzorz Oct 11, 2020
e4b907c
updated gutenberg commit hash
mzorz Oct 11, 2020
90f84ac
updated gutenberg and jetpack commit hash for story error handling lo…
mzorz Oct 11, 2020
246d3a7
added bridge methods for cancel and retry uploads on mediaFiles colle…
mzorz Oct 12, 2020
4a09adc
deep copy of mediaFiles when assigning new mediaUrl or mediaId
mzorz Oct 12, 2020
8f30bdf
updated commit hash; implemented requestMediaFilesSaveCancelDialog br…
mzorz Oct 12, 2020
433e2cb
updated gutenberg and jetpack commit hashes for bridge method rename …
mzorz Oct 13, 2020
875112c
updated jetpack commit hash - just removed commented out code
mzorz Oct 14, 2020
a76e417
updated gutenberg commit hash
mzorz Oct 14, 2020
3130e24
updated gutenberg and jetpack commit hashes
mzorz Oct 14, 2020
57f2618
Merge pull request #2706 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 14, 2020
19dc04b
updated commit hash for merged PRs in gutenberg and jetapck submodules
mzorz Oct 14, 2020
6c287df
fixed merge conflict, updated jetpack and gutenberg commit hashes
mzorz Oct 14, 2020
03d3abe
Merge pull request #2663 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 14, 2020
de365b1
updated jetpack and gutenberg commit hashes and fixed merge conflicts…
mzorz Oct 14, 2020
afedc7e
updated commit hash for gutenberg and jetpack
mzorz Oct 16, 2020
56f2eda
updated gutenberg and jetpack
mzorz Oct 16, 2020
c238c6d
unmade change to package-lock.json
mzorz Oct 16, 2020
8511312
mocked the story web editor impl for gutenberg-mobile tests
mzorz Oct 16, 2020
1ca2893
Revert "mocked the story web editor impl for gutenberg-mobile tests"
mzorz Oct 16, 2020
ddb2681
mocked the story web editor impl for gutenberg-mobile tests
mzorz Oct 15, 2020
b7d8c8c
ran prettier on file
mzorz Oct 16, 2020
40de7b2
merged gutenberg master branch
mzorz Oct 16, 2020
e7aa037
bump ci
mzorz Oct 16, 2020
1e63767
Revert "bump ci"
mzorz Oct 16, 2020
6274268
fixed merge conflicts
mzorz Oct 16, 2020
080a970
Update gutenberg ref
etoledom Oct 20, 2020
ed36dfc
updated jetpack commit hash
mzorz Oct 20, 2020
ba4df52
updated gutenberg commit hash
mzorz Oct 21, 2020
fdbb451
Merge pull request #2708 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 22, 2020
21e9229
updated gutenberg and jetpack commit hashes with latest squashed comm…
mzorz Oct 22, 2020
4259361
updated gutenberg and jetpack commit hashes
mzorz Oct 27, 2020
945e7aa
updated gutenberg commit hash
mzorz Oct 27, 2020
f94126b
updated commit hash with props rename for mediaFilesCollectionBlock p…
mzorz Oct 28, 2020
0c8e155
updated gutetnberg commit hash
mzorz Oct 28, 2020
a361b1d
moved mediaFilesCollectionBlock feature/capability flag code from gut…
mzorz Oct 28, 2020
f6b14e4
Merge pull request #2762 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 30, 2020
1ad0cff
move the setupJetpackEditor() call fr om to action
mzorz Oct 30, 2020
67d6fc3
updated gutenberg commit hash
mzorz Oct 30, 2020
5453504
updated gutenberg commit hash
mzorz Oct 30, 2020
835a286
mocked useSelect, useDispatch in test
mzorz Oct 30, 2020
f2f39f9
updated branch with base, fixed merge conflict on gutenberg by updati…
mzorz Nov 2, 2020
2305176
updated jetpack commit hash, updated jetpack stories branch with late…
mzorz Nov 2, 2020
0d988a2
prettified
mzorz Nov 2, 2020
b92394b
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Nov 2, 2020
f312735
moved select/dispatch call logic within setTimeout to ensure its run …
mzorz Nov 2, 2020
e5f8084
removed commented test code
mzorz Nov 2, 2020
9bf27e0
removed non-applicable comment heading
mzorz Nov 2, 2020
25d82e7
prettified
mzorz Nov 2, 2020
6eb17d5
added comment describing the value of having a setTimeout() call here
mzorz Nov 3, 2020
f1fcac2
ran prettier
mzorz Nov 3, 2020
96a7f64
Merge pull request #2770 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Nov 3, 2020
fec4f0c
updadted gutenberg hash
mzorz Nov 3, 2020
4d378dc
removed unused param
mzorz Nov 3, 2020
87cbeb8
Merge pull request #2766 from wordpress-mobile/try/jetpack-blocks-reg…
mzorz Nov 4, 2020
63845b1
updated gutenberg commit hash
mzorz Nov 4, 2020
cc6c788
updated gutenberg with base branch, updated commit hash
mzorz Nov 4, 2020
d87f7cb
updated jetpack with master branch, updated jetpack commit hash
mzorz Nov 4, 2020
fcc128d
Merge branch 'develop' into try/jetpack-stories-block
mzorz Nov 4, 2020
43013f1
updated gutenberg
mzorz Nov 4, 2020
3bf1355
updated with latest jetpack commit hash
mzorz Nov 5, 2020
08757d2
updated gutenberg and jetpack commit hashes
mzorz Nov 5, 2020
680dc5e
Update gutenberg ref
etoledom Nov 6, 2020
c4efb55
Merge branch 'develop' into try/jetpack-stories-block
mzorz Nov 6, 2020
4725701
updated gutenberg commit hash to latest, merged with master
mzorz Nov 6, 2020
82ac170
updated gutenberg commit hash
mzorz Nov 6, 2020
65817bd
Bump gutenberg from `f06dcd9` to `c531129`
dependabot[bot] Nov 9, 2020
e297bb8
Merge pull request #2785 from wordpress-mobile/dependabot/submodules/…
hypest Nov 9, 2020
ba05bdd
Run full e2e test suite on dependabot submodule update prs and post f…
ceyhun Nov 9, 2020
a6233e7
Bump jetpack from `664f027` to `b7ccbb1`
dependabot[bot] Nov 9, 2020
a31443d
Merge pull request #2790 from wordpress-mobile/dependabot/submodules/…
hypest Nov 9, 2020
3d70f50
Update config to auto-merge gutenberg and jetpack
ceyhun Nov 9, 2020
6feecec
Revert "Update config to auto-merge gutenberg and jetpack"
ceyhun Nov 9, 2020
18a9c75
Ignore 'Optional UI Tests' on dependabot submodule branches
ceyhun Nov 9, 2020
25d6ae1
Rename job
ceyhun Nov 9, 2020
d650829
Rename job
ceyhun Nov 9, 2020
1b6bf21
Merge pull request #2789 from wordpress-mobile/dependabot/submodules/…
hypest Nov 9, 2020
7fc9cfc
fixed merge conflicts, updated gutenberg commit hash
mzorz Nov 9, 2020
30229a8
Merge branch 'try/jetpack-stories-block' into jetpack-stories-block-b…
cameronvoell Nov 14, 2020
92598b5
moved __DEV__ flag to contact-info block availability decl only
mzorz Nov 11, 2020
e80e0b9
updated jetpack and gutenberg commit hashes with revert-revert, bring…
mzorz Nov 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ workflows:
branches:
ignore:
- develop
- /^dependabot/submodules/.*/
- ios-device-checks:
name: Test iOS on Device - Full
requires: [ "Optional UI Tests" ]
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 21 files
+1 −0 packages/base-styles/_colors.native.scss
+104 −0 packages/block-editor/src/components/block-media-update-progress/README.md
+299 −0 packages/block-editor/src/components/block-media-update-progress/index.native.js
+9 −0 packages/block-editor/src/components/block-media-update-progress/styles.native.scss
+500 −0 packages/block-editor/src/components/block-media-update-progress/test/index.native.js
+1 −0 packages/block-editor/src/components/index.native.js
+5 −1 packages/edit-post/src/editor.native.js
+1 −1 packages/react-native-bridge/android/build.gradle
+26 −0 ...-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java
+29 −0 ...droid/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java
+86 −8 ...ages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/DeferredEventEmitter.java
+3 −0 packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt
+93 −5 packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java
+115 −5 packages/react-native-bridge/index.js
+42 −4 packages/react-native-bridge/ios/Gutenberg.swift
+28 −5 packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift
+6 −0 packages/react-native-bridge/ios/RNReactNativeGutenbergBridge.m
+38 −0 packages/react-native-bridge/ios/RNReactNativeGutenbergBridge.swift
+30 −1 packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
+21 −1 packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift
+1 −0 test/native/setup.js
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
);
Expand Down
12 changes: 12 additions & 0 deletions src/initial-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ export default `
<div class="wp-block-jetpack-address"><div class="jetpack-address__address jetpack-address__address1">Random Street</div></div>
<!-- /wp:jetpack/address --></div>
<!-- /wp:jetpack/contact-info -->

<!-- wp:jetpack/story {"mediaFiles":[{"alt":"","caption":"","id":320,"link":"https://cldup.com/n48GTQmw7s.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/n48GTQmw7s.jpg"},{"alt":"","caption":"","id":321,"link":"https://cldup.com/u2kdydrlQv.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/u2kdydrlQv.jpg"},{"alt":"","caption":"","id":319,"link":"https://cldup.com/fi7gqyUrbL.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/fi7gqyUrbL.jpg"}]} -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->

<!-- wp:jetpack/story -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->

<!-- wp:jetpack/story {"mediaFiles":[]}} -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->
`;
31 changes: 28 additions & 3 deletions src/jetpack-editor-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
Expand Down Expand Up @@ -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;
};
5 changes: 4 additions & 1 deletion src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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 } );
Expand Down