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

Remove the Gutenberg dialog on new sites #11385

Merged
merged 5 commits into from
Mar 2, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
19 changes: 14 additions & 5 deletions WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,30 @@ 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) {
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);
}
Expand Down