@@ -61,7 +61,6 @@ class BrowserViewController: UIViewController {
61
61
fileprivate( set) var toolbar : TabToolbar ?
62
62
var searchController : SearchResultsViewController ?
63
63
var screenshotHelper : ScreenshotHelper !
64
- fileprivate var homePanelIsInline = false
65
64
var notchAreaCover : UIVisualEffectView = {
66
65
return UIVisualEffectView ( )
67
66
} ( )
@@ -373,7 +372,6 @@ class BrowserViewController: UIViewController {
373
372
// set things up. Make sure to only update the toolbar state if the view is ready for it.
374
373
if isViewLoaded {
375
374
updateToolbarStateForTraitCollection ( newCollection, withTransitionCoordinator: coordinator)
376
- self . homePanelIsInline = self . shouldShowFooterForTraitCollection ( newCollection)
377
375
self . updateViewConstraints ( )
378
376
}
379
377
@@ -445,7 +443,6 @@ class BrowserViewController: UIViewController {
445
443
446
444
override func viewDidLoad( ) {
447
445
super. viewDidLoad ( )
448
- self . homePanelIsInline = self . shouldShowFooterForTraitCollection ( self . traitCollection)
449
446
NotificationCenter . default. addObserver ( self , selector: #selector( appWillResignActiveNotification) , name: UIApplication . willResignActiveNotification, object: nil )
450
447
NotificationCenter . default. addObserver ( self , selector: #selector( appDidBecomeActiveNotification) , name: UIApplication . didBecomeActiveNotification, object: nil )
451
448
NotificationCenter . default. addObserver ( self , selector: #selector( appDidEnterBackgroundNotification) , name: UIApplication . didEnterBackgroundNotification, object: nil )
@@ -748,17 +745,18 @@ class BrowserViewController: UIViewController {
748
745
// Remake constraints even if we're already showing the home controller.
749
746
// The home controller may change sizes if we tap the URL bar while on about:home.
750
747
homeViewController? . view. snp. remakeConstraints { make in
751
- make. top. equalTo ( self . urlBar. snp. bottom)
748
+ if self . toolbar != nil {
749
+ make. top. equalTo ( self . view. safeArea. top)
750
+ } else {
751
+ make. top. equalTo ( self . urlBar. snp. bottom)
752
+ }
753
+
752
754
make. left. right. equalTo ( self . view)
753
755
754
756
make. bottom. equalTo ( self . view. snp. bottom)
755
757
}
756
758
757
- if self . homePanelIsInline {
758
- self . view. bringSubviewToFront ( self . footer)
759
- } else {
760
- self . view. sendSubviewToBack ( self . footer)
761
- }
759
+ self . view. bringSubviewToFront ( self . footer)
762
760
763
761
alertStackView. snp. remakeConstraints { make in
764
762
make. centerX. equalTo ( self . view)
@@ -774,10 +772,11 @@ class BrowserViewController: UIViewController {
774
772
}
775
773
}
776
774
777
- fileprivate func showUserAgentHome( inline: Bool ) {
778
- homePanelIsInline = inline
775
+ fileprivate func showHome( ) {
779
776
if self . homeViewController == nil {
780
- let homeViewController = HomeViewNavigationController ( profile: profile, toolbarHeight: self . toolbar? . bounds. height ?? 80 )
777
+ let homeViewController = HomeViewNavigationController (
778
+ profile: profile,
779
+ toolbarHeight: self . traitCollection. horizontalSizeClass == . compact ? UIConstants . BottomToolbarHeight : 0 )
781
780
homeViewController. homePanelDelegate = self
782
781
homeViewController. view. alpha = 0.0
783
782
self . homeViewController = homeViewController
@@ -802,7 +801,7 @@ class BrowserViewController: UIViewController {
802
801
view. setNeedsUpdateConstraints ( )
803
802
}
804
803
805
- fileprivate func hideUserAgentHome ( ) {
804
+ fileprivate func hideHome ( ) {
806
805
guard let browserHomeViewController = self . homeViewController else {
807
806
return
808
807
}
@@ -828,16 +827,16 @@ class BrowserViewController: UIViewController {
828
827
let isAboutHomeURL = url. flatMap { InternalURL ( $0) ? . isAboutHomeURL } ?? false
829
828
if !urlBar. inOverlayMode {
830
829
guard let url = url else {
831
- hideUserAgentHome ( )
830
+ hideHome ( )
832
831
return
833
832
}
834
833
if isAboutHomeURL {
835
- showUserAgentHome ( inline : true )
834
+ showHome ( )
836
835
} else if !url. absoluteString. hasPrefix ( " \( InternalURL . baseUrl) / \( SessionRestoreHandler . path) " ) {
837
- hideUserAgentHome ( )
836
+ hideHome ( )
838
837
}
839
838
} else if isAboutHomeURL {
840
- showUserAgentHome ( inline : false )
839
+ showHome ( )
841
840
}
842
841
}
843
842
@@ -1509,14 +1508,12 @@ extension BrowserViewController: URLBarDelegate {
1509
1508
if let toast = clipboardBarDisplayHandler? . clipboardToast {
1510
1509
toast. removeFromSuperview ( )
1511
1510
}
1512
-
1513
- showUserAgentHome ( inline: false )
1511
+ hideHome ( )
1514
1512
}
1515
1513
1516
1514
func urlBarDidLeaveOverlayMode( _ urlBar: URLBarView ) {
1517
1515
destroySearchController ( )
1518
1516
updateInContentHomePanel ( tabManager. selectedTab? . url as URL ? )
1519
- self . homePanelIsInline = self . shouldShowFooterForTraitCollection ( self . traitCollection)
1520
1517
self . updateViewConstraints ( )
1521
1518
}
1522
1519
0 commit comments