Add feature flag for browser-style navigation
This commit is contained in:
parent
75caf2c1eb
commit
f2485f0ba1
|
@ -431,6 +431,7 @@ extension Preferences {
|
|||
extension Preferences {
|
||||
public enum FeatureFlag: String, Codable {
|
||||
case iPadMultiColumn = "ipad-multi-column"
|
||||
case iPadBrowserNavigation = "ipad-browser-navigation"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,6 @@ class MainTabBarViewController: UITabBarController, UITabBarControllerDelegate {
|
|||
return vc
|
||||
} else {
|
||||
let nav = EnhancedNavigationViewController(rootViewController: vc)
|
||||
// nav.useBrowserStyleNavigation = true
|
||||
return nav
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import UIKit
|
|||
|
||||
class EnhancedNavigationViewController: UINavigationController {
|
||||
|
||||
var useBrowserStyleNavigation = false
|
||||
let useBrowserStyleNavigation = Preferences.shared.hasFeatureFlag(.iPadBrowserNavigation)
|
||||
|
||||
var poppedViewControllers = [UIViewController]()
|
||||
var skipResetPoppedOnNextPush = false
|
||||
|
@ -20,7 +20,8 @@ class EnhancedNavigationViewController: UINavigationController {
|
|||
override var viewControllers: [UIViewController] {
|
||||
didSet {
|
||||
poppedViewControllers = []
|
||||
if #available(iOS 16.0, *) {
|
||||
if #available(iOS 16.0, *),
|
||||
useBrowserStyleNavigation {
|
||||
// TODO: this for loop might not be necessary
|
||||
for vc in viewControllers {
|
||||
configureNavItem(vc.navigationItem)
|
||||
|
@ -36,6 +37,7 @@ class EnhancedNavigationViewController: UINavigationController {
|
|||
self.interactivePushTransition = InteractivePushTransition(navigationController: self)
|
||||
|
||||
if #available(iOS 16.0, *),
|
||||
useBrowserStyleNavigation,
|
||||
let topViewController {
|
||||
configureNavItem(topViewController.navigationItem)
|
||||
updateTopNavItemState()
|
||||
|
@ -124,7 +126,7 @@ class EnhancedNavigationViewController: UINavigationController {
|
|||
}
|
||||
}
|
||||
// match the system behavior when popping multiple by animated-ly pushing the final destination one,
|
||||
// and then intersiting the intermediary ones before it, as if they'd all been pushed together
|
||||
// and then inserting the intermediary ones before it, as if they'd all been pushed together
|
||||
performAfterAnimating(block: {
|
||||
pushViewController(target, animated: true)
|
||||
}, after: {
|
||||
|
|
Loading…
Reference in New Issue