Skip to content

Commit

Permalink
Merge branch 'release/1.105.0' into bunn/duckplayer/enrollment
Browse files Browse the repository at this point in the history
# Conflicts:
#	DuckDuckGo/Localizable.xcstrings
  • Loading branch information
Bunn committed Sep 3, 2024
2 parents 0dca406 + ba241fc commit f474220
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 36 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 = 252
CURRENT_PROJECT_VERSION = 253
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.133",
"green" : "0.133",
"red" : "0.133"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ final class BookmarkOutlineViewDataSource: NSObject, BookmarksOutlineViewDataSou
}

let destination = destinationNode.isRoot ? PseudoFolder.bookmarks : destinationNode.representedObject

guard !isSearching || destination is BookmarkFolder else { return .none }

if let destinationFolder = destination as? BookmarkFolder {
self.dragDestinationFolder = destinationFolder
}

let operation = dragDropManager.validateDrop(info, to: destination)
self.dragDestinationFolder = (operation == .none || item == nil) ? nil : destinationNode.representedObject as? BookmarkFolder

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Bookmarks/Services/BookmarksContextMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ extension BookmarksContextMenu {

static func menuItems(for folder: BookmarkFolder, target: AnyObject?, forSearch: Bool, includeManageBookmarksItem: Bool) -> [NSMenuItem] {
// disable "Open All" if no Bookmarks in folder
var hasBookmarks = folder.children.contains(where: { $0 is Bookmark })
let hasBookmarks = folder.children.contains(where: { $0 is Bookmark })
var items = [
openInNewTabsMenuItem(folder: folder, target: target, enabled: hasBookmarks),
openAllInNewWindowMenuItem(folder: folder, target: target, enabled: hasBookmarks),
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Bookmarks/View/AddBookmarkPopoverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct AddBookmarkPopoverView: View {
otherActionTitle: UserText.delete,
isOtherActionDisabled: false,
otherAction: model.removeButtonAction,
isOtherActionTriggeredByEscKey: false,
defaultActionTitle: UserText.done,
isDefaultActionDisabled: model.isDefaultActionButtonDisabled,
defaultAction: model.doneButtonAction
Expand Down
9 changes: 4 additions & 5 deletions DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ final class BookmarkListViewController: NSViewController {
boxDivider.setContentHuggingPriority(.defaultHigh, for: .vertical)
boxDivider.translatesAutoresizingMaskIntoConstraints = false

// keep OutlineView menu declaration before buttons as it‘s used as target
outlineView.menu = BookmarksContextMenu(bookmarkManager: bookmarkManager, delegate: self)

stackView.orientation = .horizontal
stackView.spacing = 4
stackView.setHuggingPriority(.defaultHigh, for: .horizontal)
Expand All @@ -170,9 +173,6 @@ final class BookmarkListViewController: NSViewController {
stackView.addArrangedSubview(buttonsDivider)
stackView.addArrangedSubview(manageBookmarksButton)

// keep OutlineView menu declaration before the buttons as it‘s their target
outlineView.menu = BookmarksContextMenu(bookmarkManager: bookmarkManager, delegate: self)

newBookmarkButton.bezelStyle = .shadowlessSquare
newBookmarkButton.cornerRadius = 4
newBookmarkButton.normalTintColor = .button
Expand Down Expand Up @@ -254,7 +254,6 @@ final class BookmarkListViewController: NSViewController {
outlineView.usesAutomaticRowHeights = true
outlineView.target = self
outlineView.action = #selector(handleClick)
outlineView.menu = BookmarksContextMenu(bookmarkManager: bookmarkManager, delegate: self)
outlineView.dataSource = dataSource
outlineView.delegate = dataSource

Expand Down Expand Up @@ -452,7 +451,7 @@ final class BookmarkListViewController: NSViewController {
expandFoldersAndScrollUntil(folder)
outlineView.scrollToAdjustedPositionInOutlineView(folder)

guard let node = treeController.node(representing: folder) else { return }
guard let node = treeController.findNodeWithId(representing: folder) else { return }

outlineView.highlight(node)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ extension BookmarkManagementDetailViewController: NSTableViewDelegate, NSTableVi
proposedRow row: Int,
proposedDropOperation dropOperation: NSTableView.DropOperation) -> NSDragOperation {
let destination = destination(for: dropOperation, at: row)

guard !isSearching || destination is BookmarkFolder else { return .none }

return dragDropManager.validateDrop(info, to: destination)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct AddEditBookmarkDialogView: ModalView {
otherActionTitle: viewModel.bookmarkModel.cancelActionTitle,
isOtherActionDisabled: viewModel.bookmarkModel.isOtherActionDisabled,
otherAction: viewModel.bookmarkModel.cancel,
isOtherActionTriggeredByEscKey: true,
defaultActionTitle: viewModel.bookmarkModel.defaultActionTitle,
isDefaultActionDisabled: viewModel.bookmarkModel.isDefaultActionDisabled,
defaultAction: viewModel.bookmarkModel.addOrSave
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/Bookmarks/View/Dialog/AddEditBookmarkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct AddEditBookmarkView: View {
let otherActionTitle: String
let isOtherActionDisabled: Bool
let otherAction: @MainActor (_ dismiss: () -> Void) -> Void
let isOtherActionTriggeredByEscKey: Bool

let defaultActionTitle: String
let isDefaultActionDisabled: Bool
Expand Down Expand Up @@ -78,6 +79,7 @@ struct AddEditBookmarkView: View {
viewState: .init(buttonsState),
otherButtonAction: .init(
title: otherActionTitle,
keyboardShortCut: isOtherActionTriggeredByEscKey ? .cancelAction : nil,
isDisabled: isOtherActionDisabled,
action: otherAction
),
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/BookmarksBar/View/BookmarksBarMenuPopover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ final class BookmarksBarMenuPopover: NSPopover {
return frame
}

/// close other BookmarkListPopover-s shown from the main window when opening a new one
/// close other `BookmarksBarMenuPopover`-s and `BookmarkListPopover`-s shown from the main window when opening a new one
static func closeBookmarkListPopovers(shownIn window: NSWindow?, except popoverToKeep: BookmarksBarMenuPopover? = nil) {
guard let window,
// ignore when opening a submenu from another BookmarkListPopover
!(window.contentViewController?.nextResponder is Self) else { return }
for case let .some(popover as Self) in (window.childWindows ?? []).map(\.contentViewController?.nextResponder) where popover !== popoverToKeep && popover.isShown {
for case let .some(popover as NSPopover) in (window.childWindows ?? []).map(\.contentViewController?.nextResponder) where popover !== popoverToKeep && popover.isShown {
popover.close()
}
}
Expand Down
6 changes: 4 additions & 2 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ struct UserText {
static let duckPlayerContingencyMessageBody = NSLocalizedString("duck-player.video-contingency-message", value: "Duck Player's functionality has been affected by recent changes to YouTube. We’re working to fix these issues and appreciate your understanding.", comment: "Message explaining to the user that Duck Player is not available")
static let duckPlayerContingencyMessageCTA = NSLocalizedString("duck-player.video-contingency-cta", value: "Learn More", comment: "Button for the message explaining to the user that Duck Player is not available so the user can learn more")

static let duckPlayerOnboardingChoiceModalTitle = NSLocalizedString("duck-player.onboarding-choice-modal-title", value: "Drowning in ads on YouTube?", comment: "Title for a Duck Player onboarding modal screen")
static let duckPlayerOnboardingChoiceModalMessage = NSLocalizedString("duck-player.onboarding-choice-modal-message", value: "Duck Player lets you watch without targeted ads and comes free to use in DuckDuckGo.", comment: "Message for a Duck Player onboarding modal screen")
static let duckPlayerOnboardingChoiceModalTitleTop = NSLocalizedString("duck-player.onboarding-choice-modal-title-top", value: "Drowning in ads on YouTube?", comment: "Top title for a Duck Player onboarding modal screen")
static let duckPlayerOnboardingChoiceModalTitleBottom = NSLocalizedString("duck-player.onboarding-choice-modal-title-bottom", value: "Try Duck Player!", comment: "Bottom title for a Duck Player onboarding modal screen")

static let duckPlayerOnboardingChoiceModalMessage = NSLocalizedString("duck-player.onboarding-choice-modal-message-body", value: "Duck Player lets you watch YouTube without targeted ads in DuckDuckGo and what you watch won't influence your recommendations.", comment: "Message for a Duck Player onboarding modal screen")
static let duckPlayerOnboardingChoiceModalCTAConfirm = NSLocalizedString("duck-player.onboarding-choice-modal-CTA-confirm", value: "Turn on Duck Player", comment: "Confirm Button to enable Duck Player. -Duck Player- should not be translated")
static let duckPlayerOnboardingChoiceModalCTADeny = NSLocalizedString("duck-player.onboarding-choice-modal-CTA-deny", value: "Not Now", comment: "Deny Button to enable Duck Player")

Expand Down
Loading

0 comments on commit f474220

Please sign in to comment.