Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Revert "Closes #26750: add Wallpapers Onboarding dialog"
Browse files Browse the repository at this point in the history
This reverts commit 05b95b6.
  • Loading branch information
csadilek authored Sep 11, 2022
1 parent 0b9ce30 commit 64e8dcc
Show file tree
Hide file tree
Showing 24 changed files with 20 additions and 359 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class FeatureSettingsHelper {
private var isRecentlyVisitedFeatureEnabled: Boolean = settings.historyMetadataUIFeature
private var isUserKnowsAboutPwasTrue: Boolean = settings.userKnowsAboutPwas
private var isTCPCFREnabled: Boolean = settings.shouldShowTotalCookieProtectionCFR
private var isWallpaperOnboardingEnabled: Boolean = settings.showWallpaperOnboarding

fun setPocketEnabled(enabled: Boolean) {
settings.showPocketRecommendationsFeature = enabled
Expand All @@ -29,10 +28,6 @@ class FeatureSettingsHelper {
settings.shouldShowJumpBackInCFR = enabled
}

fun setShowWallpaperOnboarding(enabled: Boolean) {
settings.showWallpaperOnboarding = enabled
}

fun setRecentTabsFeatureEnabled(enabled: Boolean) {
settings.showRecentTabsFeature = enabled
}
Expand Down Expand Up @@ -70,6 +65,5 @@ class FeatureSettingsHelper {
settings.historyMetadataUIFeature = isRecentlyVisitedFeatureEnabled
settings.userKnowsAboutPwas = isUserKnowsAboutPwasTrue
settings.shouldShowTotalCookieProtectionCFR = isTCPCFREnabled
settings.showWallpaperOnboarding = isWallpaperOnboardingEnabled
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class CrashReportingTest {
fun setUp() {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setPocketEnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ class HomeScreenTest {
@Test
fun dismissOnboardingUsingHelpTest() {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

homeScreen {
verifyWelcomeHeader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class NoNetworkAccessStartupTests {
@Before
fun setUp() {
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class SearchTest {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setPocketEnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class SettingsBasicsTest {

featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SettingsHomepageTest {
}
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class SettingsPrivacyTest {

featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
featureSettingsHelper.disablePwaCFR(true)

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class SettingsSearchTest {
start()
}
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
1 change: 0 additions & 1 deletion app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class SmokeTest {
// disabling the new homepage pop-up that interferes with the tests.
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class StrictEnhancedTrackingProtectionTest {
featureSettingsHelper.setStrictETPEnabled()
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class TabbedBrowsingTest {
// disabling the new homepage pop-up that interferes with the tests.
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class TopSitesTest {

featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@ import org.mozilla.fenix.gleanplumb.MessageController
import org.mozilla.fenix.home.HomeFragment
import org.mozilla.fenix.home.HomeFragmentDirections
import org.mozilla.fenix.home.Mode
import org.mozilla.fenix.onboarding.WallpaperOnboardingDialogFragment
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.settings.SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS
import org.mozilla.fenix.utils.Settings
import org.mozilla.fenix.wallpapers.Wallpaper
import org.mozilla.fenix.wallpapers.WallpaperState
import mozilla.components.feature.tab.collections.Tab as ComponentTab

/**
Expand Down Expand Up @@ -200,11 +197,6 @@ interface SessionControlController {
*/
fun handleCustomizeHomeTapped()

/**
* @see [OnboardingInteractor.showWallpapersOnboardingDialog]
*/
fun handleShowWallpapersOnboardingDialog(state: WallpaperState): Boolean

/**
* @see [SessionControlInteractor.reportSessionMetrics]
*/
Expand Down Expand Up @@ -509,19 +501,6 @@ class DefaultSessionControlController(
HomeScreen.customizeHomeClicked.record(NoExtras())
}

override fun handleShowWallpapersOnboardingDialog(state: WallpaperState): Boolean {
if (state.availableWallpapers.all { it.thumbnailFileState == Wallpaper.ImageFileState.Downloaded } &&
state.availableWallpapers.size >= WallpaperOnboardingDialogFragment.THUMBNAILS_COUNT
) {
navController.nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalWallpaperOnboardingDialog()
)
return true
}
return false
}

override fun handleReadPrivacyNoticeClicked() {
activity.openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem.RecentHistoryGrou
import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem.RecentHistoryHighlight
import org.mozilla.fenix.home.recentvisits.controller.RecentVisitsController
import org.mozilla.fenix.home.recentvisits.interactor.RecentVisitsInteractor
import org.mozilla.fenix.wallpapers.WallpaperState

/**
* Interface for tab related actions in the [SessionControlInteractor].
Expand Down Expand Up @@ -163,15 +162,6 @@ interface OnboardingInteractor {
* Opens a custom tab to privacy notice url. Called when a user clicks on the "read our privacy notice" button.
*/
fun onReadPrivacyNoticeClicked()

/**
* Show Wallpapers onboarding dialog to onboard users about the feature if conditions are met.
* Returns true if the call has been passed down to the controller.
*
* @param state The wallpaper state.
* @return Whether the onboarding dialog is currently shown
*/
fun showWallpapersOnboardingDialog(state: WallpaperState): Boolean
}

interface CustomizeHomeIteractor {
Expand Down Expand Up @@ -332,10 +322,6 @@ class SessionControlInteractor(
controller.handleReadPrivacyNoticeClicked()
}

override fun showWallpapersOnboardingDialog(state: WallpaperState): Boolean {
return controller.handleShowWallpapersOnboardingDialog(state)
}

override fun onToggleCollectionExpanded(collection: TabCollection, expand: Boolean) {
controller.handleToggleCollectionExpanded(collection, expand)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,43 +199,28 @@ class SessionControlView(

val view: RecyclerView = containerView as RecyclerView

// We want to limit feature recommendations to one per HomePage visit.
var featureRecommended = false

private val sessionControlAdapter = SessionControlAdapter(
interactor,
viewLifecycleOwner,
containerView.context.components,
)

init {
@Suppress("NestedBlockDepth")
view.apply {
adapter = sessionControlAdapter
layoutManager = object : LinearLayoutManager(containerView.context) {
override fun onLayoutCompleted(state: RecyclerView.State?) {
super.onLayoutCompleted(state)

if (!featureRecommended && !context.settings().showHomeOnboardingDialog) {
if (!context.settings().showHomeOnboardingDialog && (
context.settings().showSyncCFR ||
context.settings().shouldShowJumpBackInCFR
)
) {
featureRecommended = HomeCFRPresenter(
context = context,
recyclerView = view,
).show()
}

if (!context.settings().shouldShowJumpBackInCFR &&
context.settings().showWallpaperOnboarding &&
!featureRecommended
) {
featureRecommended = interactor.showWallpapersOnboardingDialog(
context.components.appStore.state.wallpaperState
)
}
if (!context.settings().showHomeOnboardingDialog && (
context.settings().showSyncCFR ||
context.settings().shouldShowJumpBackInCFR
)
) {
HomeCFRPresenter(
context = context,
recyclerView = view,
).show()
}

// We want some parts of the home screen UI to be rendered first if they are
Expand Down
16 changes: 6 additions & 10 deletions app/src/main/java/org/mozilla/fenix/onboarding/HomeCFRPresenter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ class HomeCFRPresenter(
* Determine the CFR to be shown on the Home screen and show a CFR for the resultant view
* if any.
*/
fun show(): Boolean {
return when (val result = getCFRToShow()) {
is Result.SyncedTab -> {
showSyncedTabCFR(view = result.view)
true
fun show() {
when (val result = getCFRToShow()) {
is Result.SyncedTab -> showSyncedTabCFR(view = result.view)
is Result.JumpBackIn -> showJumpBackInCFR(view = result.view)
else -> {
// no-op
}
is Result.JumpBackIn -> {
showJumpBackInCFR(view = result.view)
true
}
else -> false
}
}

Expand Down

This file was deleted.

Loading

0 comments on commit 64e8dcc

Please sign in to comment.