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

Refactor [Menu] Remove possibly spamming logs for Menu #23753

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -590,14 +590,6 @@ class BrowserCoordinator: BaseCoordinator,

private func makeMenuNavViewController() -> DismissableNavigationViewController? {
if let mainMenuCoordinator = childCoordinators.first(where: { $0 is MainMenuCoordinator }) as? MainMenuCoordinator {
logger.log(
"MainMenuCoordinator already exists when it shouldn't. Removing and recreating it to access menu",
level: .fatal,
category: .mainMenu,
extra: ["existing mainMenuCoordinator UUID": "\(mainMenuCoordinator.windowUUID)",
"BrowserCoordinator windowUUID": "\(windowUUID)"]
)

mainMenuCoordinator.dismissMenuModal(animated: false)
}

Expand All @@ -619,14 +611,6 @@ class BrowserCoordinator: BaseCoordinator,
add(child: coordinator)
coordinator.start()

navigationController.onViewDismissed = { [weak self] in
self?.logger.log(
"MainMenu NavigationController - onViewDismissed",
level: .info,
category: .mainMenu
)
}

return navigationController
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,62 +38,29 @@ class MainMenuCoordinator: BaseCoordinator, FeatureFlaggable {
super.init(router: router)
}

deinit {
logger.log(
"MainMenuCoordinator - deinitialized",
level: .info,
category: .mainMenu
)
}

func start() {
logger.log(
"MainMenuCoordinator - started",
level: .info,
category: .mainMenu
)
router.setRootViewController(
createMainMenuViewController(),
hideBar: true
)
}

func showDetailViewController() {
logger.log(
"MainMenuCoordinator - pushing detail view controller",
level: .info,
category: .mainMenu
)
router.push(
createMainMenuDetailViewController(),
animated: true
)
}

func dismissDetailViewController() {
logger.log(
"MainMenuCoordinator - popping detail view controller",
level: .info,
category: .mainMenu
)
router.popViewController(animated: true)
}

func removeCoordinatorFromParent() {
logger.log(
"MainMenuCoordinator - removing coordinator from parent",
level: .info,
category: .mainMenu
)
parentCoordinator?.didFinish(from: self)
}

func dismissMenuModal(animated: Bool) {
logger.log(
"MainMenuCoordinator - dismissing main menu",
level: .info,
category: .mainMenu
)
router.dismiss(animated: animated, completion: nil)
removeCoordinatorFromParent()
}
Expand All @@ -105,35 +72,48 @@ class MainMenuCoordinator: BaseCoordinator, FeatureFlaggable {
switch destination.destination {
case .bookmarks:
self.navigationHandler?.showLibraryPanel(.bookmarks)

case .customizeHomepage:
self.navigationHandler?.showSettings(at: .homePage)

case .downloads:
self.navigationHandler?.showLibraryPanel(.downloads)

case .editBookmark:
self.navigationHandler?.editLatestBookmark()

case .findInPage:
self.navigationHandler?.showFindInPage()

case .goToURL:
self.navigationHandler?.openURLInNewTab(destination.url)

case .history:
self.navigationHandler?.showLibraryPanel(.history)

case .newTab:
self.navigationHandler?.openNewTab(inPrivateMode: false)

case .newPrivateTab:
self.navigationHandler?.openNewTab(inPrivateMode: true)

case .passwords:
self.navigationHandler?.showSettings(at: .password)

case .settings:
self.navigationHandler?.showSettings(at: .general)

case .syncSignIn:
let fxaParameters = FxASignInViewParameters(
launchParameters: FxALaunchParams(entrypoint: .browserMenu, query: [:]),
flowType: .emailLoginFlow,
referringPage: .appMenu
)
self.navigationHandler?.showSignInView(fxaParameters: fxaParameters)

case .shareSheet:
self.navigationHandler?.showShareSheetForCurrentlySelectedTab()

case .zoom:
self.navigationHandler?.updateZoomPageBarVisibility()
}
Expand All @@ -143,6 +123,7 @@ class MainMenuCoordinator: BaseCoordinator, FeatureFlaggable {
}

// MARK: - Private helpers

private func createMainMenuViewController() -> MainMenuViewController {
let mainMenuViewController = MainMenuViewController(windowUUID: windowUUID, profile: profile)
mainMenuViewController.coordinator = self
Expand Down