Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions DuckDuckGo/Main/View/MainWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ final class MainWindow: NSWindow {
return true
}

override var frameAutosaveName: NSWindow.FrameAutosaveName {
return "MainWindow"
}

override func setFrameAutosaveName(_ name: NSWindow.FrameAutosaveName) -> Bool {
return super.setFrameAutosaveName(self.frameAutosaveName)
}

init(frame: NSRect) {
super.init(contentRect: frame,
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
Expand Down
2 changes: 0 additions & 2 deletions DuckDuckGo/Main/View/MainWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import Common
@MainActor
final class MainWindowController: NSWindowController {

private static let windowFrameSaveName = "MainWindow"
private var fireViewModel: FireViewModel
private static var knownFullScreenMouseDetectionWindows = Set<NSValue>()

Expand Down Expand Up @@ -76,7 +75,6 @@ final class MainWindowController: NSWindowController {

private func setupWindow() {
window?.delegate = self
window?.setFrameAutosaveName(Self.windowFrameSaveName)

if shouldShowOnboarding {
mainViewController.tabCollectionViewModel.selectedTabViewModel?.tab.startOnboarding()
Expand Down
7 changes: 5 additions & 2 deletions DuckDuckGo/NavigationBar/View/AddressBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import Lottie

final class AddressBarViewController: NSViewController {

@IBOutlet weak var addressBarTextField: AddressBarTextField!
@IBOutlet weak var passiveTextField: NSTextField!
@IBOutlet var addressBarTextField: AddressBarTextField!
@IBOutlet var passiveTextField: NSTextField!
@IBOutlet var inactiveBackgroundView: NSView!
@IBOutlet var activeBackgroundView: NSView!
@IBOutlet var activeOuterBorderView: NSView!
Expand Down Expand Up @@ -100,6 +100,8 @@ final class AddressBarViewController: NSViewController {
view.layer?.masksToBounds = false

updateView()
// only activate active text field leading constraint on its appearance to avoid constraint conflicts
activeTextFieldMinXConstraint.isActive = false
addressBarTextField.addressBarTextFieldDelegate = self
addressBarTextField.tabCollectionViewModel = tabCollectionViewModel
subscribeToSelectedTabViewModel()
Expand Down Expand Up @@ -379,6 +381,7 @@ extension AddressBarViewController {
@objc func textFieldFirstReponderNotification(_ notification: Notification) {
if view.window?.firstResponder == addressBarTextField.currentEditor() {
isFirstResponder = true
activeTextFieldMinXConstraint.isActive = true
} else {
isFirstResponder = false
}
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/Tab/ViewModel/TabViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ final class TabViewModel {
func updateAddressBarStrings() {
guard !errorViewState.isVisible else {
let failingUrl = tab.error?.failingUrl
let failingUrlString = failingUrl?.absoluteString ?? ""
let failingUrlHost = failingUrl?.host?.droppingWwwPrefix() ?? ""
passiveAddressBarString = appearancePreferences.showFullURL ? addressBarString : failingUrlHost
return
Expand Down