Skip to content

Commit

Permalink
Switch to tab implementation (#3660)
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx authored Jan 17, 2025
1 parent 9d687e4 commit f105100
Show file tree
Hide file tree
Showing 45 changed files with 1,019 additions and 162 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15366,7 +15366,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 224.7.1;
version = 224.7.2;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "5acb297db5c0edabe13c79efa33b1d0e545d6bff",
"version" : "224.7.1"
"revision" : "b3a8ea5ef9821203fe88a12e3f15ad48b7278a6a",
"version" : "224.7.2"
}
},
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Arrow-Right-12.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Window-Tabbed-16D 1.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
5 changes: 5 additions & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ struct UserText {
static let searchDuckDuckGoSuffix = NSLocalizedString("address.bar.search.suffix",
value: "Search DuckDuckGo",
comment: "Suffix of searched terms in address bar. Example: best watching machine . Search DuckDuckGo")
static let duckDuckGoSearchSuffix = NSLocalizedString("address.bar.search.open.tab.suffix",
value: "DuckDuckGo Search",
comment: "Suffix of DuckDuckGo Search open tab suggestion. Example: cats – DuckDuckGo Search")
static let addressBarVisitSuffix = NSLocalizedString("address.bar.visit.suffix",
value: "Visit",
comment: "Address bar suffix of possibly visited website. Example: spreadprivacy.com . Visit spreadprivacy.com")
Expand Down Expand Up @@ -1435,4 +1438,6 @@ struct UserText {
static let homePagePromotionFreemiumDBPPostScanEngagementButtonTitle = "View Results"

static let removeSuggestionTooltip = NSLocalizedString("remove.suggestion.tooltip", value: "Remove from browsing history", comment: "Tooltip for the button which removes the history entry from the history")

static let switchToTab = NSLocalizedString("switch.to.tab", value: "Switch to Tab", comment: "Suggestion to switch to an open tab button title")
}
14 changes: 10 additions & 4 deletions DuckDuckGo/Common/View/AppKit/ColorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ internal class ColorView: NSView {

@IBInspectable var backgroundColor: NSColor? = NSColor.clear {
didSet {
layer?.backgroundColor = backgroundColor?.cgColor
NSAppearance.withAppAppearance {
layer?.backgroundColor = backgroundColor?.cgColor
}
}
}

Expand All @@ -54,7 +56,9 @@ internal class ColorView: NSView {

@IBInspectable var borderColor: NSColor? {
didSet {
layer!.borderColor = borderColor?.cgColor
NSAppearance.withAppAppearance {
layer!.borderColor = borderColor?.cgColor
}
}
}

Expand All @@ -72,8 +76,10 @@ internal class ColorView: NSView {

override func updateLayer() {
super.updateLayer()
layer?.backgroundColor = backgroundColor?.cgColor
layer?.borderColor = borderColor?.cgColor
NSAppearance.withAppAppearance {
layer?.backgroundColor = backgroundColor?.cgColor
layer?.borderColor = borderColor?.cgColor
}
}

// MARK: - Click Event Interception
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/HomePage/Model/HomePageAddressBarModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extension HomePage.Models {
return AddressBarViewController(
coder: coder,
tabCollectionViewModel: tabCollectionViewModel,
isBurner: tabCollectionViewModel.isBurner,
burnerMode: tabCollectionViewModel.burnerMode,
popovers: nil,
isSearchBox: true
)
Expand Down
120 changes: 120 additions & 0 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,66 @@
}
}
},
"address.bar.search.open.tab.suffix" : {
"comment" : "Suffix of DuckDuckGo Search open tab suggestion. Example: cats – DuckDuckGo Search",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "DuckDuckGo Search"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Recherche DuckDuckGo"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "DuckDuckGo-Suche"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Wyszukiwanie DuckDuckGo"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Búsqueda de DuckDuckGo"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Поиск DuckDuckGo"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Zoeken met DuckDuckGo"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Pesquisa DuckDuckGo"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ricerca DuckDuckGo"
}
}
}
},
"address.bar.search.suffix" : {
"comment" : "Suffix of searched terms in address bar. Example: best watching machine . Search DuckDuckGo",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -63955,6 +64015,66 @@
}
}
},
"switch.to.tab" : {
"comment" : "Suggestion to switch to an open tab button title",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Switch to Tab"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Passer à l'onglet"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Zu Tab wechseln"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Przełącz na kartę"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Cambiar a Pestaña"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Перейти на вкладку"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Overschakelen naar tabblad"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mudar para separador"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Passa alla scheda"
}
}
}
},
"sync.promo.bookmarks.message" : {
"comment" : "Message for the Sync Promotion banner when user has bookmarks that can be synced",
"extractionState" : "extracted_with_value",
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/MainWindow/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ final class MainViewController: NSViewController {
}()

navigationBarViewController = NavigationBarViewController.create(tabCollectionViewModel: tabCollectionViewModel,
isBurner: isBurner,
networkProtectionPopoverManager: networkProtectionPopoverManager,
networkProtectionStatusReporter: networkProtectionStatusReporter,
autofillPopoverPresenter: autofillPopoverPresenter,
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/Menus/MainMenuActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@ extension MainViewController: NSMenuItemValidation {
// Pin Tab
case #selector(MainViewController.pinOrUnpinTab(_:)):
guard getActiveTabAndIndex()?.tab.isUrl == true,
tabCollectionViewModel.pinnedTabsManager != nil
tabCollectionViewModel.pinnedTabsManager != nil,
!isBurner
else {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,12 @@ final class AddressBarButtonsViewController: NSViewController {
imageButton.image = .web
case .browsing:
imageButton.image = tabViewModel.favicon
case .editing(isUrl: true):
case .editing(.url):
imageButton.image = .web
case .editing(isUrl: false):
case .editing(.text):
imageButton.image = .search
case .editing(.openTabSuggestion):
imageButton.image = .openTabSuggestion
default:
imageButton.image = nil
}
Expand Down
Loading

0 comments on commit f105100

Please sign in to comment.