Skip to content

Commit

Permalink
Bugfix FXIOS-10509 [Menu] [CFR] Menu CFR should be displayed for new …
Browse files Browse the repository at this point in the history
…users that have seen the old menu (#23090)

* FXIOS-10509 #23042 ⁃ [Experiment] The Menu Redesign CFR should be displayed for new users that have seen the old menu

* Refactored two lines of code
  • Loading branch information
dicarobinho authored Nov 13, 2024
1 parent 3068116 commit a8321d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,8 @@ class BrowserViewController: UIViewController,
menuHelper.navigationHandler = navigationHandler

updateZoomPageBarVisibility(visible: false)
menuHelper.getToolbarActions(navigationController: navigationController) { actions in
menuHelper.getToolbarActions(navigationController: navigationController) { [weak self] actions in
guard let self else { return }
let shouldInverse = PhotonActionSheetViewModel.hasInvertedMainMenu(
trait: self.traitCollection,
isBottomSearchBar: self.isBottomSearchBar
Expand All @@ -2344,6 +2345,9 @@ class BrowserViewController: UIViewController,
isMainMenu: true,
isMainMenuInverted: shouldInverse
)
if self.profile.prefs.boolForKey(PrefsKeys.PhotonMainMenuShown) == nil {
self.profile.prefs.setBool(true, forKey: PrefsKeys.PhotonMainMenuShown)
}
self.presentSheetWith(viewModel: viewModel, on: self, from: button)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,16 @@ class MainMenuViewController: UIViewController,
return false
}

// Don't display CFR for fresh installs
// Don't display CFR for fresh installs for users that never saw before the photon main menu
if InstallType.get() == .fresh {
if let photonMainMenuShown = profile.prefs.boolForKey(PrefsKeys.PhotonMainMenuShown),
photonMainMenuShown {
return viewProvider.shouldPresentContextualHint()
}
viewProvider.markContextualHintPresented()
return false
}
return viewProvider.shouldPresentContextualHint() ? true : false
return viewProvider.shouldPresentContextualHint()
}

// MARK: - UIAdaptivePresentationControllerDelegate
Expand Down
3 changes: 3 additions & 0 deletions firefox-ios/Shared/Prefs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public struct PrefsKeys {
public static let splashScreenShownKey = "splashScreenShownKey"

public static let PasswordGeneratorShown = "PasswordGeneratorShown"

// Represents whether or not the user has seen the photon main menu once, at least.
public static let PhotonMainMenuShown = "PhotonMainMenuShown"
}

public protocol Prefs {
Expand Down

0 comments on commit a8321d3

Please sign in to comment.