Skip to content

Commit a8a6937

Browse files
committed
refactor: Rename "NewGutenberg" to "GutenbergKit"
The use of "new" to uniquely describe something is problematic, as it provides little context and could become incorrect at some future time.
1 parent 43a17b5 commit a8a6937

File tree

8 files changed

+56
-56
lines changed

8 files changed

+56
-56
lines changed

WordPress/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ android {
180180
buildConfigField "boolean", "ENABLE_SITE_MONITORING", "false"
181181
buildConfigField "boolean", "SYNC_PUBLISHING", "false"
182182
buildConfigField "boolean", "ENABLE_IN_APP_UPDATES", "false"
183-
buildConfigField "boolean", "ENABLE_NEW_GUTENBERG", "false"
184-
buildConfigField "boolean", "ENABLE_NEW_GUTENBERG_THEME_STYLES", "false"
183+
buildConfigField "boolean", "ENABLE_GUTENBERG_KIT", "false"
184+
buildConfigField "boolean", "ENABLE_GUTENBERG_KIT_THEME_STYLES", "false"
185185

186186
manifestPlaceholders = [magicLinkScheme:"wordpress"]
187187
}

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt

+18-18
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ import org.wordpress.android.util.analytics.AnalyticsUtils
235235
import org.wordpress.android.util.analytics.AnalyticsUtils.BlockEditorEnabledSource
236236
import org.wordpress.android.util.config.ContactSupportFeatureConfig
237237
import org.wordpress.android.util.config.PostConflictResolutionFeatureConfig
238-
import org.wordpress.android.util.config.NewGutenbergFeatureConfig
239-
import org.wordpress.android.util.config.NewGutenbergThemeStylesFeatureConfig
238+
import org.wordpress.android.util.config.GutenbergKitFeatureConfig
239+
import org.wordpress.android.util.config.GutenbergKitThemeStylesFeatureConfig
240240
import org.wordpress.android.util.extensions.setLiftOnScrollTargetViewIdAndRequestLayout
241241
import org.wordpress.android.util.helpers.MediaFile
242242
import org.wordpress.android.util.helpers.MediaGallery
@@ -315,7 +315,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
315315
private var isXPostsCapable: Boolean? = null
316316
private var onGetSuggestionResult: Consumer<String?>? = null
317317
private var isVoiceContentSet = false
318-
private var isNewGutenbergEditor = false
318+
private var isGutenbergKitEditor = false
319319

320320
// For opening the context menu after permissions have been granted
321321
private var menuView: View? = null
@@ -410,8 +410,8 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
410410

411411
@Inject lateinit var postConflictResolutionFeatureConfig: PostConflictResolutionFeatureConfig
412412

413-
@Inject lateinit var newGutenbergFeatureConfig: NewGutenbergFeatureConfig
414-
@Inject lateinit var newGutenbergThemeStylesConfig: NewGutenbergThemeStylesFeatureConfig
413+
@Inject lateinit var gutenbergKitFeatureConfig: GutenbergKitFeatureConfig
414+
@Inject lateinit var gutenbergKitThemeStylesConfig: GutenbergKitThemeStylesFeatureConfig
415415

416416
@Inject lateinit var storePostViewModel: StorePostViewModel
417417
@Inject lateinit var storageUtilsViewModel: StorageUtilsViewModel
@@ -517,7 +517,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
517517
}
518518
onBackPressedDispatcher.addCallback(this, callback)
519519
dispatcher.register(this)
520-
isNewGutenbergEditor = newGutenbergFeatureConfig.isEnabled()
520+
isGutenbergKitEditor = gutenbergKitFeatureConfig.isEnabled()
521521

522522
createEditShareMessageActivityResultLauncher()
523523

@@ -726,7 +726,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
726726
}
727727

728728
isNewPost = state.getBoolean(EditPostActivityConstants.STATE_KEY_IS_NEW_POST, false)
729-
isNewGutenbergEditor = state.getBoolean(EditPostActivityConstants.STATE_KEY_IS_NEW_GUTENBERG, false)
729+
isGutenbergKitEditor = state.getBoolean(EditPostActivityConstants.STATE_KEY_IS_GUTENBERG_KIT, false)
730730
isVoiceContentSet = state.getBoolean(EditPostActivityConstants.STATE_KEY_IS_VOICE_CONTENT_SET, false)
731731
updatePostLoadingAndDialogState(
732732
fromInt(
@@ -783,7 +783,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
783783
}
784784

785785
private fun setupEditor() {
786-
if (isNewGutenbergEditor) {
786+
if (isGutenbergKitEditor) {
787787
GutenbergWebViewPool.getPreloadedWebView(getContext())
788788
}
789789
// Check whether to show the visual editor
@@ -1001,7 +1001,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
10011001
editorMedia.toastMessage.observe(this) { event: Event<ToastMessageHolder?> ->
10021002
event.getContentIfNotHandled()?.show(this)
10031003
}
1004-
if (!isNewGutenbergEditor) {
1004+
if (!isGutenbergKitEditor) {
10051005
storePostViewModel.onSavePostTriggered.observe(this) { unitEvent: Event<Unit> ->
10061006
unitEvent.applyIfNotHandled {
10071007
updateAndSavePostAsync()
@@ -1202,7 +1202,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
12021202
outState.putInt(EditPostActivityConstants.STATE_KEY_POST_LOADING_STATE, postLoadingState.value)
12031203
outState.putBoolean(EditPostActivityConstants.STATE_KEY_IS_NEW_POST, isNewPost)
12041204
outState.putBoolean(EditPostActivityConstants.STATE_KEY_IS_VOICE_CONTENT_SET, isVoiceContentSet)
1205-
outState.putBoolean(EditPostActivityConstants.STATE_KEY_IS_NEW_GUTENBERG, isNewGutenbergEditor)
1205+
outState.putBoolean(EditPostActivityConstants.STATE_KEY_IS_GUTENBERG_KIT, isGutenbergKitEditor)
12061206
outState.putBoolean(
12071207
EditPostActivityConstants.STATE_KEY_IS_PHOTO_PICKER_VISIBLE,
12081208
editorPhotoPicker?.isPhotoPickerShowing() ?: false
@@ -1412,11 +1412,11 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
14121412
val helpMenuItem = menu.findItem(R.id.menu_editor_help)
14131413
if (undoItem != null) {
14141414
undoItem.setEnabled(menuHasUndo)
1415-
undoItem.setVisible(!htmlModeMenuStateOn && !isNewGutenbergEditor)
1415+
undoItem.setVisible(!htmlModeMenuStateOn && !isGutenbergKitEditor)
14161416
}
14171417
if (redoItem != null) {
14181418
redoItem.setEnabled(menuHasRedo)
1419-
redoItem.setVisible(!htmlModeMenuStateOn && !isNewGutenbergEditor)
1419+
redoItem.setVisible(!htmlModeMenuStateOn && !isGutenbergKitEditor)
14201420
}
14211421
if (secondaryAction != null && editPostRepository.hasPost()) {
14221422
secondaryAction.setVisible(showMenuItems && this.secondaryAction.isVisible)
@@ -1463,7 +1463,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
14631463
}
14641464
val contentInfo = menu.findItem(R.id.menu_content_info)
14651465
(editorFragment as? GutenbergEditorFragment)?.let { gutenbergEditorFragment ->
1466-
if (isNewGutenbergEditor) {
1466+
if (isGutenbergKitEditor) {
14671467
contentInfo.isVisible = false
14681468
} else {
14691469
contentInfo.setOnMenuItemClickListener { _: MenuItem? ->
@@ -2171,7 +2171,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
21712171
i.putExtra(EditPostActivityConstants.EXTRA_RESTART_EDITOR, restartEditorOption.name)
21722172
i.putExtra(EditPostActivityConstants.STATE_KEY_EDITOR_SESSION_DATA, postEditorAnalyticsSession)
21732173
i.putExtra(EditPostActivityConstants.EXTRA_IS_NEW_POST, isNewPost)
2174-
i.putExtra(EditPostActivityConstants.STATE_KEY_IS_NEW_GUTENBERG, isNewGutenbergEditor)
2174+
i.putExtra(EditPostActivityConstants.STATE_KEY_IS_GUTENBERG_KIT, isGutenbergKitEditor)
21752175
setResult(RESULT_OK, i)
21762176
}
21772177

@@ -2401,7 +2401,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
24012401
override fun getItem(position: Int): Fragment {
24022402
return when (position) {
24032403
PAGE_CONTENT -> {
2404-
if (isNewGutenbergEditor && showGutenbergEditor) {
2404+
if (isGutenbergKitEditor && showGutenbergEditor) {
24052405
createGutenbergKitEditorFragment()
24062406
} else if (showGutenbergEditor) {
24072407
createGutenbergEditorFragment()
@@ -2456,7 +2456,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
24562456
"siteApiRoot" to siteApiRoot,
24572457
"authHeader" to authHeader,
24582458
"siteApiNamespace" to siteApiNamespace,
2459-
"themeStyles" to newGutenbergThemeStylesConfig.isEnabled()
2459+
"themeStyles" to gutenbergKitThemeStylesConfig.isEnabled()
24602460
)
24612461

24622462
return GutenbergKitEditorFragment.newInstance(
@@ -2508,7 +2508,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
25082508
PAGE_CONTENT -> {
25092509
editorFragment = fragment as EditorFragmentAbstract
25102510
editorFragment?.setImageLoader(imageLoader)
2511-
if (isNewGutenbergEditor) {
2511+
if (isGutenbergKitEditor) {
25122512
editorFragment?.onEditorContentChanged(object : GutenbergView.ContentChangeListener {
25132513
override fun onContentChanged(title: String, content: String) {
25142514
storePostViewModel.savePostWithDelay()
@@ -3635,7 +3635,7 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
36353635
}
36363636

36373637
private fun updateVoiceContentIfNeeded() {
3638-
if (isNewGutenbergEditor) {
3638+
if (isGutenbergKitEditor) {
36393639
return
36403640
}
36413641
// Check if voice content exists and this is a new post for a Gutenberg editor fragment

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivityConstants.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ object EditPostActivityConstants{
4242
const val STATE_KEY_UNDO = "stateKeyUndo"
4343
const val STATE_KEY_REDO = "stateKeyRedo"
4444
const val STATE_KEY_IS_VOICE_CONTENT_SET = "stateKeyIsVoiceContentSet"
45-
const val STATE_KEY_IS_NEW_GUTENBERG = "stateKeyIsNewGutenberg"
45+
const val STATE_KEY_IS_GUTENBERG_KIT = "stateKeyIsGutenbergKit"
4646
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wordpress.android.util.config
2+
3+
import org.wordpress.android.BuildConfig
4+
import org.wordpress.android.annotation.Feature
5+
import javax.inject.Inject
6+
7+
private const val GUTENBERG_KIT_FEATURE_REMOTE_FIELD = "experimental_block_editor"
8+
9+
@Feature(GUTENBERG_KIT_FEATURE_REMOTE_FIELD, false)
10+
class GutenbergKitFeatureConfig @Inject constructor(
11+
appConfig: AppConfig
12+
) : FeatureConfig(
13+
appConfig,
14+
BuildConfig.ENABLE_GUTENBERG_KIT,
15+
GUTENBERG_KIT_FEATURE_REMOTE_FIELD
16+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wordpress.android.util.config
2+
3+
import org.wordpress.android.BuildConfig
4+
import org.wordpress.android.annotation.Feature
5+
import javax.inject.Inject
6+
7+
private const val GUTENBERG_KIT_THEME_STYLES_FEATURE_REMOTE_FIELD = "experimental_block_editor_theme_styles"
8+
9+
@Feature(GUTENBERG_KIT_THEME_STYLES_FEATURE_REMOTE_FIELD, false)
10+
class GutenbergKitThemeStylesFeatureConfig @Inject constructor(
11+
appConfig: AppConfig
12+
) : FeatureConfig(
13+
appConfig,
14+
BuildConfig.ENABLE_GUTENBERG_KIT_THEME_STYLES,
15+
GUTENBERG_KIT_THEME_STYLES_FEATURE_REMOTE_FIELD
16+
)

WordPress/src/main/java/org/wordpress/android/util/config/NewGutenbergFeatureConfig.kt

-16
This file was deleted.

WordPress/src/main/java/org/wordpress/android/util/config/NewGutenbergThemeStylesFeatureConfig.kt

-16
This file was deleted.

libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergKitEditorFragment.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class GutenbergKitEditorFragment extends EditorFragmentAbstract implement
7070
private static final String ARG_GUTENBERG_WEB_VIEW_AUTH_DATA = "param_gutenberg_web_view_auth_data";
7171
public static final String ARG_FEATURED_IMAGE_ID = "featured_image_id";
7272
public static final String ARG_JETPACK_FEATURES_ENABLED = "jetpack_features_enabled";
73-
public static final String ARG_NEW_GUTENBERG_SETTINGS = "new_gutenberg_settings";
73+
public static final String ARG_GUTENBERG_KIT_SETTINGS = "gutenberg_kit_settings";
7474

7575
private static final int CAPTURE_PHOTO_PERMISSION_REQUEST_CODE = 101;
7676
private static final int CAPTURE_VIDEO_PERMISSION_REQUEST_CODE = 102;
@@ -94,7 +94,7 @@ public static GutenbergKitEditorFragment newInstance(Context context,
9494
Bundle args = new Bundle();
9595
args.putBoolean(ARG_IS_NEW_POST, isNewPost);
9696
args.putBoolean(ARG_JETPACK_FEATURES_ENABLED, jetpackFeaturesEnabled);
97-
args.putSerializable(ARG_NEW_GUTENBERG_SETTINGS, (Serializable) settings);
97+
args.putSerializable(ARG_GUTENBERG_KIT_SETTINGS, (Serializable) settings);
9898
fragment.setArguments(args);
9999
SavedInstanceDatabase db = SavedInstanceDatabase.Companion.getDatabase(context);
100100
mSettings = settings;
@@ -122,7 +122,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
122122
@Override
123123
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
124124
if (getArguments() != null) {
125-
mSettings = (Map<String, Object>) getArguments().getSerializable(ARG_NEW_GUTENBERG_SETTINGS);
125+
mSettings = (Map<String, Object>) getArguments().getSerializable(ARG_GUTENBERG_KIT_SETTINGS);
126126
}
127127

128128
mGutenbergView = GutenbergWebViewPool.getPreloadedWebView(requireContext());

0 commit comments

Comments
 (0)