From f9699535558000efae1f524451239bbfb6db59c3 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 16 Jul 2020 16:59:54 +0300 Subject: [PATCH 1/5] MLP Android GlueCode --- .../wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java index 12483bed00307b..7fbd73290d6241 100644 --- a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java +++ b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java @@ -114,6 +114,7 @@ public class WPAndroidGlueCode { public static final String PROP_NAME_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR = "unsupportedBlockEditor"; private static final String PROP_NAME_COLORS = "colors"; private static final String PROP_NAME_GRADIENTS = "gradients"; + private static final String PROP_NAME_MODAL_LAYOUT_PICKER = "modalLayoutPicker"; private static OkHttpHeaderInterceptor sAddCookiesInterceptor = new OkHttpHeaderInterceptor(); private static OkHttpClient sOkHttpClient = new OkHttpClient.Builder().addInterceptor(sAddCookiesInterceptor).build(); @@ -434,7 +435,8 @@ public void onCreateView(Context initContext, @Nullable Boolean isSiteUsingWpComRestApi, @Nullable Bundle editorTheme, boolean isUnsupportedBlockEditorEnabled, - boolean enableMentionsFlag) { + boolean enableMentionsFlag, + boolean isModalLayoutPickerEnabled) { mIsDarkMode = isDarkMode; mExceptionLogger = exceptionLogger; mBreadcrumbLogger = breadcrumbLogger; @@ -472,6 +474,7 @@ public void onCreateView(Context initContext, capabilities.putBoolean(PROP_NAME_CAPABILITIES_MENTIONS, isSiteUsingWpComRestApi && enableMentionsFlag); } capabilities.putBoolean(PROP_NAME_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, isUnsupportedBlockEditorEnabled); + capabilities.putBoolean(PROP_NAME_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled); initialProps.putBundle(PROP_NAME_CAPABILITIES, capabilities); Serializable colors = editorTheme != null ? editorTheme.getSerializable(PROP_NAME_COLORS) : null; From 284faf7171b831ce36854b43c82f8dd9b74adbc2 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 22 Jul 2020 15:38:10 +0300 Subject: [PATCH 2/5] Revert "MLP Android GlueCode" This reverts commit f9699535558000efae1f524451239bbfb6db59c3. --- .../wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java index 7fbd73290d6241..12483bed00307b 100644 --- a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java +++ b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java @@ -114,7 +114,6 @@ public class WPAndroidGlueCode { public static final String PROP_NAME_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR = "unsupportedBlockEditor"; private static final String PROP_NAME_COLORS = "colors"; private static final String PROP_NAME_GRADIENTS = "gradients"; - private static final String PROP_NAME_MODAL_LAYOUT_PICKER = "modalLayoutPicker"; private static OkHttpHeaderInterceptor sAddCookiesInterceptor = new OkHttpHeaderInterceptor(); private static OkHttpClient sOkHttpClient = new OkHttpClient.Builder().addInterceptor(sAddCookiesInterceptor).build(); @@ -435,8 +434,7 @@ public void onCreateView(Context initContext, @Nullable Boolean isSiteUsingWpComRestApi, @Nullable Bundle editorTheme, boolean isUnsupportedBlockEditorEnabled, - boolean enableMentionsFlag, - boolean isModalLayoutPickerEnabled) { + boolean enableMentionsFlag) { mIsDarkMode = isDarkMode; mExceptionLogger = exceptionLogger; mBreadcrumbLogger = breadcrumbLogger; @@ -474,7 +472,6 @@ public void onCreateView(Context initContext, capabilities.putBoolean(PROP_NAME_CAPABILITIES_MENTIONS, isSiteUsingWpComRestApi && enableMentionsFlag); } capabilities.putBoolean(PROP_NAME_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, isUnsupportedBlockEditorEnabled); - capabilities.putBoolean(PROP_NAME_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled); initialProps.putBundle(PROP_NAME_CAPABILITIES, capabilities); Serializable colors = editorTheme != null ? editorTheme.getSerializable(PROP_NAME_COLORS) : null; From 3d9a1296cee2ce6cbf26ad42e50f67b07a4e3e9e Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 22 Jul 2020 17:47:56 +0300 Subject: [PATCH 3/5] Updated for consolidated Gutenberg initialProps handling --- .../org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt index 103aed92bae833..23357ac01424c3 100644 --- a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt +++ b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt @@ -10,7 +10,8 @@ data class GutenbergProps( val editorTheme: Bundle?, val translations: Bundle, val isDarkMode: Boolean, - val htmlModeEnabled: Boolean + val htmlModeEnabled: Boolean, + val isModalLayoutPickerEnabled: Boolean ) { fun getInitialProps(bundle: Bundle?) = (bundle ?: Bundle()).apply { @@ -24,6 +25,7 @@ data class GutenbergProps( putBundle(PROP_CAPABILITIES, Bundle().apply { putBoolean(PROP_CAPABILITIES_MENTIONS, enableMentions) putBoolean(PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, enableUnsupportedBlockEditor) + putBoolean(PROP_NAME_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled) }) editorTheme?.also { @@ -52,5 +54,6 @@ data class GutenbergProps( const val PROP_CAPABILITIES = "capabilities" const val PROP_CAPABILITIES_MENTIONS = "mentions" const val PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR = "unsupportedBlockEditor" + const val PROP_NAME_MODAL_LAYOUT_PICKER = "modalLayoutPicker" } } From 38a2bc683709d2d0fd561308c46b2e32ade14179 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 22 Jul 2020 20:03:58 +0300 Subject: [PATCH 4/5] Renamed constant to match existing code naming --- .../java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt index 23357ac01424c3..dff954c4e7b349 100644 --- a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt +++ b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt @@ -25,7 +25,7 @@ data class GutenbergProps( putBundle(PROP_CAPABILITIES, Bundle().apply { putBoolean(PROP_CAPABILITIES_MENTIONS, enableMentions) putBoolean(PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, enableUnsupportedBlockEditor) - putBoolean(PROP_NAME_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled) + putBoolean(PROP_CAPABILITIES_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled) }) editorTheme?.also { @@ -54,6 +54,6 @@ data class GutenbergProps( const val PROP_CAPABILITIES = "capabilities" const val PROP_CAPABILITIES_MENTIONS = "mentions" const val PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR = "unsupportedBlockEditor" - const val PROP_NAME_MODAL_LAYOUT_PICKER = "modalLayoutPicker" + const val PROP_CAPABILITIES_MODAL_LAYOUT_PICKER = "modalLayoutPicker" } } From 2d9a5f405e816c033c01cd88d74cdaf5891bac71 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 24 Jul 2020 12:55:41 +0300 Subject: [PATCH 5/5] Added default parameter value --- .../java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt index dff954c4e7b349..5857ca2dc97365 100644 --- a/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt +++ b/packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt @@ -2,7 +2,7 @@ package org.wordpress.mobile.WPAndroidGlue import android.os.Bundle -data class GutenbergProps( +data class GutenbergProps @JvmOverloads constructor( val enableMentions: Boolean, val enableUnsupportedBlockEditor: Boolean, val localeSlug: String, @@ -11,7 +11,7 @@ data class GutenbergProps( val translations: Bundle, val isDarkMode: Boolean, val htmlModeEnabled: Boolean, - val isModalLayoutPickerEnabled: Boolean + val isModalLayoutPickerEnabled: Boolean = false ) { fun getInitialProps(bundle: Bundle?) = (bundle ?: Bundle()).apply {