From 4f01138333572e58267de19c133d5bc4430f78c3 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 28 Feb 2020 12:28:31 +0100 Subject: [PATCH] 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) {