From f11f8f0d6732c3a454754aabadae461a1c93e13b Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Wed, 26 Feb 2020 10:10:21 +0100 Subject: [PATCH 1/4] Don't show the Block editor dialog after creating a new site --- .../java/org/wordpress/android/ui/main/WPMainActivity.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java index 2b956ed66412..10accde43dee 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java @@ -900,11 +900,6 @@ public void onClick(View v) { if (data != null) { int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); SiteUtils.enableBlockEditorOnSiteCreation(mDispatcher, mSiteStore, newSiteLocalID); - // Mark the site to show the GB popup at first editor run - SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID); - if (newSiteModel != null) { - AppPrefs.setShowGutenbergInfoPopupForTheNewPosts(newSiteModel.getUrl(), true); - } } setSite(data); From 99065d89b21393cb9e3e790c15f592dc100d4ac6 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Wed, 26 Feb 2020 10:11:11 +0100 Subject: [PATCH 2/4] Default to block editor when mobile editor settings is empty --- .../src/main/java/org/wordpress/android/util/SiteUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java index 14fd6a0dfef3..1dbbe964bac0 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java @@ -189,10 +189,11 @@ public static void disableBlockEditor(Dispatcher dispatcher, SiteModel siteModel public static boolean isBlockEditorDefaultForNewPost(SiteModel site) { if (site == null) { - return false; + return true; } if (TextUtils.isEmpty(site.getMobileEditor())) { - return AppPrefs.isGutenbergDefaultForNewPosts(); + // Default to block editor when mobile editor setting is empty + return true; } else { return site.getMobileEditor().equals(SiteUtils.GB_EDITOR_NAME); } From 4ff75c3773edcc8f442ca866ba44d72ae668e14c Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 28 Feb 2020 12:12:36 +0100 Subject: [PATCH 3/4] Don't show the block editor dialog for new users --- .../org/wordpress/android/ui/main/SitePickerActivity.java | 5 ----- .../org/wordpress/android/ui/posts/EditPostActivity.java | 1 - 2 files changed, 6 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java index b93db5247da4..324132345d4f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java @@ -220,11 +220,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data != null) { int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); SiteUtils.enableBlockEditorOnSiteCreation(mDispatcher, mSiteStore, newSiteLocalID); - // Mark the site to show the GB popup at first editor run - SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID); - if (newSiteModel != null) { - AppPrefs.setShowGutenbergInfoPopupForTheNewPosts(newSiteModel.getUrl(), true); - } } break; } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index eb64c19791ed..a59d9881ecce 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -1405,7 +1405,6 @@ private void setGutenbergEnabledIfNeeded() { SiteUtils.enableBlockEditor(mDispatcher, mSite); AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite, BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap()); - showPopup = true; } if (showPopup) { From 4f01138333572e58267de19c133d5bc4430f78c3 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 28 Feb 2020 12:28:31 +0100 Subject: [PATCH 4/4] Update the local editor setting when enabling/disabling the block editor --- .../java/org/wordpress/android/util/SiteUtils.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java index 1dbbe964bac0..59835dca6e1c 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java @@ -178,13 +178,21 @@ public static boolean enableBlockEditorOnSiteCreation(Dispatcher dispatcher, Sit } public static void enableBlockEditor(Dispatcher dispatcher, SiteModel siteModel) { - dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( - new DesignateMobileEditorPayload(siteModel, SiteUtils.GB_EDITOR_NAME))); + // Send the setting to the server + dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( + new DesignateMobileEditorPayload(siteModel, GB_EDITOR_NAME))); + // Update the local site + siteModel.setMobileEditor(GB_EDITOR_NAME); + dispatcher.dispatch(SiteActionBuilder.newUpdateSiteAction(siteModel)); } public static void disableBlockEditor(Dispatcher dispatcher, SiteModel siteModel) { + // Send the setting to the server dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( - new DesignateMobileEditorPayload(siteModel, SiteUtils.AZTEC_EDITOR_NAME))); + new DesignateMobileEditorPayload(siteModel, AZTEC_EDITOR_NAME))); + // Update the local site + siteModel.setMobileEditor(AZTEC_EDITOR_NAME); + dispatcher.dispatch(SiteActionBuilder.newUpdateSiteAction(siteModel)); } public static boolean isBlockEditorDefaultForNewPost(SiteModel site) {