Skip to content

Commit

Permalink
Merge branch 'main' into dominik/set-as-default-menu-item
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Nov 5, 2024
2 parents c6b9d70 + a8de1e0 commit 8e4bb81
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 297
CURRENT_PROJECT_VERSION = 298
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14778,7 +14778,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 203.1.0;
version = 203.3.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "19f1e5c945aa92562ad2d087e8d6c99801edf656",
"version" : "203.1.0"
"revision" : "64a5d8d1e19951fe397305a14e521713fb0eaa49",
"version" : "203.3.0"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "48fee2508995d4ac02d18b3d55424adedcb4ce4f",
"version" : "6.28.0"
"revision" : "6cab7bdb584653a5dc007cc1ae827ec41c5a91bc",
"version" : "6.29.0"
}
},
{
Expand Down
7 changes: 7 additions & 0 deletions DuckDuckGo/Bookmarks/Extensions/Bookmarks+Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ extension Tab {
}
}

@MainActor
static func with(contentsOf bookmarks: [Bookmark], burnerMode: BurnerMode) -> [Tab] {
bookmarks.compactMap { bookmark -> Tab? in
guard let url = bookmark.urlObject else { return nil }
return Tab(content: .url(url, source: .bookmark), shouldLoadInBackground: true, burnerMode: burnerMode)
}
}
}

extension TabCollection {
Expand Down
30 changes: 19 additions & 11 deletions DuckDuckGo/Bookmarks/Services/BookmarksContextMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,17 @@ extension BookmarksContextMenu: BookmarkMenuItemSelectors {
}

@objc func toggleBookmarkAsFavorite(_ sender: NSMenuItem) {
guard let bookmark = sender.representedObject as? Bookmark else {
if let bookmark = sender.representedObject as? Bookmark{
bookmark.isFavorite.toggle()
bookmarkManager.update(bookmark: bookmark)
} else if let bookmarks = sender.representedObject as? [Bookmark] {
bookmarks.forEach { bookmark in
bookmark.isFavorite.toggle()
bookmarkManager.update(bookmark: bookmark)
}
} else {
assertionFailure("Failed to cast menu represented object to Bookmark")
return
}

bookmark.isFavorite.toggle()
bookmarkManager.update(bookmark: bookmark)
}

@MainActor
Expand Down Expand Up @@ -424,16 +428,20 @@ extension BookmarksContextMenu: FolderMenuItemSelectors {

@MainActor
@objc func openInNewTabs(_ sender: NSMenuItem) {
guard let tabCollection = windowControllersManager.lastKeyMainWindowController?.mainViewController.tabCollectionViewModel,
let folder = sender.representedObject as? BookmarkFolder
else {
guard let tabCollection = windowControllersManager.lastKeyMainWindowController?.mainViewController.tabCollectionViewModel else {
assertionFailure("Cannot open all in new tabs")
return
}

let tabs = Tab.withContentOfBookmark(folder: folder, burnerMode: tabCollection.burnerMode)
tabCollection.append(tabs: tabs)
PixelExperiment.fireOnboardingBookmarkUsed5to7Pixel()
if let folder = sender.representedObject as? BookmarkFolder {
let tabs = Tab.withContentOfBookmark(folder: folder, burnerMode: tabCollection.burnerMode)
tabCollection.append(tabs: tabs)
PixelExperiment.fireOnboardingBookmarkUsed5to7Pixel()
} else if let bookmarks = sender.representedObject as? [Bookmark] {
let tabs = Tab.with(contentsOf: bookmarks, burnerMode: tabCollection.burnerMode)
tabCollection.append(tabs: tabs)
PixelExperiment.fireOnboardingBookmarkUsed5to7Pixel()
}
}

@MainActor
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.3.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
.package(path: "../Freemium"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.3.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "203.3.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down

0 comments on commit 8e4bb81

Please sign in to comment.