Skip to content

Commit

Permalink
Merge branch 'release/0.28.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Sep 30, 2022
2 parents 7f10ff3 + a7611eb commit 6e9f63e
Show file tree
Hide file tree
Showing 30 changed files with 1,589 additions and 225 deletions.
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MARKETING_VERSION = 0.28.9
MARKETING_VERSION = 0.28.11

68 changes: 38 additions & 30 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DuckDuckGo/App Delegate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
PrivacyFeatures.httpsUpgrade.loadDataAsync()
LocalBookmarkManager.shared.loadBookmarks()
FaviconManager.shared.loadFavicons()
_ = ConfigurationManager.shared
ConfigurationManager.shared.start()
_ = DownloadListCoordinator.shared
_ = RecentlyClosedCoordinator.shared

Expand Down
25 changes: 18 additions & 7 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,25 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR

public func emailManagerKeychainAccessFailed(accessType: EmailKeychainAccessType, error: EmailKeychainAccessError) {
var parameters = [
"access_type": accessType.rawValue,
"error": error.errorDescription
]

if case let .keychainAccessFailure(status) = error {
parameters["keychain_status"] = String(status)
}
"access_type": accessType.rawValue,
"error": error.errorDescription
]

if case let .keychainLookupFailure(status) = error {
parameters["keychain_status"] = String(status)
parameters["keychain_operation"] = "lookup"
}

if case let .keychainDeleteFailure(status) = error {
parameters["keychain_status"] = String(status)
parameters["keychain_operation"] = "delete"
}

if case let .keychainSaveFailure(status) = error {
parameters["keychain_status"] = String(status)
parameters["keychain_operation"] = "save"
}

Pixel.fire(.debug(event: .emailAutofillKeychainError), withAdditionalParameters: parameters)
}

Expand Down
8 changes: 8 additions & 0 deletions DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ final class BookmarkListViewController: NSViewController {
@IBOutlet var emptyState: NSView!
@IBOutlet var emptyStateTitle: NSTextField!
@IBOutlet var emptyStateMessage: NSTextField!

@IBOutlet var newBookmarkButton: NSButton!
@IBOutlet var newFolderButton: NSButton!
@IBOutlet var manageBookmarksButton: NSButton!

private var cancellables = Set<AnyCancellable>()
private var bookmarkManager: BookmarkManager = LocalBookmarkManager.shared
Expand Down Expand Up @@ -91,6 +95,10 @@ final class BookmarkListViewController: NSViewController {

emptyStateTitle.attributedStringValue = NSAttributedString.make(emptyStateTitle.stringValue, lineHeight: 1.14, kern: -0.23)
emptyStateMessage.attributedStringValue = NSAttributedString.make(emptyStateMessage.stringValue, lineHeight: 1.05, kern: -0.08)

newBookmarkButton.toolTip = UserText.newBookmarkTooltip
newFolderButton.toolTip = UserText.newFolderTooltip
manageBookmarksButton.toolTip = UserText.manageBookmarksTooltip
}

override func viewWillAppear() {
Expand Down
195 changes: 109 additions & 86 deletions DuckDuckGo/Bookmarks/View/Bookmarks.storyboard

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions DuckDuckGo/Browser Tab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ final class Tab: NSObject, Identifiable, ObservableObject {

if !didRestore {
if url.isFileURL {
webView.loadFileURL(url, allowingReadAccessTo: URL(fileURLWithPath: "/"))
_ = webView.loadFileURL(url, allowingReadAccessTo: URL(fileURLWithPath: "/"))
} else {
webView.load(url)
}
Expand Down Expand Up @@ -573,7 +573,7 @@ final class Tab: NSObject, Identifiable, ObservableObject {
var didRestore: Bool = false
if let sessionStateData = self.sessionStateData {
if contentURL.isFileURL {
webView.loadFileURL(contentURL, allowingReadAccessTo: URL(fileURLWithPath: "/"))
_ = webView.loadFileURL(contentURL, allowingReadAccessTo: URL(fileURLWithPath: "/"))
}
do {
try webView.restoreSessionState(from: sessionStateData)
Expand All @@ -592,7 +592,7 @@ final class Tab: NSObject, Identifiable, ObservableObject {
var didRestore: Bool = false
if let interactionStateData = self.interactionStateData {
if contentURL.isFileURL {
webView.loadFileURL(contentURL, allowingReadAccessTo: URL(fileURLWithPath: "/"))
_ = webView.loadFileURL(contentURL, allowingReadAccessTo: URL(fileURLWithPath: "/"))
}

webView.interactionState = interactionStateData
Expand All @@ -602,7 +602,6 @@ final class Tab: NSObject, Identifiable, ObservableObject {
return didRestore
}

@MainActor
private func addHomePageToWebViewIfNeeded() {
guard !AppDelegate.isRunningTests else { return }
if content == .homePage && webView.url == nil {
Expand Down Expand Up @@ -636,17 +635,17 @@ final class Tab: NSObject, Identifiable, ObservableObject {
superviewObserver = webView.observe(\.superview, options: .old) { [weak self] _, change in
// if the webView is being added to superview - reload if needed
if case .some(.none) = change.oldValue {
Task { [weak self] in
Task { @MainActor [weak self] in
await self?.reloadIfNeeded()
}
}
}

// background tab loading should start immediately
Task {
Task { @MainActor in
await reloadIfNeeded(shouldLoadInBackground: shouldLoadInBackground)
if !shouldLoadInBackground {
await addHomePageToWebViewIfNeeded()
addHomePageToWebViewIfNeeded()
}
}
}
Expand Down Expand Up @@ -1144,7 +1143,7 @@ extension Tab: WKNavigationDelegate {
if let newRequest = referrerTrimming.trimReferrer(forNavigation: navigationAction,
originUrl: webView.url ?? navigationAction.sourceFrame.webView?.url) {
defer {
webView.load(newRequest)
_ = webView.load(newRequest)
}
return .cancel
}
Expand All @@ -1164,7 +1163,7 @@ extension Tab: WKNavigationDelegate {
let request = GPCRequestFactory.shared.requestForGPC(basedOn: navigationAction.request) {
self.invalidateBackItemIfNeeded(for: navigationAction)
defer {
webView.load(request)
_ = webView.load(request)
}
return .cancel
}
Expand Down Expand Up @@ -1429,6 +1428,10 @@ extension Tab: WKNavigationDelegate {
guard frame.isMainFrame else { return }
self.mainFrameLoadState = .finished
}

func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
Pixel.fire(.debug(event: .webKitDidTerminate))
}

}
// universal download event handlers for Legacy _WKDownload and modern WKDownload
Expand Down
26 changes: 25 additions & 1 deletion DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,29 @@ struct UserText {
static let bookmarksBarContextMenuCopy = NSLocalizedString("bookmarks.bar.context-menu.copy", value: "Copy", comment: "Copy menu item for the bookmarks bar context menu")
static let bookmarksBarContextMenuDelete = NSLocalizedString("bookmarks.bar.context-menu.delete", value: "Delete", comment: "Delete menu item for the bookmarks bar context menu")
static let bookmarksBarContextMenuMoveToEnd = NSLocalizedString("bookmarks.bar.context-menu.move-to-end", value: "Move to End", comment: "Move to End menu item for the bookmarks bar context menu")


static let showAutofillShortcut = NSLocalizedString("pinning.show-autofill-shortcut", value: "Show Autofill Shortcut", comment: "Menu item for showing the autofill shortcut")
static let hideAutofillShortcut = NSLocalizedString("pinning.hide-autofill-shortcut", value: "Hide Autofill Shortcut", comment: "Menu item for hiding the autofill shortcut")

static let showBookmarksShortcut = NSLocalizedString("pinning.show-bookmarks-shortcut", value: "Show Bookmarks Shortcut", comment: "Menu item for showing the bookmarks shortcut")
static let hideBookmarksShortcut = NSLocalizedString("pinning.hide-bookmarks-shortcut", value: "Hide Bookmarks Shortcut", comment: "Menu item for hiding the bookmarks shortcut")

static let showDownloadsShortcut = NSLocalizedString("pinning.show-downloads-shortcut", value: "Show Downloads Shortcut", comment: "Menu item for showing the downloads shortcut")
static let hideDownloadsShortcut = NSLocalizedString("pinning.hide-downloads-shortcut", value: "Hide Downloads Shortcut", comment: "Menu item for hiding the downloads shortcut")

// MARK: - Tooltips

static let autofillShortcutTooltip = NSLocalizedString("tooltip.autofill.shortcut", value: "Autofill", comment: "Tooltip for the autofill shortcut")
static let bookmarksShortcutTooltip = NSLocalizedString("tooltip.bookmarks.shortcut", value: "Bookmarks", comment: "Tooltip for the bookmarks shortcut")
static let downloadsShortcutTooltip = NSLocalizedString("tooltip.downloads.shortcut", value: "Downloads", comment: "Tooltip for the downloads shortcut")

static let addItemTooltip = NSLocalizedString("tooltip.autofill.add-item", value: "Add item", comment: "Tooltip for the Add Item button")
static let moreOptionsTooltip = NSLocalizedString("tooltip.autofill.more-options", value: "More options", comment: "Tooltip for the More Options button")

static let newBookmarkTooltip = NSLocalizedString("tooltip.bookmarks.new-bookmark", value: "New bookmark", comment: "Tooltip for the New Bookmark button")
static let newFolderTooltip = NSLocalizedString("tooltip.bookmarks.new-folder", value: "New folder", comment: "Tooltip for the New Folder button")
static let manageBookmarksTooltip = NSLocalizedString("tooltip.bookmarks.manage-bookmarks", value: "Manage bookmarks", comment: "Tooltip for the Manage Bookmarks button")

static let openDownloadsFolderTooltip = NSLocalizedString("tooltip.downloads.open-downloads-folder", value: "Open downloads folder", comment: "Tooltip for the Open Downloads Folder button")
static let clearDownloadHistoryTooltip = NSLocalizedString("tooltip.downloads.clear-download-history", value: "Clear download history", comment: "Tooltip for the Clear Downloads button")
}
4 changes: 2 additions & 2 deletions DuckDuckGo/Common/Utilities/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ struct Logging {
fileprivate static let autoconsentLoggingEnabled = false
fileprivate static let autoconsentLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Autoconsent")

fileprivate static let bookmarksLoggingEnabled = true
fileprivate static let bookmarksLoggingEnabled = false
fileprivate static let bookmarksLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Bookmarks")

fileprivate static let attributionLoggingEnabled = true
fileprivate static let attributionLoggingEnabled = false
fileprivate static let attributionLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Ad Attribution")

}
2 changes: 2 additions & 0 deletions DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public struct UserDefaultsWrapper<T> {
case historyV5toV6Migration = "history.v5.to.v6.migration.2"

case showBookmarksBar = "bookmarks.bar.show"

case pinnedViews = "pinning.pinned-views"
}

enum RemovedKeys: String, CaseIterable {
Expand Down
11 changes: 10 additions & 1 deletion DuckDuckGo/Common/View/AppKit/MouseOverButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ internal class MouseOverButton: NSButton {

let backgroundLayer = CALayer()

@IBInspectable var backgroundColor: NSColor? {
didSet {
updateLayer()
}
}

@IBInspectable var mouseOverColor: NSColor? {
didSet {
updateLayer()
}
}

@IBInspectable var mouseDownColor: NSColor? {
didSet {
updateLayer()
Expand All @@ -38,11 +45,13 @@ internal class MouseOverButton: NSButton {
updateTintColor()
}
}

@IBInspectable var mouseOverTintColor: NSColor? {
didSet {
updateTintColor()
}
}

@IBInspectable var mouseDownTintColor: NSColor? {
didSet {
updateTintColor()
Expand Down Expand Up @@ -162,7 +171,7 @@ internal class MouseOverButton: NSButton {
context.duration = 0.0
backgroundLayer.backgroundColor = mouseOverColor?.cgColor ?? NSColor.clear.cgColor
} else {
backgroundLayer.backgroundColor = NSColor.clear.cgColor
backgroundLayer.backgroundColor = backgroundColor?.cgColor ?? NSColor.clear.cgColor
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions DuckDuckGo/Configuration/ConfigurationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ final class ConfigurationManager {
/// Use the shared instance if subscribing to events. Only use the constructor for testing.
init(configDownloader: ConfigurationDownloading = DefaultConfigurationDownloader(deliveryQueue: ConfigurationManager.queue)) {
self.configDownloader = configDownloader
}

func start() {
os_log("Starting configuration refresh timer", log: .config, type: .debug)
timerCancellable = Timer.publish(every: Constants.refreshCheckIntervalSeconds, on: .main, in: .default)
.autoconnect()
Expand All @@ -68,6 +70,7 @@ final class ConfigurationManager {
self.lastRefreshCheckTime = Date()
self.refreshIfNeeded()
})
refreshNow()
}

func log() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import BrowserServicesKit
final class AppPrivacyConfigurationDataProvider: EmbeddedDataProvider {

public struct Constants {
public static let embeddedDataETag = "\"9b7e105f7bb52ffa587fbc4a511c87d7\""
public static let embeddedDataSHA = "a3be27bc9dafcac3d696bf6783b825745b0c7b00c0f4552d6ac51be0f8a3916e"
public static let embeddedDataETag = "\"b5e8cb8241fd4d8d2873a3b7d008c812\""
public static let embeddedDataSHA = "001d9cd4e3facaac879a401a1f126dbe7a0a40825dec0004e4e7d7ec6c60d516"
}

var embeddedDataEtag: String {
Expand Down
Loading

0 comments on commit 6e9f63e

Please sign in to comment.