Skip to content

Commit

Permalink
Fix crash on popup window display; adjust naming (#2315)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1177771139624306/1206762780611864/f

Description:
fixes missing constraint ref
  • Loading branch information
mallexxx authored Mar 5, 2024
1 parent 6534946 commit 555dcd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion DuckDuckGo/MainWindow/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ final class MainView: NSView {
let divider = ColorView(frame: .zero, backgroundColor: .separatorColor)

private(set) var navigationBarTopConstraint: NSLayoutConstraint!
private(set) var addressBarHeightConstraint: NSLayoutConstraint!
private(set) var bookmarksBarHeightConstraint: NSLayoutConstraint!

@Published var isMouseAboveWebView: Bool = false
Expand Down
10 changes: 6 additions & 4 deletions DuckDuckGo/MainWindow/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ final class MainViewController: NSViewController {
tabBarViewController.view.isHidden = true
mainView.tabBarContainerView.isHidden = true
mainView.navigationBarTopConstraint.constant = 0.0
mainView.addressBarHeightConstraint.constant = mainView.tabBarContainerView.frame.height
resizeNavigationBar(isHomePage: false, animated: false)

updateBookmarksBarViewVisibility(visible: false)
} else {
mainView.navigationBarContainerView.wantsLayer = true
mainView.navigationBarContainerView.layer?.masksToBounds = false

resizeNavigationBarForHomePage(tabCollectionViewModel.selectedTabViewModel?.tab.content == .newtab, animated: false)
resizeNavigationBar(isHomePage: tabCollectionViewModel.selectedTabViewModel?.tab.content == .newtab,
animated: false)

let bookmarksBarVisible = AppearancePreferences.shared.showBookmarksBar
updateBookmarksBarViewVisibility(visible: bookmarksBarVisible)
Expand Down Expand Up @@ -291,7 +293,7 @@ final class MainViewController: NSViewController {
}
}

private func resizeNavigationBarForHomePage(_ homePage: Bool, animated: Bool) {
private func resizeNavigationBar(isHomePage homePage: Bool, animated: Bool) {
updateDividerColor(isShowingHomePage: homePage)
navigationBarViewController.resizeAddressBar(for: homePage ? .homePage : (isInPopUpWindow ? .popUpWindow : .default), animated: animated)
}
Expand All @@ -303,7 +305,7 @@ final class MainViewController: NSViewController {
guard let self, let selectedTabViewModel else { return }
defer { lastTabContent = content }

resizeNavigationBarForHomePage(content == .newtab, animated: content == .newtab && lastTabContent != .newtab)
resizeNavigationBar(isHomePage: content == .newtab, animated: content == .newtab && lastTabContent != .newtab)
updateBookmarksBar(content)
adjustFirstResponder(selectedTabViewModel: selectedTabViewModel, tabContent: content)
}
Expand Down

0 comments on commit 555dcd0

Please sign in to comment.