Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #3779: Expand menu when tapping on settings, history, etc. (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Jun 24, 2021
1 parent 6d24c81 commit eca3385
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand All @@ -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()
Expand All @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eca3385

Please sign in to comment.