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

Commit

Permalink
Fix #8009: Update toolbar constraints to utilize safe area properly (#…
Browse files Browse the repository at this point in the history
…8084)

The value of `UIApplication.shared.keyWindow?.safeAreaInsets.bottom` is not updated when the `updateViewConstraints` method is called. However calculating this height manually is not correct/not needed, as we can simply rely on the safe area layout guides
  • Loading branch information
kylehickinson authored Sep 18, 2023
1 parent e2b1b77 commit f90d858
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
2 changes: 0 additions & 2 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1287,8 +1287,6 @@ public class BrowserViewController: UIViewController {
footer.snp.remakeConstraints { make in
make.bottom.equalTo(toolbarLayoutGuide)
make.leading.trailing.equalTo(self.view)
let height = self.toolbar == nil ? 0 : UIConstants.bottomToolbarHeight
make.height.equalTo(height)
}

bottomBarKeyboardBackground.snp.remakeConstraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class BottomToolbarView: UIView, ToolbarProtocol {
contentView.snp.makeConstraints { make in
make.leading.trailing.top.equalTo(self)
make.bottom.equalTo(self.safeArea.bottom)
make.height.equalTo(UIConstants.toolbarHeight)
}
super.updateConstraints()
}
Expand Down
8 changes: 1 addition & 7 deletions Sources/Brave/Frontend/UIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ public struct UIConstants {
static let defaultPadding: CGFloat = 10
static let snackbarButtonHeight: CGFloat = 48
static var toolbarHeight: CGFloat = 44
static var bottomToolbarHeight: CGFloat {
get {
let bottomInset: CGFloat = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0.0
return toolbarHeight + bottomInset
}
}


// Static fonts
static let defaultChromeSize: CGFloat = 16
static let defaultChromeSmallSize: CGFloat = 11
Expand Down

0 comments on commit f90d858

Please sign in to comment.