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

[Modal Layout Picker] Create Modal window for Modal Layout Picker #12462

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ android {
buildConfigField "long", "REMOTE_CONFIG_FETCH_INTERVAL", "10"
buildConfigField "boolean", "FEATURE_ANNOUNCEMENT_AVAILABLE", "false"
buildConfigField "boolean", "GUTENBERG_MENTIONS", "true"
buildConfigField "boolean", "MODAL_LAYOUT_PICKER", "false"
buildConfigField "boolean", "UNIFIED_LOGIN_AVAILABLE", "true"
}

Expand All @@ -97,6 +98,7 @@ android {
buildConfigField "boolean", "READER_IMPROVEMENTS_PHASE_2", "false"
buildConfigField "long", "REMOTE_CONFIG_FETCH_INTERVAL", "3600"
buildConfigField "boolean", "GUTENBERG_MENTIONS", "false"
buildConfigField "boolean", "MODAL_LAYOUT_PICKER", "true"
}

zalpha { // alpha version - enable experimental features
Expand All @@ -114,6 +116,7 @@ android {
jalapeno { // Pre-Alpha version, used for PR builds, can be installed along release, alpha, beta, dev versions
applicationId "org.wordpress.android.prealpha"
dimension "buildType"
buildConfigField "boolean", "MODAL_LAYOUT_PICKER", "true"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
import org.wordpress.android.util.WPActivityUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.analytics.service.InstallationReferrerServiceStarter;
import org.wordpress.android.util.config.ModalLayoutPickerFeatureConfig;
import org.wordpress.android.viewmodel.main.WPMainActivityViewModel;
import org.wordpress.android.widgets.AppRatingDialog;
import org.wordpress.android.widgets.WPDialogSnackbar;
Expand Down Expand Up @@ -199,6 +200,7 @@ public class WPMainActivity extends LocaleAwareActivity implements
@Inject UploadUtilsWrapper mUploadUtilsWrapper;
@Inject ViewModelProvider.Factory mViewModelFactory;
@Inject PrivateAtomicCookie mPrivateAtomicCookie;
@Inject ModalLayoutPickerFeatureConfig mModalLayoutPickerFeatureConfig;

/*
* fragments implement this if their contents can be scrolled, called when user
Expand Down Expand Up @@ -812,6 +814,14 @@ private void handleNewPageAction(PagePostCreationSourcesDetail source) {
return;
}

if (mModalLayoutPickerFeatureConfig.isEnabled()) {
addNewPage(source); // TODO: Open MLP
} else {
addNewPage(source);
}
}

private void addNewPage(PagePostCreationSourcesDetail source) {
SiteModel site = getSelectedSite();
if (site != null) {
// TODO: evaluate to include the QuickStart logic like in the handleNewPostAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils.BlockEditorEnabledSource;
import org.wordpress.android.util.config.GutenbergMentionsFeatureConfig;
import org.wordpress.android.util.config.ModalLayoutPickerFeatureConfig;
import org.wordpress.android.util.config.TenorFeatureConfig;
import org.wordpress.android.util.helpers.MediaFile;
import org.wordpress.android.util.helpers.MediaGallery;
Expand Down Expand Up @@ -369,6 +370,7 @@ enum RestartEditorOptions {
@Inject PublishPostImmediatelyUseCase mPublishPostImmediatelyUseCase;
@Inject TenorFeatureConfig mTenorFeatureConfig;
@Inject GutenbergMentionsFeatureConfig mGutenbergMentionsFeatureConfig;
@Inject ModalLayoutPickerFeatureConfig mModalLayoutPickerFeatureConfig;

private StorePostViewModel mViewModel;

Expand Down Expand Up @@ -2043,7 +2045,8 @@ public Fragment getItem(int position) {
WordPress.getUserAgent(),
mTenorFeatureConfig.isEnabled(),
isUnsupportedBlockEditorEnabled,
mGutenbergMentionsFeatureConfig.isEnabled()
mGutenbergMentionsFeatureConfig.isEnabled(),
mModalLayoutPickerFeatureConfig.isEnabled()
);
} else {
// If gutenberg editor is not selected, default to Aztec.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.wordpress.android.util.config

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

class ModalLayoutPickerFeatureConfig
@Inject constructor(appConfig: AppConfig) : FeatureConfig(appConfig, BuildConfig.MODAL_LAYOUT_PICKER)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class GutenbergContainerFragment extends Fragment {
private static final String ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED =
"param_site_is_unsupported_block_editor_enabled";
private static final String ARG_ENABLE_MENTIONS_FLAG = "param_enable_mentions_flag";
private static final String ARG_ENABLE_MODAL_LAYOUT_PICKER = "param_enable_modal_layout_picker";

private boolean mHtmlModeEnabled;
private boolean mHasReceivedAnyContent;
Expand All @@ -51,7 +52,8 @@ public static GutenbergContainerFragment newInstance(String postType,
boolean isSiteUsingWpComRestApi,
Bundle editorTheme,
boolean isUnsupportedBlockEditorEnabled,
boolean enableMentionsFlag) {
boolean enableMentionsFlag,
boolean isModalLayoutPickerEnabled) {
GutenbergContainerFragment fragment = new GutenbergContainerFragment();
Bundle args = new Bundle();
args.putString(ARG_POST_TYPE, postType);
Expand All @@ -63,6 +65,7 @@ public static GutenbergContainerFragment newInstance(String postType,
args.putBundle(ARG_EDITOR_THEME, editorTheme);
args.putBoolean(ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED, isUnsupportedBlockEditorEnabled);
args.putBoolean(ARG_ENABLE_MENTIONS_FLAG, enableMentionsFlag);
args.putBoolean(ARG_ENABLE_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled);
fragment.setArguments(args);
return fragment;
}
Expand Down Expand Up @@ -116,6 +119,7 @@ public void onCreate(Bundle savedInstanceState) {
boolean isUnsupportedBlockEditorEnabled =
getArguments().getBoolean(ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED);
boolean enableMentionsFlag = getArguments().getBoolean(ARG_ENABLE_MENTIONS_FLAG);
boolean isModalLayoutPickerEnabled = getArguments().getBoolean(ARG_ENABLE_MODAL_LAYOUT_PICKER);

Consumer<Exception> exceptionLogger = null;
Consumer<String> breadcrumbLogger = null;
Expand Down Expand Up @@ -144,7 +148,8 @@ public void onCreate(Bundle savedInstanceState) {
isSiteUsingWpComRestApi,
editorTheme,
isUnsupportedBlockEditorEnabled,
enableMentionsFlag);
enableMentionsFlag,
isModalLayoutPickerEnabled);

// clear the content initialization flag since a new ReactRootView has been created;
mHasReceivedAnyContent = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements
private static final String ARG_ENABLE_MENTIONS_FLAG = "param_enable_mentions_flag";
private static final String ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED =
"param_site_is_unsupported_block_editor_enabled";
private static final String ARG_ENABLE_MODAL_LAYOUT_PICKER = "param_enable_modal_layout_picker";

private static final int CAPTURE_PHOTO_PERMISSION_REQUEST_CODE = 101;
private static final int CAPTURE_VIDEO_PERMISSION_REQUEST_CODE = 102;
Expand Down Expand Up @@ -138,7 +139,8 @@ public static GutenbergEditorFragment newInstance(String title,
String userAgent,
boolean tenorEnabled,
boolean isUnsupportedBlockEditorEnabled,
boolean enableMentionsFlag) {
boolean enableMentionsFlag,
boolean isModalLayoutPickerEnabled) {
GutenbergEditorFragment fragment = new GutenbergEditorFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM_TITLE, title);
Expand All @@ -158,6 +160,7 @@ public static GutenbergEditorFragment newInstance(String title,
args.putBoolean(ARG_TENOR_ENABLED, tenorEnabled);
args.putBoolean(ARG_ENABLE_MENTIONS_FLAG, enableMentionsFlag);
args.putBoolean(ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED, isUnsupportedBlockEditorEnabled);
args.putBoolean(ARG_ENABLE_MODAL_LAYOUT_PICKER, isModalLayoutPickerEnabled);
fragment.setArguments(args);
return fragment;
}
Expand Down Expand Up @@ -261,6 +264,7 @@ public void onCreate(Bundle savedInstanceState) {
Bundle editorTheme = getArguments().getBundle(ARG_EDITOR_THEME);
boolean siteJetpackIsConnected = getArguments().getBoolean(ARG_SITE_IS_UNSUPPORTED_BLOCK_EDITOR_ENABLED);
boolean enableMentionsFlag = getArguments().getBoolean(ARG_ENABLE_MENTIONS_FLAG);
boolean isModalLayoutPickerEnabled = getArguments().getBoolean(ARG_ENABLE_MODAL_LAYOUT_PICKER);

FragmentManager fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Expand All @@ -274,7 +278,8 @@ public void onCreate(Bundle savedInstanceState) {
isSiteUsingWpComRestApi,
editorTheme,
siteJetpackIsConnected,
enableMentionsFlag);
enableMentionsFlag,
isModalLayoutPickerEnabled);
gutenbergContainerFragment.setRetainInstance(true);
fragmentTransaction.add(gutenbergContainerFragment, GutenbergContainerFragment.TAG);
fragmentTransaction.commitNow();
Expand Down
2 changes: 1 addition & 1 deletion libs/gutenberg-mobile
Submodule gutenberg-mobile updated 26 files
+1 −1 RNTAztecView.podspec
+707 −654 bundle/android/App.js
+1 −1 bundle/android/App.js.map
+23 −0 bundle/android/raw/gutenberg_packages_blocklibrary_src_sociallink_block.json
+13 −0 bundle/android/raw/gutenberg_packages_blocklibrary_src_sociallinks_block.json
+755 −701 bundle/ios/App.js
+1 −1 bundle/ios/App.js.map
+23 −0 bundle/ios/assets/gutenberg/packages/block-library/src/social-link/block.json
+13 −0 bundle/ios/assets/gutenberg/packages/block-library/src/social-links/block.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/de.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/en-za.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/es.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/hr.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/ja.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/nl.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/ro.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/ru.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/sk.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/sq.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/sv.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/tr.json
+1 −1 bundle/ios/assets/gutenberg/packages/react-native-editor/i18n-cache/data/zh-cn.json
+5 −5 docs/Releasing.md
+1 −1 gutenberg
+2 −2 package-lock.json
+2 −1 package.json