Skip to content

Commit

Permalink
Merge branch 'release/1.118.0' into michal/update-pp-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
miasma13 committed Dec 10, 2024
2 parents 7a4a930 + ca800e4 commit dde59d6
Show file tree
Hide file tree
Showing 175 changed files with 4,739 additions and 3,130 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish_dmg_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ jobs:
github_handle:"${{ github.actor }}" \
is_scheduled_release:"${{ github.event_name == 'schedule' }}" \
release_task_id:"${{ steps.task-id.outputs.asana_task_id }}" \
target_section_id:"${{ vars.MACOS_APP_BOARD_DONE_SECTION_ID }}"
target_section_id:"${{ vars.MACOS_APP_BOARD_DONE_SECTION_ID }}" \
tag:"${{ env.TAG }}"
- name: Get tasks since last internal release
id: get-tasks-since-last-internal-release
Expand Down
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 320
CURRENT_PROJECT_VERSION = 325
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 1.117.0
MARKETING_VERSION = 1.118.0
521 changes: 235 additions & 286 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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" : "59f8fb2f850f8a0482c604d07396e01e8de59d21",
"version" : "216.0.1"
"revision" : "20df9e22d5a69acfc25204fb0228a9d6f79b721f",
"version" : "219.0.0"
}
},
{
Expand All @@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/duckduckgo-autofill.git",
"state" : {
"revision" : "c992041d16ec10d790e6204dce9abf9966d1363c",
"version" : "15.1.0"
"revision" : "88982a3802ac504e2f1a118a73bfdf2d8f4a7735",
"version" : "16.0.0"
}
},
{
Expand All @@ -75,7 +75,7 @@
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-spm.git",
"location" : "https://github.com/airbnb/lottie-spm",
"state" : {
"revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605",
"version" : "4.4.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@
ReferencedContainer = "container:LocalPackages/AppKitExtensions">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "NewTabPageTests"
BuildableName = "NewTabPageTests"
BlueprintName = "NewTabPageTests"
ReferencedContainer = "container:LocalPackages/NewTabPage">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down Expand Up @@ -299,6 +309,10 @@
argument = "-NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints YES"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-SUEnableAutomaticChecks NO"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-com.apple.CoreData.ConcurrencyDebug 1"
isEnabled = "YES">
Expand Down
22 changes: 13 additions & 9 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import FeatureFlags
import History
import MetricKit
import Networking
import NewTabPage
import Persistence
import PixelKit
import PixelExperimentKit
import ServiceManagement
import SyncDataProviders
import UserNotifications
Expand Down Expand Up @@ -96,12 +98,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
private(set) lazy var newTabPageActionsManager: NewTabPageActionsManaging = NewTabPageActionsManager(
appearancePreferences: .shared,
activeRemoteMessageModel: activeRemoteMessageModel,
privacyStats: privacyStats,
openURLHandler: { url in
Task { @MainActor in
WindowControllersManager.shared.showTab(with: .contentFromURL(url, source: .appOpenUrl))
}
}
privacyStats: privacyStats
)
let privacyStats: PrivacyStatsCollecting
let activeRemoteMessageModel: ActiveRemoteMessageModel
Expand Down Expand Up @@ -266,13 +263,19 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
privacyConfigurationManager: ContentBlocking.shared.privacyConfigurationManager
)
)
activeRemoteMessageModel = ActiveRemoteMessageModel(remoteMessagingClient: remoteMessagingClient)
activeRemoteMessageModel = ActiveRemoteMessageModel(remoteMessagingClient: remoteMessagingClient, openURLHandler: { url in
WindowControllersManager.shared.showTab(with: .contentFromURL(url, source: .appOpenUrl))
})
} else {
// As long as remoteMessagingClient is private to App Delegate and activeRemoteMessageModel
// is used only by HomePage RootView as environment object,
// it's safe to not initialize the client for unit tests to avoid side effects.
remoteMessagingClient = nil
activeRemoteMessageModel = ActiveRemoteMessageModel(remoteMessagingStore: nil, remoteMessagingAvailabilityProvider: nil)
activeRemoteMessageModel = ActiveRemoteMessageModel(
remoteMessagingStore: nil,
remoteMessagingAvailabilityProvider: nil,
openURLHandler: { _ in }
)
}

featureFlagger = DefaultFeatureFlagger(
Expand All @@ -282,7 +285,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
keyValueStore: UserDefaults.appConfiguration,
actionHandler: FeatureFlagOverridesPublishingHandler<FeatureFlag>()
),
experimentManager: ExperimentCohortsManager(store: ExperimentsDataStore()),
experimentManager: ExperimentCohortsManager(store: ExperimentsDataStore(), fireCohortAssigned: PixelKit.fireExperimentEnrollmentPixel(subfeatureID:experiment:)),
for: FeatureFlag.self
)

Expand Down Expand Up @@ -331,6 +334,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
#else
privacyStats = PrivacyStats(databaseProvider: PrivacyStatsDatabase())
#endif
PixelKit.configureExperimentKit(featureFlagger: featureFlagger, eventTracker: ExperimentEventTracker(store: UserDefaults.appConfiguration))
}

func applicationWillFinishLaunching(_ notification: Notification) {
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Autoconsent/autoconsent-bundle.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR
return emailManager
}()

lazy var featureFlagger = NSApp.delegateTyped.featureFlagger

lazy var vaultManager: SecureVaultManager = {
let manager = SecureVaultManager(passwordManager: PasswordManagerCoordinator.shared,
includePartialAccountMatches: true,
shouldAllowPartialFormSaves: featureFlagger.isFeatureOn(.autofillPartialFormSaves),
tld: ContentBlocking.shared.tld)
manager.delegate = self
return manager
Expand Down
19 changes: 18 additions & 1 deletion DuckDuckGo/Bookmarks/Model/BookmarkList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ struct BookmarkList {

private(set) var allBookmarkURLsOrdered: [IdentifiableBookmark]
private var favoriteBookmarksOrdered: [IdentifiableBookmark]
private var itemsDict: [String: [Bookmark]]
private var itemsDict: [String: [Bookmark]] {
didSet {
updateLowercasedItemsDict()
}
}

// Copy of itemsDict used for efficient lookups of variant URLs
private(set) var lowercasedItemsDict: [String: [Bookmark]] = [:]

var totalBookmarks: Int {
return allBookmarkURLsOrdered.count
Expand Down Expand Up @@ -76,6 +83,7 @@ struct BookmarkList {
self.allBookmarkURLsOrdered = keysOrdered
self.itemsDict = itemsDict
self.topLevelEntities = topLevelEntities
updateLowercasedItemsDict()
}

mutating func insert(_ bookmark: Bookmark) {
Expand Down Expand Up @@ -149,6 +157,15 @@ struct BookmarkList {
return allBookmarkURLsOrdered
}

private mutating func updateLowercasedItemsDict() {
lowercasedItemsDict = itemsDict.reduce(into: [:]) { result, entry in
let lowercasedKey = entry.key.lowercased()
if result[lowercasedKey] == nil {
result[lowercasedKey] = entry.value
}
}
}

}

private extension BookmarkList {
Expand Down
12 changes: 6 additions & 6 deletions DuckDuckGo/Bookmarks/Model/BookmarkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,16 @@ final class LocalBookmarkManager: BookmarkManager {

/// Finds a bookmark by checking all possible URL variants (http/https, trailing slash).
private func findBookmark(forVariantUrl url: URL) -> Bookmark? {
let urlVariants = url.bookmarkButtonUrlVariants()
guard let list = list else {
return nil
}

for variant in urlVariants {
if let bookmark = getBookmark(for: variant) {
for variant in url.bookmarkButtonUrlVariants() {
let variantString = variant.absoluteString
if let bookmark = list.lowercasedItemsDict[variantString]?.first {
return bookmark
}
}

return nil
}

Expand All @@ -202,8 +204,6 @@ final class LocalBookmarkManager: BookmarkManager {
}

@discardableResult func makeBookmark(for url: URL, title: String, isFavorite: Bool, index: Int? = nil, parent: BookmarkFolder? = nil) -> Bookmark? {
assert(url.absoluteString.lowercased() == url.absoluteString)

guard list != nil else { return nil }

guard !isUrlBookmarked(url: url) else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ final class AddEditBookmarkDialogViewModel: BookmarkDialogEditing {
}

func addOrSave(dismiss: () -> Void) {
guard let url = bookmarkURLPath.lowercased().url else {
guard let url = bookmarkURLPath.url else {
assertionFailure("Invalid URL, default action button should be disabled.")
return
}
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/BookmarksBar/View/BookmarksBarMenuPopover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ extension BookmarksBarMenuPopover: BookmarksBarMenuViewControllerDelegate {
}

func popover(shouldPreventClosure: Bool) {
var popover: BookmarksBarMenuPopover! = self
while popover != nil {
var window = contentViewController?.view.window
while let popover = window?.contentViewController?.nextResponder as? Self {
popover.behavior = shouldPreventClosure ? .applicationDefined : .transient
popover = mainWindow?.contentViewController?.nextResponder as? BookmarksBarMenuPopover
window = window?.parent
}
}

Expand Down
25 changes: 25 additions & 0 deletions DuckDuckGo/Common/Extensions/FileManagerExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ import os.log

extension FileManager {

#if !SANDBOX_TEST_TOOL
func configurationDirectory() -> URL {
let fm = FileManager.default

guard let dir = fm.containerURL(forSecurityApplicationGroupIdentifier: Bundle.main.appGroup(bundle: .appConfiguration)) else {
fatalError("Failed to get application group URL")
}
let subDir = dir.appendingPathComponent("Configuration")

var isDir: ObjCBool = false
if !fm.fileExists(atPath: subDir.path, isDirectory: &isDir) || !isDir.boolValue {
if !isDir.boolValue {
try? fm.removeItem(at: subDir)
}
do {
try fm.createDirectory(at: subDir, withIntermediateDirectories: true, attributes: nil)
isDir = true
} catch {
fatalError("Failed to create directory at \(subDir.path)")
}
}
return subDir
}
#endif

@discardableResult
func moveItem(at srcURL: URL, to destURL: URL, incrementingIndexIfExists flag: Bool, pathExtension: String? = nil) throws -> URL {
guard srcURL != destURL else { return destURL }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import AppKit
import Utilities

typealias NSAttributedStringBuilder = ArrayBuilder<NSAttributedString>
extension NSAttributedString {
Expand Down
86 changes: 0 additions & 86 deletions DuckDuckGo/Common/Extensions/NSMenuItemExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,6 @@ extension NSMenuItem {
return item
}

convenience init(title string: String, action selector: Selector? = nil, target: AnyObject? = nil, keyEquivalent: NSEvent.KeyEquivalent = [], representedObject: Any? = nil, state: NSControl.StateValue = .off, items: [NSMenuItem]? = nil) {
self.init(title: string, action: selector, keyEquivalent: keyEquivalent.charCode)
if !keyEquivalent.modifierMask.isEmpty {
self.keyEquivalentModifierMask = keyEquivalent.modifierMask
}
self.target = target
self.representedObject = representedObject
self.state = state

if let items {
self.submenu = NSMenu(title: title, items: items)
}
}

convenience init(title string: String, action selector: Selector? = nil, target: AnyObject? = nil, keyEquivalent: NSEvent.KeyEquivalent = [], representedObject: Any? = nil, state: NSControl.StateValue = .off, @MenuBuilder items: () -> [NSMenuItem]) {
self.init(title: string, action: selector, target: target, keyEquivalent: keyEquivalent, representedObject: representedObject, state: state, items: items())
}

convenience init(action selector: Selector?) {
self.init()
self.action = selector
}

convenience init(bookmarkViewModel: BookmarkViewModel) {
self.init()

Expand All @@ -65,67 +42,4 @@ extension NSMenuItem {
representedObject = bookmarkViewModels
action = #selector(MainViewController.openAllInTabs(_:))
}

convenience init(title: String) {
self.init(title: title, action: nil, keyEquivalent: "")
}

var topMenu: NSMenu? {
var menuItem = self
while let parent = menuItem.parent {
menuItem = parent
}

return menuItem.menu
}

func removeFromParent() {
parent?.submenu?.removeItem(self)
}

@discardableResult
func alternate() -> NSMenuItem {
self.isAlternate = true
return self
}

@discardableResult
func hidden() -> NSMenuItem {
self.isHidden = true
if !keyEquivalent.isEmpty {
self.allowsKeyEquivalentWhenHidden = true
}
return self
}

@discardableResult
func submenu(_ submenu: NSMenu) -> NSMenuItem {
self.submenu = submenu
return self
}

@discardableResult
func withImage(_ image: NSImage?) -> NSMenuItem {
self.image = image
return self
}

@discardableResult
func targetting(_ target: AnyObject) -> NSMenuItem {
self.target = target
return self
}

@discardableResult
func withSubmenu(_ submenu: NSMenu) -> NSMenuItem {
self.submenu = submenu
return self
}

@discardableResult
func withModifierMask(_ mask: NSEvent.ModifierFlags) -> NSMenuItem {
self.keyEquivalentModifierMask = mask
return self
}

}
Loading

0 comments on commit dde59d6

Please sign in to comment.