From 0fa3dfe5a5f63eb6dca4c64fff25774c08b5e1ce Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 13:48:59 +0200 Subject: [PATCH 01/12] Aztec and GB support editing while uploading so, always true --- .../java/org/wordpress/android/ui/posts/PostListFragment.kt | 1 - .../java/org/wordpress/android/ui/posts/PostViewHolder.kt | 4 ---- 2 files changed, 5 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt index 1f8cc91d9c19..5c36822d6f73 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt @@ -79,7 +79,6 @@ class PostListFragment : Fragment() { isPhotonCapable = SiteUtils.isPhotonCapable(site), showAllButtons = displayWidth >= 1080, // on larger displays we can always show all buttons imageManager = imageManager, - isAztecEditorEnabled = AppPrefs.isAztecEditorEnabled(), hasCapabilityPublishPosts = site.hasCapabilityPublishPosts ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt index 5b799579f41c..628d27ef9c49 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt @@ -35,7 +35,6 @@ class PostViewHolderConfig( val isPhotonCapable: Boolean, val showAllButtons: Boolean, val imageManager: ImageManager, - val isAztecEditorEnabled: Boolean, val hasCapabilityPublishPosts: Boolean ) @@ -98,9 +97,6 @@ class PostViewHolder(private val view: View, private val config: PostViewHolderC if (uploadStatus.isUploading) { disabledOverlay.visibility = View.VISIBLE progressBar.isIndeterminate = true - } else if (!config.isAztecEditorEnabled && uploadStatus.isUploadingOrQueued) { - // Editing posts with uploading media is only supported in Aztec - disabledOverlay.visibility = View.VISIBLE } else { progressBar.isIndeterminate = false disabledOverlay.visibility = View.GONE From db883564ad0df5f0663534002ab4cb0f1b00e3a4 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 14:13:38 +0200 Subject: [PATCH 02/12] Gutenberg for block posts, conditionally for new posts --- .../org/wordpress/android/ui/posts/PostUtils.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java index 71b517bb1ec8..16859727724d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java @@ -378,10 +378,15 @@ public static void trackGutenbergDialogEvent(AnalyticsTracker.Stat stat, PostMod } public static boolean shouldShowGutenbergEditor(boolean isNewPost, PostModel post) { - return AppPrefs.isGutenbergEditorEnabled() - && (isNewPost - || contentContainsGutenbergBlocks(post.getContent()) - || TextUtils.isEmpty(post.getContent())); + // Default to Gutenberg + + if (isNewPost || TextUtils.isEmpty(post.getContent())) { + // for a new post, use Gutenberg if the switch is set + return AppPrefs.isGutenbergEditorEnabled(); + } else { + // for already existing (and non-empty) posts, open Gutenberg only if the post contains blocks + return contentContainsGutenbergBlocks(post.getContent()); + } } public static String replaceMediaFileWithUrlInGutenbergPost(@NonNull String postContent, From 68c2e9f825cba316a1c76d825146b5f6f781f330 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 14:17:13 +0200 Subject: [PATCH 03/12] No need for warning, no-block posts open in Aztec --- .../android/viewmodel/posts/PostListViewModel.kt | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt index ad3d9a2bf7fe..8e7f23b14add 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt @@ -51,7 +51,6 @@ import org.wordpress.android.ui.posts.PostAdapterItemData import org.wordpress.android.ui.posts.PostAdapterItemUploadStatus import org.wordpress.android.ui.posts.PostListAction import org.wordpress.android.ui.posts.PostListAction.DismissPendingNotification -import org.wordpress.android.ui.posts.PostListAction.ShowGutenbergWarningDialog import org.wordpress.android.ui.posts.PostUploadAction import org.wordpress.android.ui.posts.PostUploadAction.CancelPostAndMediaUpload import org.wordpress.android.ui.posts.PostUploadAction.EditPostResult @@ -360,18 +359,7 @@ class PostListViewModel @Inject constructor( return } - checkGutenbergOrEdit(site, post) - } - - private fun checkGutenbergOrEdit(site: SiteModel, post: PostModel) { - // Show Gutenberg Warning Dialog if post contains GB blocks and it's not disabled - if (!isGutenbergEnabled() && - PostUtils.contentContainsGutenbergBlocks(post.content) && - !AppPrefs.isGutenbergWarningDialogDisabled()) { - _postListAction.postValue(ShowGutenbergWarningDialog(site, post)) - } else { - editPost(site, post) - } + editPost(site, post) } private fun editPost(site: SiteModel, post: PostModel) { From 630f454051c69d91e3653f63705bf2c74ddc37d1 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 14:50:55 +0200 Subject: [PATCH 04/12] Introduce "use Gutenberg" for new posts App Setting And hardcode the `is...Enabled` App settings to only have Aztec and Gutenberg enabled. This way, the code that depends on those flags can still run fine while we're transitioning away from supporting the 2 oldest editors. --- .../wordpress/android/ui/posts/PostUtils.java | 4 +-- .../wordpress/android/ui/prefs/AppPrefs.java | 20 ++++++++++++--- .../android/ui/prefs/AppSettingsFragment.java | 14 +++++------ WordPress/src/main/res/values/key_strings.xml | 2 +- WordPress/src/main/res/values/strings.xml | 3 +-- WordPress/src/main/res/xml/app_settings.xml | 25 +++---------------- 6 files changed, 30 insertions(+), 38 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java index 16859727724d..6b458da57a5a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java @@ -381,8 +381,8 @@ public static boolean shouldShowGutenbergEditor(boolean isNewPost, PostModel pos // Default to Gutenberg if (isNewPost || TextUtils.isEmpty(post.getContent())) { - // for a new post, use Gutenberg if the switch is set - return AppPrefs.isGutenbergEditorEnabled(); + // for a new post, use Gutenberg if the "use for new posts" switch is set + return AppPrefs.isGutenbergDefaultForNewPosts(); } else { // for already existing (and non-empty) posts, open Gutenberg only if the post contains blocks return contentContainsGutenbergBlocks(post.getContent()); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java index dedc3d485d1b..96e8bccd7a63 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java @@ -111,6 +111,7 @@ public enum DeletablePrefKey implements PrefKey { NEWS_CARD_SHOWN_VERSION, AVATAR_VERSION, GUTENBERG_EDITOR_ENABLED, + GUTENBERG_DEAFULT_FOR_NEW_POSTS, IS_QUICK_START_NOTICE_REQUIRED } @@ -451,7 +452,8 @@ public static void setAztecEditorEnabled(boolean isEnabled) { } public static boolean isAztecEditorEnabled() { - return getBoolean(UndeletablePrefKey.AZTEC_EDITOR_ENABLED, false); + // hardcode Aztec enabled to "true". It's Aztec and Gutenberg that we're going to expose to the user now. + return true; } public static boolean isAztecEditorToolbarExpanded() { @@ -476,12 +478,13 @@ public static void setVisualEditorAvailable(boolean visualEditorAvailable) { } public static boolean isVisualEditorAvailable() { + // hardcode the Visual editor availability to "false". Aztec and Gutenberg are the only ones supported now. return getBoolean(UndeletablePrefKey.VISUAL_EDITOR_AVAILABLE, true); } public static boolean isVisualEditorEnabled() { - return isVisualEditorAvailable() && getBoolean(UndeletablePrefKey.VISUAL_EDITOR_ENABLED, - !isAztecEditorEnabled()); + // hardcode the Visual editor enable to "false". Aztec and Gutenberg are the only ones supported now. + return false; } public static boolean isAsyncPromoRequired() { @@ -633,13 +636,22 @@ public static void setVideoOptimize(boolean optimize) { } public static boolean isGutenbergEditorEnabled() { - return getBoolean(DeletablePrefKey.GUTENBERG_EDITOR_ENABLED, false); + // hardcode Gutenberg enabled to "true". It's Aztec and Gutenberg that we're going to expose to the user now. + return true; } public static void enableGutenbergEditor(boolean enabled) { setBoolean(DeletablePrefKey.GUTENBERG_EDITOR_ENABLED, enabled); } + public static boolean isGutenbergDefaultForNewPosts() { + return getBoolean(DeletablePrefKey.GUTENBERG_DEAFULT_FOR_NEW_POSTS, false); + } + + public static void setGutenbergDefaultForNewPosts(boolean defaultForNewPosts) { + setBoolean(DeletablePrefKey.GUTENBERG_DEAFULT_FOR_NEW_POSTS, defaultForNewPosts); + } + public static void setVideoOptimizeWidth(int width) { setInt(DeletablePrefKey.VIDEO_OPTIMIZE_WIDTH, width); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java index 037175085eb1..087400e3a571 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java @@ -65,7 +65,7 @@ public class AppSettingsFragment extends PreferenceFragment private DetailListPreference mImageMaxSizePref; private DetailListPreference mImageQualityPref; private WPSwitchPreference mOptimizedVideo; - private WPSwitchPreference mEnableGutenberg; + private WPSwitchPreference mGutenbergDefaultForNewPosts; private DetailListPreference mVideoWidthPref; private DetailListPreference mVideoEncorderBitratePref; private PreferenceScreen mPrivacySettings; @@ -135,9 +135,9 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { (WPSwitchPreference) WPPrefUtils .getPrefAndSetChangeListener(this, R.string.pref_key_optimize_video, this); - mEnableGutenberg = + mGutenbergDefaultForNewPosts = (WPSwitchPreference) WPPrefUtils - .getPrefAndSetChangeListener(this, R.string.pref_key_enable_gutenberg, this); + .getPrefAndSetChangeListener(this, R.string.pref_key_gutenberg_default_for_new_posts, this); mVideoWidthPref = (DetailListPreference) WPPrefUtils .getPrefAndSetChangeListener(this, R.string.pref_key_site_video_width, this); @@ -168,14 +168,12 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { String.valueOf(AppPrefs.getVideoOptimizeQuality()), getLabelForVideoEncoderBitrateValue(AppPrefs.getVideoOptimizeQuality())); - mEnableGutenberg.setChecked(AppPrefs.isGutenbergEditorEnabled()); + mGutenbergDefaultForNewPosts.setChecked(AppPrefs.isGutenbergDefaultForNewPosts()); mStripImageLocation.setChecked(AppPrefs.isStripImageLocation()); if (!BuildConfig.OFFER_GUTENBERG) { removeExperimentalCategory(); } - - updateEditorSettings(); } private void removeExperimentalCategory() { @@ -307,8 +305,8 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { setDetailListPreferenceValue(mVideoEncorderBitratePref, newValue.toString(), getLabelForVideoEncoderBitrateValue(AppPrefs.getVideoOptimizeQuality())); - } else if (preference == mEnableGutenberg) { - AppPrefs.enableGutenbergEditor((Boolean) newValue); + } else if (preference == mGutenbergDefaultForNewPosts) { + AppPrefs.setGutenbergDefaultForNewPosts((Boolean) newValue); } else if (preference == mStripImageLocation) { AppPrefs.setStripImageLocation((Boolean) newValue); } diff --git a/WordPress/src/main/res/values/key_strings.xml b/WordPress/src/main/res/values/key_strings.xml index 62f351c12ab1..7821c54796aa 100644 --- a/WordPress/src/main/res/values/key_strings.xml +++ b/WordPress/src/main/res/values/key_strings.xml @@ -59,7 +59,7 @@ wp_pref_site_default_image_width wp_pref_site_default_image_quality wp_pref_key_optimize_video - wp_pref_key_enable_gutenberg + wp_pref_key_gutenberg_default_for_new_posts wp_pref_site_default_video_width wp_pref_site_default_encoder_bitrate wp_pref_site_discussion diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 6fffffff1f06..1cbbf5daedc0 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -574,7 +574,7 @@ Unable to load timezones Accelerated Mobile Pages (AMP) Your WordPress.com site supports the use of Accelerated Mobile Pages, a Google-led initiative that dramatically speeds up loading times on mobile devices - Enable Gutenberg + Use block editor for new posts Media @@ -630,7 +630,6 @@ @string/none Enable to resize and compress pictures Enable to resize and compress videos - This is still an experimental version of Gutenberg Require manual approval for everyone\'s comments. Automatically approve if the user has a previously approved comment diff --git a/WordPress/src/main/res/xml/app_settings.xml b/WordPress/src/main/res/xml/app_settings.xml index c6d386b3a2fc..cda70329bcf4 100644 --- a/WordPress/src/main/res/xml/app_settings.xml +++ b/WordPress/src/main/res/xml/app_settings.xml @@ -6,20 +6,6 @@ xmlns:tools="http://schemas.android.com/tools" android:key="@string/pref_key_app_settings_root"> - - - - - - - + android:title="@string/site_settings_gutenberg_default_for_new_posts"/> Date: Mon, 11 Feb 2019 15:13:08 +0200 Subject: [PATCH 05/12] Remove unused import --- .../main/java/org/wordpress/android/ui/posts/PostListFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt index 5c36822d6f73..c4128141ecb4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt @@ -26,7 +26,6 @@ import org.wordpress.android.ui.WPWebViewActivity import org.wordpress.android.ui.pages.SnackbarMessageHolder import org.wordpress.android.ui.posts.PostsListActivity.EXTRA_TARGET_POST_LOCAL_ID import org.wordpress.android.ui.posts.adapters.PostListAdapter -import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.ui.uploads.UploadService import org.wordpress.android.ui.uploads.UploadUtils import org.wordpress.android.ui.utils.UiHelpers From 5de5f6cf8a5be24662ac0c2a310081b7a1ea803c Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 15:19:41 +0200 Subject: [PATCH 06/12] Revert "Aztec and GB support editing while uploading so, always true" This reverts commit 0fa3dfe5a5f63eb6dca4c64fff25774c08b5e1ce. Reverting to let the code be untouched for now. Besides, hardcoded the AppPrefs.isAztecEditorEnabled() method to true anyway. --- .../java/org/wordpress/android/ui/posts/PostListFragment.kt | 1 + .../java/org/wordpress/android/ui/posts/PostViewHolder.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt index c4128141ecb4..a6069a111af3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt @@ -78,6 +78,7 @@ class PostListFragment : Fragment() { isPhotonCapable = SiteUtils.isPhotonCapable(site), showAllButtons = displayWidth >= 1080, // on larger displays we can always show all buttons imageManager = imageManager, + isAztecEditorEnabled = AppPrefs.isAztecEditorEnabled(), hasCapabilityPublishPosts = site.hasCapabilityPublishPosts ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt index 628d27ef9c49..5b799579f41c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolder.kt @@ -35,6 +35,7 @@ class PostViewHolderConfig( val isPhotonCapable: Boolean, val showAllButtons: Boolean, val imageManager: ImageManager, + val isAztecEditorEnabled: Boolean, val hasCapabilityPublishPosts: Boolean ) @@ -97,6 +98,9 @@ class PostViewHolder(private val view: View, private val config: PostViewHolderC if (uploadStatus.isUploading) { disabledOverlay.visibility = View.VISIBLE progressBar.isIndeterminate = true + } else if (!config.isAztecEditorEnabled && uploadStatus.isUploadingOrQueued) { + // Editing posts with uploading media is only supported in Aztec + disabledOverlay.visibility = View.VISIBLE } else { progressBar.isIndeterminate = false disabledOverlay.visibility = View.GONE From b5007efea39c332ce537a2c4cb9177713ae68dbb Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 15:23:43 +0200 Subject: [PATCH 07/12] Add missing import --- .../main/java/org/wordpress/android/ui/posts/PostListFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt index a6069a111af3..1f8cc91d9c19 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt @@ -26,6 +26,7 @@ import org.wordpress.android.ui.WPWebViewActivity import org.wordpress.android.ui.pages.SnackbarMessageHolder import org.wordpress.android.ui.posts.PostsListActivity.EXTRA_TARGET_POST_LOCAL_ID import org.wordpress.android.ui.posts.adapters.PostListAdapter +import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.ui.uploads.UploadService import org.wordpress.android.ui.uploads.UploadUtils import org.wordpress.android.ui.utils.UiHelpers From 4efe7feb55053b9d5b4236c186e4bd118f0cee1d Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 15:35:39 +0200 Subject: [PATCH 08/12] Removed unused resources reported by linter --- WordPress/src/main/res/values/key_strings.xml | 7 ------- WordPress/src/main/res/values/strings.xml | 12 ------------ 2 files changed, 19 deletions(-) diff --git a/WordPress/src/main/res/values/key_strings.xml b/WordPress/src/main/res/values/key_strings.xml index 7821c54796aa..e0d446a8a163 100644 --- a/WordPress/src/main/res/values/key_strings.xml +++ b/WordPress/src/main/res/values/key_strings.xml @@ -206,13 +206,6 @@ Custom - - - 0 - 1 - 2 - - en_US diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 1cbbf5daedc0..f62bdafdd773 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -770,20 +770,8 @@ We use other tracking tools, including some from third parties. Read about these and how to control them. Read privacy policy Editor - Set editor type - *EXPERIMENTAL* Remove location from media - Beta - Legacy - Visual - - - @string/preference_editor_legacy - @string/preference_editor_visual - @string/preference_editor_beta - - Stats Stats for %s From bf66ad648db68851fa34bff5cb3a488b92a7067c Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 16:31:59 +0200 Subject: [PATCH 09/12] Make Gutenberg the default for new posts --- .../src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java index 96e8bccd7a63..f7602d3fd5e7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java @@ -645,7 +645,7 @@ public static void enableGutenbergEditor(boolean enabled) { } public static boolean isGutenbergDefaultForNewPosts() { - return getBoolean(DeletablePrefKey.GUTENBERG_DEAFULT_FOR_NEW_POSTS, false); + return getBoolean(DeletablePrefKey.GUTENBERG_DEAFULT_FOR_NEW_POSTS, true); } public static void setGutenbergDefaultForNewPosts(boolean defaultForNewPosts) { From 15372fbb92bdfc95b206611d042d91cdb687d01a Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 16:43:06 +0200 Subject: [PATCH 10/12] Offer Gutenberg in all build flavors --- WordPress/build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 9526c61d5293..fd7824c39313 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -57,6 +57,7 @@ android { buildConfigField "boolean", "REVISIONS_ENABLED", "false" buildConfigField "boolean", "NEW_SITE_CREATION_ENABLED", "false" + buildConfigField "boolean", "OFFER_GUTENBERG", "true" } flavorDimensions "buildType" @@ -64,20 +65,17 @@ android { productFlavors { vanilla { // used for release and beta dimension "buildType" - buildConfigField "boolean", "OFFER_GUTENBERG", "false" } zalpha { // alpha version - enable experimental features applicationId "org.wordpress.android" dimension "buildType" buildConfigField "boolean", "VIDEO_OPTIMIZATION_AVAILABLE", "true" - buildConfigField "boolean", "OFFER_GUTENBERG", "true" } wasabi { // "hot" version, can be installed along release, alpha or beta versions applicationId "org.wordpress.android.beta" dimension "buildType" - buildConfigField "boolean", "OFFER_GUTENBERG", "true" } } From 2b86c0fdbb49602a2a954055876e48df6cfe8c18 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 17:37:59 +0200 Subject: [PATCH 11/12] Append a Support tag if Gutenberg is default for new posts --- .../android/support/ZendeskHelper.kt | 1 + .../android/ui/accounts/HelpActivity.kt | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt b/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt index 9025343e02c8..ac316f2a9e23 100644 --- a/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt @@ -498,4 +498,5 @@ private object TicketFieldIds { object ZendeskExtraTags { const val connectingJetpack = "connecting_jetpack" + const val gutenbergIsDefault = "mobile_gutenberg_is_default" } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt index f6ffafd4e15a..5c24bb90c4fb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt @@ -14,12 +14,14 @@ import org.wordpress.android.fluxc.model.SiteModel import org.wordpress.android.fluxc.store.AccountStore import org.wordpress.android.fluxc.store.SiteStore import org.wordpress.android.support.SupportHelper +import org.wordpress.android.support.ZendeskExtraTags import org.wordpress.android.support.ZendeskHelper import org.wordpress.android.ui.ActivityId import org.wordpress.android.ui.AppLogViewerActivity import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.util.LocaleManager import java.util.ArrayList +import java.util.Collections import javax.inject.Inject class HelpActivity : AppCompatActivity() { @@ -177,9 +179,27 @@ class HelpActivity : AppCompatActivity() { if (selectedSite != null) { intent.putExtra(WordPress.SITE, selectedSite) } - if (extraSupportTags != null && !extraSupportTags.isEmpty()) { - intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, extraSupportTags as ArrayList?) + + val tagsList: ArrayList? = if (AppPrefs.isGutenbergDefaultForNewPosts()) { + // construct a mutable list to add the Gutenberg related extra tag + val list = ArrayList() + + // add the provided list of tags if any + extraSupportTags?.let { + list.addAll(extraSupportTags) + } + + // Append the "mobile_gutenberg_is_default" tag if gutenberg is set to default for new posts + list.add(ZendeskExtraTags.gutenbergIsDefault) + list // "return" the list + } else { + extraSupportTags as ArrayList? } + + if (tagsList != null && !tagsList.isEmpty()) { + intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, tagsList) + } + return intent } } From 8ed5012798b359b6fccdc423cca4cf297ff68baf Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 18:05:40 +0200 Subject: [PATCH 12/12] Remove unused import --- .../main/java/org/wordpress/android/ui/accounts/HelpActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt index 5c24bb90c4fb..fe6bc95328d9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt @@ -21,7 +21,6 @@ import org.wordpress.android.ui.AppLogViewerActivity import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.util.LocaleManager import java.util.ArrayList -import java.util.Collections import javax.inject.Inject class HelpActivity : AppCompatActivity() {