Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBP interrupt fixes for internal release #2695

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
390 changes: 182 additions & 208 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" : "b8f0e5db431c63943b509d522c157f870ef03ae0",
"version" : "138.0.0"
"revision" : "1c2e84e6cd4543e9104aff753e48b146eeb36007",
"version" : "139.0.0"
}
},
{
Expand Down Expand Up @@ -120,7 +120,7 @@
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "46989693916f56d1186bd59ac15124caef896560",
"version" : "1.3.1"
Expand All @@ -138,7 +138,7 @@
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,6 @@
ReferencedContainer = "container:LocalPackages/SyncUI">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "PixelKitTests"
BuildableName = "PixelKitTests"
BlueprintName = "PixelKitTests"
ReferencedContainer = "container:LocalPackages/PixelKit">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
Expand All @@ -177,16 +167,6 @@
ReferencedContainer = "container:LocalPackages/NetworkProtectionMac">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "NetworkProtectionTests"
BuildableName = "NetworkProtectionTests"
BlueprintName = "NetworkProtectionTests"
ReferencedContainer = "container:../BrowserServicesKit">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,6 @@
ReferencedContainer = "container:LocalPackages/NetworkProtectionMac">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "PixelKitTests"
BuildableName = "PixelKitTests"
BlueprintName = "PixelKitTests"
ReferencedContainer = "container:LocalPackages/PixelKit">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
Expand All @@ -208,16 +198,6 @@
ReferencedContainer = "container:LocalPackages/DataBrokerProtection">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "NetworkProtectionTests"
BuildableName = "NetworkProtectionTests"
BlueprintName = "NetworkProtectionTests"
ReferencedContainer = "container:../BrowserServicesKit">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Autofill/AutofillActionBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension AutofillActionBuilder {
struct AutofillDeleteAllPasswordsBuilder: AutofillActionBuilder {
@MainActor
func buildExecutor() -> AutofillActionExecutor? {
guard let secureVault = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared),
guard let secureVault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared),
let syncService = NSApp.delegateTyped.syncService else { return nil }

return AutofillDeleteAllPasswordsExecutor(userAuthenticator: DeviceAuthenticator.shared,
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
}
}

public func secureVaultInitFailed(_ error: SecureStorageError) {
SecureVaultErrorReporter.shared.secureVaultInitFailed(error)
public func secureVaultError(_ error: SecureStorageError) {
SecureVaultReporter.shared.secureVaultError(error)
}

public func secureVaultManager(_: BrowserServicesKit.SecureVaultManager, didReceivePixel pixel: AutofillUserScript.JSPixel) {
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ struct UserText {
static let addFolder = NSLocalizedString("menu.add.folder", value: "Add Folder…", comment: "Menu item to add a folder")

static let tabHomeTitle = NSLocalizedString("tab.home.title", value: "New Tab", comment: "Tab home title")
static let tabUntitledTitle = NSLocalizedString("tab.empty.title", value: "Untitled", comment: "Title for an empty tab without a title")
static let tabPreferencesTitle = NSLocalizedString("tab.preferences.title", value: "Settings", comment: "Tab preferences title")
static let tabBookmarksTitle = NSLocalizedString("tab.bookmarks.title", value: "Bookmarks", comment: "Tab bookmarks title")
static let tabOnboardingTitle = NSLocalizedString("tab.onboarding.title", value: "Welcome", comment: "Tab onboarding title")
Expand Down
14 changes: 13 additions & 1 deletion DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
private let customURLLabelMenuItem = NSMenuItem(title: "")

private let environmentMenu = NSMenu()
private let statusMenuIconMenu = NSMenuItem(title: "Show Status Menu Icon", action: #selector(DataBrokerProtectionDebugMenu.toggleShowStatusMenuItem))

private let webUISettings = DataBrokerProtectionWebUIURLSettings(.dbp)
private let settings = DataBrokerProtectionSettings(defaults: .dbp)
Expand Down Expand Up @@ -147,6 +148,8 @@ final class DataBrokerProtectionDebugMenu: NSMenu {

NSMenuItem.separator()

statusMenuIconMenu.targetting(self)

NSMenuItem(title: "Show DB Browser", action: #selector(DataBrokerProtectionDebugMenu.showDatabaseBrowser))
.targetting(self)
NSMenuItem(title: "Force Profile Removal", action: #selector(DataBrokerProtectionDebugMenu.showForceOptOutWindow))
Expand All @@ -172,6 +175,7 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
updateWaitlistItems()
updateWebUIMenuItemsState()
updateEnvironmentMenu()
updateShowStatusMenuIconMenu()
}

// MARK: - Menu functions
Expand Down Expand Up @@ -223,7 +227,7 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
os_log("Running scan operations...", log: .dataBrokerProtection)
let showWebView = sender.representedObject as? Bool ?? false

DataBrokerProtectionManager.shared.scheduler.scanAllBrokers(showWebView: showWebView) { errors in
DataBrokerProtectionManager.shared.scheduler.startManualScan(showWebView: showWebView) { errors in
if let errors = errors {
if let oneTimeError = errors.oneTimeError {
os_log("scan operations finished, error: %{public}@", log: .dataBrokerProtection, oneTimeError.localizedDescription)
Expand Down Expand Up @@ -366,6 +370,10 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
}
}

@objc private func toggleShowStatusMenuItem() {
settings.showInMenuBar.toggle()
}

@objc func setSelectedEnvironment(_ menuItem: NSMenuItem) {
let title = menuItem.title
let selectedEnvironment: DataBrokerProtectionSettings.SelectedEnvironment
Expand Down Expand Up @@ -448,6 +456,10 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
environmentMenu.items.first?.state = selectedEnvironment == .production ? .on: .off
environmentMenu.items.last?.state = selectedEnvironment == .staging ? .on: .off
}

private func updateShowStatusMenuIconMenu() {
statusMenuIconMenu.state = settings.showInMenuBar ? .on : .off
}
}

extension DataBrokerProtectionDebugMenu: NSWindowDelegate {
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ extension DataBrokerProtectionLoginItemScheduler: DataBrokerProtectionScheduler
ipcScheduler.statusPublisher
}

func scanAllBrokers(showWebView: Bool,
completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) {
func startManualScan(showWebView: Bool,
completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) {
enableLoginItem()
ipcScheduler.scanAllBrokers(showWebView: showWebView, completion: completion)
ipcScheduler.startManualScan(showWebView: showWebView, completion: completion)
}

func startScheduler(showWebView: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SecureStorage
final class SecureVaultLoginImporter: LoginImporter {

func importLogins(_ logins: [ImportedLoginCredential], progressCallback: @escaping (Int) throws -> Void) throws -> DataImport.DataTypeSummary {
let vault = try AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared)
let vault = try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)

var successful: [String] = []
var duplicates: [String] = []
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Fire/Model/Fire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ final class Fire {
// MARK: - Favicons

private func autofillDomains() -> Set<String> {
guard let vault = try? secureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared),
guard let vault = try? secureVaultFactory.makeVault(reporter: SecureVaultReporter.shared),
let accounts = try? vault.accounts() else {
return []
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/HomePage/Model/DataImportStatusProviding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class BookmarksAndPasswordsImportStatusProvider: DataImportStatusProviding
let secureVault: (any AutofillSecureVault)?
let bookmarkManager: BookmarkManager

init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared),
init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared),
bookmarkManager: BookmarkManager = LocalBookmarkManager.shared) {
self.secureVault = secureVault
self.bookmarkManager = bookmarkManager
Expand Down
67 changes: 66 additions & 1 deletion DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -20060,6 +20060,7 @@
},
"Hide" : {
"comment" : "Main Menu > View > Home Button > None item\n Preferences > Home Button > None item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48009,6 +48010,7 @@
},
"Show left of the back button" : {
"comment" : "Preferences > Home Button > left position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48062,6 +48064,7 @@
},
"Show Left of the Back Button" : {
"comment" : "Main Menu > View > Home Button > left position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48327,6 +48330,7 @@
},
"Show right of the reload button" : {
"comment" : "Preferences > Home Button > right position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48380,6 +48384,7 @@
},
"Show Right of the Reload Button" : {
"comment" : "Main Menu > View > Home Button > right position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -49868,6 +49873,66 @@
}
}
},
"tab.empty.title" : {
"comment" : "Title for an empty tab without a title",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ohne Titel"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Untitled"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sin título"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sans titre"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ohne Titel"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Naamloos"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bez tytułu"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sem título"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Без названия"
}
}
}
},
"tab.error.title" : {
"comment" : "Tab error title",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -53180,4 +53245,4 @@
}
},
"version" : "1.0"
}
}
6 changes: 3 additions & 3 deletions DuckDuckGo/Menus/MainMenuActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ extension AppDelegate {
savePanel.beginSheetModal(for: window) { response in
guard response == .OK, let selectedURL = savePanel.url else { return }

let vault = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared)
let vault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)
let exporter = CSVLoginExporter(secureVault: vault!)
do {
try exporter.exportVaultLogins(to: selectedURL)
Expand Down Expand Up @@ -670,7 +670,7 @@ extension MainViewController {
}

@objc func resetSecureVaultData(_ sender: Any?) {
let vault = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared)
let vault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)

let accounts = (try? vault?.accounts()) ?? []
for accountID in accounts.compactMap(\.id) {
Expand Down Expand Up @@ -1042,7 +1042,7 @@ extension AppDelegate: NSMenuItemValidation {
}

private var areTherePasswords: Bool {
let vault = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared)
let vault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)
guard let vault else {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class AutofillNeverPromptWebsitesManager {

private let secureVault: (any AutofillSecureVault)?

public init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(errorReporter: SecureVaultErrorReporter.shared)) {
public init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)) {
self.secureVault = secureVault

fetchNeverPromptWebsites()
Expand Down
Loading
Loading