From a970e626de9d5c554aad15e37856832c92e5e978 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 24 Jun 2021 11:17:46 -0400 Subject: [PATCH] Fix #3779: Expand menu when tapping on settings, history, etc. (#3847) --- .../BrowserViewController+Menu.swift | 8 ++++---- .../BottomToolbar/Menu/MenuViewController.swift | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Client/Frontend/Browser/BrowserViewController/BrowserViewController+Menu.swift b/Client/Frontend/Browser/BrowserViewController/BrowserViewController+Menu.swift index 9bca783af15..4bdff36532f 100644 --- a/Client/Frontend/Browser/BrowserViewController/BrowserViewController+Menu.swift +++ b/Client/Frontend/Browser/BrowserViewController/BrowserViewController+Menu.swift @@ -13,7 +13,7 @@ extension BrowserViewController { VStack(spacing: 0) { VPNMenuButton(vpnProductInfo: self.vpnProductInfo) { vc in (self.presentedViewController as? MenuViewController)? - .pushViewController(vc, animated: true) + .pushInnerMenu(vc) } } } @@ -28,11 +28,11 @@ extension BrowserViewController { MenuItemButton(icon: #imageLiteral(resourceName: "menu-history").template, title: Strings.historyMenuItem) { let vc = HistoryViewController(isPrivateBrowsing: PrivateBrowsingManager.shared.isPrivateBrowsing) vc.toolbarUrlActionsDelegate = self - menuController.pushViewController(vc, animated: true) + menuController.pushInnerMenu(vc) } MenuItemButton(icon: #imageLiteral(resourceName: "menu-downloads").template, title: Strings.downloadsMenuItem) { let vc = DownloadsPanel(profile: self.profile) - menuController.pushViewController(vc, animated: true) + menuController.pushInnerMenu(vc) } MenuItemButton(icon: #imageLiteral(resourceName: "playlist_menu").template, title: Strings.playlistMenuItem) { let playlistController = (UIApplication.shared.delegate as? AppDelegate)?.playlistRestorationController ?? PlaylistViewController() @@ -44,7 +44,7 @@ extension BrowserViewController { MenuItemButton(icon: #imageLiteral(resourceName: "menu-settings").template, title: Strings.settingsMenuItem) { let vc = SettingsViewController(profile: self.profile, tabManager: self.tabManager, feedDataSource: self.feedDataSource, rewards: self.rewards, legacyWallet: self.legacyWallet) vc.settingsDelegate = self - menuController.pushViewController(vc, animated: true) + menuController.pushInnerMenu(vc) } } } diff --git a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift index f394b1f6d71..095b9bd8ec4 100644 --- a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift +++ b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift @@ -112,6 +112,19 @@ class MenuViewController: UINavigationController, UIPopoverPresentationControlle } } + func pushInnerMenu(_ viewController: UIViewController, + expandToLongForm: Bool = true) { + super.pushViewController(viewController, animated: true) + if expandToLongForm { + panModalTransition(to: .longForm) + } + } + + @available(*, unavailable, message: "Use 'pushInnerMenu(_:expandToLongForm:)' instead") + override func pushViewController(_ viewController: UIViewController, animated: Bool) { + super.pushViewController(viewController, animated: animated) + } + override func viewDidLoad() { super.viewDidLoad() navigationBar.isTranslucent = false