Skip to content

Commit 4db8228

Browse files
committed
Clean up the code in setGutenbergEnabledIfNeeded and make easy to follow. @props @hypest
1 parent b59bd91 commit 4db8228

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,17 +1551,16 @@ private void showGutenbergInformativeDialog() {
15511551
}
15521552

15531553
private void setGutenbergEnabledIfNeeded() {
1554-
boolean newSitePopupNeeded = AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl());
1555-
if ((TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost)
1556-
|| newSitePopupNeeded) {
1554+
boolean showPopup = AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl());
1555+
1556+
if (TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) {
15571557
SiteUtils.enableBlockEditor(mDispatcher, mSite);
1558+
AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite,
1559+
BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap());
1560+
showPopup = true;
1561+
}
15581562

1559-
if (!newSitePopupNeeded) {
1560-
// Don't track the activation of the block editor on new sites.
1561-
// The flip to GB happened at site creation time, and the flip is tracked there with proper details
1562-
AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite,
1563-
BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap());
1564-
}
1563+
if (showPopup) {
15651564
showGutenbergInformativeDialog();
15661565
}
15671566
}

0 commit comments

Comments
 (0)