Skip to content

Commit

Permalink
Merge pull request #21223 from wordpress-mobile/task/integrate-gutenb…
Browse files Browse the repository at this point in the history
…erg-kit-with-api

Add GutenbergKit
  • Loading branch information
dcalhoun authored Oct 17, 2024
2 parents 3574ac4 + 8e5333d commit 93c47b1
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 77 deletions.
4 changes: 4 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ repositories {
includeGroup "org.wordpress.fluxc"
includeGroup "org.wordpress.wellsql"
includeGroup "org.wordpress.gutenberg-mobile"
includeGroup "org.wordpress.gutenbergkit"
includeGroupByRegex "org.wordpress.react-native-libraries.*"
includeGroup "com.automattic"
includeGroup "com.automattic.tracks"
Expand Down Expand Up @@ -218,6 +219,7 @@ android {
buildConfigField "boolean", "ENABLE_SITE_MONITORING", "false"
buildConfigField "boolean", "SYNC_PUBLISHING", "false"
buildConfigField "boolean", "ENABLE_IN_APP_UPDATES", "false"
buildConfigField "boolean", "ENABLE_NEW_GUTENBERG", "false"

manifestPlaceholders = [magicLinkScheme:"wordpress"]
}
Expand Down Expand Up @@ -431,6 +433,8 @@ dependencies {
}
implementation("$gradle.ext.aboutAutomatticBinaryPath:${libs.versions.automattic.about.get()}")

implementation("$gradle.ext.gutenbergKitBinaryPath:${libs.versions.gutenberg.kit.get()}")

implementation(libs.automattic.rest) {
exclude group: 'com.mcxiaoke.volley'
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ object EditPostActivityConstants{
const val STATE_KEY_UNDO = "stateKeyUndo"
const val STATE_KEY_REDO = "stateKeyRedo"
const val STATE_KEY_IS_VOICE_CONTENT_SET = "stateKeyIsVoiceContentSet"
const val STATE_KEY_IS_NEW_GUTENBERG = "stateKeyIsNewGutenberg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.wordpress.android.util.config

import org.wordpress.android.BuildConfig
import org.wordpress.android.annotation.Feature
import javax.inject.Inject

private const val NEW_GUTENBERG_FEATURE_REMOTE_FIELD = "experimental_block_editor"

@Feature(NEW_GUTENBERG_FEATURE_REMOTE_FIELD, false)
class NewGutenbergFeatureConfig @Inject constructor(
appConfig: AppConfig
) : FeatureConfig(
appConfig,
BuildConfig.ENABLE_NEW_GUTENBERG,
NEW_GUTENBERG_FEATURE_REMOTE_FIELD
)
12 changes: 12 additions & 0 deletions config/gradle/included_builds.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ gradle.ext.fluxCBinaryPath = "org.wordpress:fluxc"
gradle.ext.wputilsBinaryPath = "org.wordpress:utils"
gradle.ext.gutenbergMobileBinaryPath = "org.wordpress.gutenberg-mobile:react-native-gutenberg-bridge"
gradle.ext.includedBuildGutenbergMobilePath = null
gradle.ext.gutenbergKitBinaryPath = "org.wordpress.gutenbergkit:android"
gradle.ext.includedBuildGutenbergKitPath = null
gradle.ext.loginFlowBinaryPath = "org.wordpress:login"
gradle.ext.aztecAndroidAztecPath = "org.wordpress:aztec"
gradle.ext.aztecAndroidWordPressShortcodesPath = "org.wordpress.aztec:wordpress-shortcodes"
Expand Down Expand Up @@ -54,6 +56,16 @@ if (localBuilds.exists()) {
}
}

if (ext.has("localGutenbergKitPath")) {
gradle.ext.includedBuildGutenbergKitPath = ext.localGutenbergKitPath
includeBuild("$ext.localGutenbergKitPath/Demo-Android") {
dependencySubstitution {
println "Substituting GutenbergKit with the local build"
substitute module("$gradle.ext.gutenbergKitBinaryPath") using project(':Gutenberg')
}
}
}

if (ext.has("localLoginFlowPath")) {
includeBuild(ext.localLoginFlowPath) {
dependencySubstitution {
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ google-play-services-auth = '20.4.1'
google-services = '4.4.2'
gravatar = '1.0.0'
greenrobot-eventbus = '3.3.1'
gutenberg-kit = 'trunk-a58a46f3fbb892f311b562e3c122d7ef4ebbfe33'
gutenberg-mobile = 'v1.121.0'
indexos-media-for-mobile = '43a9026f0973a2f0a74fa813132f6a16f7499c3a'
jackson-databind = '2.12.7.1'
Expand Down
5 changes: 5 additions & 0 deletions libs/editor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repositories {
includeGroup "org.wordpress"
includeGroup "org.wordpress.aztec"
includeGroup "org.wordpress.gutenberg-mobile"
includeGroup "org.wordpress.gutenbergkit"
includeGroupByRegex "org.wordpress.react-native-libraries.*"
includeGroup "com.automattic"
includeGroup "com.automattic.tracks"
Expand Down Expand Up @@ -93,6 +94,10 @@ dependencies {
exclude module: 'react-android'
}

// This dependency will be substituted if the `local-builds.gradle` file contains
// `localGutenbergKitPath`. Details for this can be found in the `settings.gradle` file.
implementation("$rootProject.gradle.ext.gutenbergKitBinaryPath:${libs.versions.gutenberg.kit.get()}")

implementation(libs.wordpress.utils)

implementation(libs.androidx.lifecycle.common)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import org.wordpress.aztec.toolbar.IAztecToolbarClickListener;
import org.wordpress.aztec.util.AztecLog;
import org.wordpress.aztec.watchers.EndOfBufferMarkerAdder;
import org.wordpress.gutenberg.GutenbergView.ContentChangeListener;
import org.xml.sax.Attributes;

import java.util.ArrayList;
Expand Down Expand Up @@ -706,6 +707,9 @@ public Pair<CharSequence, CharSequence> getTitleAndContent(CharSequence original
return new Pair<>(getTitle(), getContent(originalContent));
}

@Override public void onEditorContentChanged(@Nullable ContentChangeListener listener) {
}

@Override
public void onToolbarCollapseButtonClicked() {
mEditorFragmentListener.onTrackableEvent(TrackableEvent.ELLIPSIS_COLLAPSE_BUTTON_TAPPED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.wordpress.android.editor.gutenberg.DialogVisibilityProvider;
import org.wordpress.android.util.helpers.MediaFile;
import org.wordpress.android.util.helpers.MediaGallery;
import org.wordpress.gutenberg.GutenbergView.ContentChangeListener;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -38,6 +39,7 @@ public class EditorFragmentNotAddedException extends Exception {
public abstract void showContentInfo() throws EditorFragmentNotAddedException;
public abstract Pair<CharSequence, CharSequence> getTitleAndContent(CharSequence originalContent) throws
EditorFragmentNotAddedException;
public abstract void onEditorContentChanged(ContentChangeListener listener);
public abstract LiveData<Editable> getTitleOrContentChanged();
public abstract void appendMediaFile(MediaFile mediaFile, String imageUrl, ImageLoader imageLoader);
public abstract void appendMediaFiles(Map<String, MediaFile> mediaList);
Expand Down
Loading

0 comments on commit 93c47b1

Please sign in to comment.