Skip to content

Commit

Permalink
delete some unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Jan 18, 2024
1 parent ae86238 commit 250c48f
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ class MainViewController: UIViewController {
@objc func onAddressBarPositionChanged() {
viewCoordinator.moveAddressBarToPosition(appSettings.currentAddressBarPosition)
refreshViewsBasedOnAddressBarPosition(appSettings.currentAddressBarPosition)
refreshWebViewContentInsets()
}

func refreshViewsBasedOnAddressBarPosition(_ position: AddressBarPosition) {
Expand Down Expand Up @@ -479,7 +478,6 @@ class MainViewController: UIViewController {

findInPageBottomLayoutConstraint.constant = height
keyboardHeight = height
refreshWebViewContentInsets()

if let suggestionsTray = suggestionTrayController {
let suggestionsFrameInView = suggestionsTray.view.convert(suggestionsTray.contentFrame, to: view)
Expand Down Expand Up @@ -1332,36 +1330,11 @@ extension MainViewController: BrowserChromeDelegate {
}

if animated {
UIView.animate(withDuration: ChromeAnimationConstants.duration, animations: updateBlock) { _ in
self.refreshWebViewContentInsets()
}
UIView.animate(withDuration: ChromeAnimationConstants.duration, animations: updateBlock)
} else {
updateBlock()
self.refreshWebViewContentInsets()
}
}

func refreshWebViewContentInsets() {
guard let webView = currentTab?.webView else { return }

let top = viewCoordinator.statusBackground.frame.height
let bottom: CGFloat
if isToolbarHidden {
bottom = 0
} else if appSettings.currentAddressBarPosition.isBottom {
bottom = viewCoordinator.toolbar.frame.height
+ viewCoordinator.navigationBarContainer.frame.height
+ view.safeAreaInsets.bottom + additionalSafeAreaInsets.bottom
+ keyboardHeight
} else {
bottom = viewCoordinator.toolbar.frame.height
+ view.safeAreaInsets.bottom + additionalSafeAreaInsets.bottom
+ keyboardHeight
}

// webView.scrollView.contentInset = .init(top: top, left: 0, bottom: bottom, right: 0)
// webView.invalidateIntrinsicContentSize()
}

func setNavigationBarHidden(_ hidden: Bool) {
if hidden { hideKeyboard() }
Expand Down Expand Up @@ -1832,7 +1805,6 @@ extension MainViewController: TabDelegate {

func showBars() {
chromeManager.reset()
refreshWebViewContentInsets()
}

func tabDidRequestFindInPage(tab: TabViewController) {
Expand Down

0 comments on commit 250c48f

Please sign in to comment.