From b861a01befc4b3df5ba6b554bd1930fff095307b Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 17 Apr 2023 11:01:45 +0100 Subject: [PATCH 01/10] feat: Emit post save event to Gutenberg --- .../android/editor/gutenberg/GutenbergContainerFragment.java | 4 ++++ .../android/editor/gutenberg/GutenbergEditorFragment.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java index 8a239417db0e..a50feb78fbdf 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java @@ -182,6 +182,10 @@ public void toggleHtmlMode() { mWPAndroidGlueCode.toggleEditorMode(mHtmlModeEnabled); } + public void sendToJSPostSaveEvent () { + mWPAndroidGlueCode.sendToJSPostSaveEvent(); + } + /** * Returns the contents of the content field from the JavaScript editor. Should be called from a background thread * where possible. diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 9494980db126..bb62eecb8ac2 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -1130,6 +1130,10 @@ private void toggleHtmlMode() { getGutenbergContainerFragment().toggleHtmlMode(); } + public void sendToJSPostSaveEvent() { + getGutenbergContainerFragment().sendToJSPostSaveEvent(); + } + /* * TODO: REMOVE THIS ONCE AZTEC COMPLETELY REPLACES THE VISUAL EDITOR IN WPANDROID APP */ From 60d4a7a91e419585dc74f8a033280e4082e22025 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 17 Apr 2023 11:22:40 +0100 Subject: [PATCH 02/10] chore: Update Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a7ace7600cb7..153b0ecb52eb 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ ext { automatticRestVersion = '1.0.8' automatticStoriesVersion = '2.1.0' automatticTracksVersion = '2.2.0' - gutenbergMobileVersion = 'v1.93.0' + gutenbergMobileVersion = '5663-725b6062721a331a750605ef79407e544006474f' wordPressAztecVersion = 'v1.6.3' wordPressFluxCVersion = 'trunk-c4f88d5272c51d59cb7763681699b5925d76dace' wordPressLoginVersion = '1.3.0' From 8e21f9129e95a27b752ed46821153cfeca63034a Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 17 Apr 2023 16:12:00 +0100 Subject: [PATCH 03/10] feat: Send save event to JS when post's saved --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 043c13901e03..d29388ccb997 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -1738,6 +1738,9 @@ private void setGutenbergEnabledIfNeeded() { } private ActivityFinishState savePostOnline(boolean isFirstTimePublish) { + if (mEditorFragment instanceof GutenbergEditorFragment) { + ((GutenbergEditorFragment) mEditorFragment).sendToJSPostSaveEvent(); + } return mViewModel.savePostOnline(isFirstTimePublish, this, mEditPostRepository, mSite); } From 184328756e36d59aace103f2a4b5a0318dfeb3e9 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 17 Apr 2023 21:55:50 +0100 Subject: [PATCH 04/10] chore: Update Gutenberg Mobile ref --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 153b0ecb52eb..424d384a1262 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ ext { automatticRestVersion = '1.0.8' automatticStoriesVersion = '2.1.0' automatticTracksVersion = '2.2.0' - gutenbergMobileVersion = '5663-725b6062721a331a750605ef79407e544006474f' + gutenbergMobileVersion = '5663-8892d3bf572dddcf09b8cc3478bb76d2d1a7e65c' wordPressAztecVersion = 'v1.6.3' wordPressFluxCVersion = 'trunk-c4f88d5272c51d59cb7763681699b5925d76dace' wordPressLoginVersion = '1.3.0' From 275a787db58e57aafdf241f9d23e8ee1b6921ca5 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 17 Apr 2023 22:36:38 +0100 Subject: [PATCH 05/10] refactor: Remove unnecessary whitespace --- .idea/codeStyles/Project.xml | 4 +--- .../android/editor/gutenberg/GutenbergContainerFragment.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index a145657e502b..5ee4f2b40452 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -35,8 +35,6 @@ - + - -