diff --git a/WordPress/src/main/java/org/wordpress/android/ui/jetpackoverlay/JetpackFeatureRemovalPhaseHelper.kt b/WordPress/src/main/java/org/wordpress/android/ui/jetpackoverlay/JetpackFeatureRemovalPhaseHelper.kt index 4bc5f63bf1cf..bc23e6298646 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/jetpackoverlay/JetpackFeatureRemovalPhaseHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/jetpackoverlay/JetpackFeatureRemovalPhaseHelper.kt @@ -92,6 +92,22 @@ class JetpackFeatureRemovalPhaseHelper @Inject constructor( } } + fun shouldShowJetpackPoweredEditorFeatures(): Boolean { + val currentPhase = getCurrentPhase() ?: return true + return when (currentPhase) { + is PhaseStaticPosters, PhaseFour, PhaseNewUsers, PhaseSelfHostedUsers -> false + else -> true + } + } + + fun shouldShowTemplateSelectionInPages(): Boolean { + val currentPhase = getCurrentPhase() ?: return true + return when (currentPhase) { + is PhaseStaticPosters, PhaseFour, PhaseNewUsers, PhaseSelfHostedUsers -> false + else -> true + } + } + @Suppress("Unused") fun shouldShowStaticPage(): Boolean { val currentPhase = getCurrentPhase() ?: return false @@ -108,6 +124,22 @@ class JetpackFeatureRemovalPhaseHelper @Inject constructor( is PhaseOne, PhaseTwo, PhaseThree, PhaseStaticPosters -> true } } + + fun shouldShowQuickStart(): Boolean { + val currentPhase = getCurrentPhase() ?: return true + return when (currentPhase) { + is PhaseStaticPosters, PhaseFour, PhaseNewUsers, PhaseSelfHostedUsers -> false + else -> true + } + } + + fun shouldShowHelpAndSupportOnEditor(): Boolean { + val currentPhase = getCurrentPhase() ?: return true + return when (currentPhase) { + is PhaseStaticPosters, PhaseFour, PhaseNewUsers, PhaseSelfHostedUsers -> false + else -> true + } + } } // Global overlay frequency is the frequency at which the overlay is shown across the features // no matter which feature was accessed last time 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 5981ac46dceb..0faac663a45a 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 @@ -665,7 +665,7 @@ private void initViewModel() { break; case CREATE_NEW_PAGE: if (mMLPViewModel.canShowModalLayoutPicker() - && !mJetpackFeatureRemovalPhaseHelper.shouldRemoveJetpackFeatures()) { + && mJetpackFeatureRemovalPhaseHelper.shouldShowTemplateSelectionInPages()) { mMLPViewModel.createPageFlowTriggered(); } else { handleNewPageAction("", "", null, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt index 80eec65c086e..080a36ba8515 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt @@ -1322,6 +1322,7 @@ class MySiteViewModel @Inject constructor( isSiteTitleTaskCompleted: Boolean, isNewSite: Boolean ) { + if (!jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()) return quickStartRepository.checkAndSetQuickStartType(isNewSite = isNewSite) if (quickStartDynamicCardsFeatureConfig.isEnabled()) { startQuickStart(siteLocalId, isSiteTitleTaskCompleted) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/pages/PagesFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/pages/PagesFragment.kt index 017f7b4b732e..7ea6bf5a11f2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/pages/PagesFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/pages/PagesFragment.kt @@ -377,7 +377,7 @@ class PagesFragment : Fragment(R.layout.pages_fragment), ScrollableViewInitializ viewModel.createNewPage.observe(viewLifecycleOwner, { if (mlpViewModel.canShowModalLayoutPicker() - && !jetpackFeatureRemovalPhaseHelper.shouldRemoveJetpackFeatures()) { + && jetpackFeatureRemovalPhaseHelper.shouldShowTemplateSelectionInPages()) { mlpViewModel.createPageFlowTriggered() } else { createNewPage() 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 ef2fc12e20db..41b9f8764d48 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 @@ -1335,8 +1335,8 @@ public boolean onPrepareOptionsMenu(Menu menu) { if (helpMenuItem != null) { // Support section will be disabled in WordPress app when Jetpack-powered features are removed. // Therefore, we have to update the Help menu item accordingly. - boolean jetpackFeaturesRemoved = mJetpackFeatureRemovalPhaseHelper.shouldRemoveJetpackFeatures(); - int helpMenuTitle = jetpackFeaturesRemoved ? R.string.help : R.string.help_and_support; + boolean showHelpAndSupport = mJetpackFeatureRemovalPhaseHelper.shouldShowHelpAndSupportOnEditor(); + int helpMenuTitle = showHelpAndSupport ? R.string.help_and_support : R.string.help; helpMenuItem.setTitle(helpMenuTitle); if (mEditorFragment instanceof GutenbergEditorFragment @@ -2272,7 +2272,7 @@ public Fragment getItem(int position) { gutenbergWebViewAuthorizationData, gutenbergPropsBuilder, RequestCodes.EDIT_STORY, - !mJetpackFeatureRemovalPhaseHelper.shouldRemoveJetpackFeatures() + mJetpackFeatureRemovalPhaseHelper.shouldShowJetpackPoweredEditorFeatures() ); } else { // If gutenberg editor is not selected, default to Aztec. @@ -2360,7 +2360,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { String hostAppNamespace = mBuildConfigWrapper.isJetpackApp() ? "Jetpack" : "WordPress"; // Disable Jetpack-powered editor features in WordPress app based on Jetpack Features Removal Phase helper - boolean jetpackFeaturesRemoved = mJetpackFeatureRemovalPhaseHelper.shouldRemoveJetpackFeatures(); + boolean jetpackFeaturesRemoved = !mJetpackFeatureRemovalPhaseHelper.shouldShowJetpackPoweredEditorFeatures(); if (jetpackFeaturesRemoved) { return new GutenbergPropsBuilder( false, diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/MySiteViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/MySiteViewModelTest.kt index 0e152893bacb..ec64bde437d5 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/MySiteViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/MySiteViewModelTest.kt @@ -1406,6 +1406,7 @@ class MySiteViewModelTest : BaseUnitTest() { @Test fun `given dynamic cards enabled + new site, when check & start QS triggered, then new site QS starts`() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(true) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, false, isNewSite = true) @@ -1422,6 +1423,7 @@ class MySiteViewModelTest : BaseUnitTest() { fun `given dynamic cards enabled + existing site, when check & start QS triggered, then existing site QS starts`() { whenever(quickStartRepository.quickStartType).thenReturn(ExistingSiteQuickStartType) whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(true) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, false, isNewSite = false) @@ -1438,6 +1440,7 @@ class MySiteViewModelTest : BaseUnitTest() { fun `given no selected site, when check and start QS is triggered, then QSP is not shown`() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(false) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(null) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, isSiteTitleTaskCompleted = false, isNewSite = false) @@ -1449,6 +1452,7 @@ class MySiteViewModelTest : BaseUnitTest() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(false) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(site) whenever(quickStartUtilsWrapper.isQuickStartAvailableForTheSite(site)).thenReturn(false) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, isSiteTitleTaskCompleted = false, isNewSite = true) @@ -1460,6 +1464,7 @@ class MySiteViewModelTest : BaseUnitTest() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(false) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(site) whenever(quickStartUtilsWrapper.isQuickStartAvailableForTheSite(site)).thenReturn(false) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, isSiteTitleTaskCompleted = false, isNewSite = false) @@ -1471,6 +1476,7 @@ class MySiteViewModelTest : BaseUnitTest() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(false) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(site) whenever(quickStartUtilsWrapper.isQuickStartAvailableForTheSite(site)).thenReturn(true) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, false, isNewSite = true) @@ -1489,6 +1495,7 @@ class MySiteViewModelTest : BaseUnitTest() { whenever(quickStartDynamicCardsFeatureConfig.isEnabled()).thenReturn(false) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(site) whenever(quickStartUtilsWrapper.isQuickStartAvailableForTheSite(site)).thenReturn(true) + whenever(jetpackFeatureRemovalPhaseHelper.shouldShowQuickStart()).thenReturn(true) viewModel.checkAndStartQuickStart(siteLocalId, false, isNewSite = false)