Skip to content

Commit

Permalink
Rename SecureVaultErrorReporter -> SecureVaultReporter, update refere…
Browse files Browse the repository at this point in the history
…nces
  • Loading branch information
aataraxiaa committed Apr 17, 2024
1 parent a89262d commit 077969e
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 28 deletions.
16 changes: 8 additions & 8 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
3706FC73293F65D500E42796 /* AddressBarButtonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC5E4F525D6BF2C007F5990 /* AddressBarButtonsViewController.swift */; };
3706FC76293F65D500E42796 /* PixelDataRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = B68C92C32750EF76002AC6B0 /* PixelDataRecord.swift */; };
3706FC77293F65D500E42796 /* PageObserverUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 853014D525E671A000FB8205 /* PageObserverUserScript.swift */; };
3706FC78293F65D500E42796 /* SecureVaultErrorReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultErrorReporter.swift */; };
3706FC78293F65D500E42796 /* SecureVaultReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultReporter.swift */; };
3706FC79293F65D500E42796 /* NSImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B139AFC26B60BD800894F82 /* NSImageExtensions.swift */; };
3706FC7B293F65D500E42796 /* PasswordManagementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85625995269C953C00EE44BC /* PasswordManagementViewController.swift */; };
3706FC7C293F65D500E42796 /* ImportedBookmarks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB99CFA26FE191E001E4761 /* ImportedBookmarks.swift */; };
Expand Down Expand Up @@ -1891,7 +1891,7 @@
4B957B982AC7AE700062CA31 /* BWError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DDF076028F815AD00EDFBE3 /* BWError.swift */; };
4B957B9A2AC7AE700062CA31 /* PixelDataRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = B68C92C32750EF76002AC6B0 /* PixelDataRecord.swift */; };
4B957B9B2AC7AE700062CA31 /* PageObserverUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 853014D525E671A000FB8205 /* PageObserverUserScript.swift */; };
4B957B9C2AC7AE700062CA31 /* SecureVaultErrorReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultErrorReporter.swift */; };
4B957B9C2AC7AE700062CA31 /* SecureVaultReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultReporter.swift */; };
4B957B9D2AC7AE700062CA31 /* NSImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B139AFC26B60BD800894F82 /* NSImageExtensions.swift */; };
4B957B9E2AC7AE700062CA31 /* WaitlistKeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9DB00F2A983B24000927DB /* WaitlistKeychainStorage.swift */; };
4B957B9F2AC7AE700062CA31 /* PasswordManagementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85625995269C953C00EE44BC /* PasswordManagementViewController.swift */; };
Expand Down Expand Up @@ -2860,7 +2860,7 @@
B63ED0E026AFE32F00A9DAD1 /* GeolocationProviderMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B63ED0DF26AFE32F00A9DAD1 /* GeolocationProviderMock.swift */; };
B63ED0E326B3E7FA00A9DAD1 /* CLLocationManagerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B63ED0E226B3E7FA00A9DAD1 /* CLLocationManagerMock.swift */; };
B63ED0E526BB8FB900A9DAD1 /* SharingMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = B63ED0E426BB8FB900A9DAD1 /* SharingMenu.swift */; };
B642738227B65BAC0005DFD1 /* SecureVaultErrorReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultErrorReporter.swift */; };
B642738227B65BAC0005DFD1 /* SecureVaultReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B642738127B65BAC0005DFD1 /* SecureVaultReporter.swift */; };
B643BF1427ABF772000BACEC /* NSWorkspaceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B643BF1327ABF772000BACEC /* NSWorkspaceExtension.swift */; };
B644B43D29D56829003FA9AB /* SearchNonexistentDomainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B644B43929D565DB003FA9AB /* SearchNonexistentDomainTests.swift */; };
B644B43E29D5682B003FA9AB /* SearchNonexistentDomainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B644B43929D565DB003FA9AB /* SearchNonexistentDomainTests.swift */; };
Expand Down Expand Up @@ -4543,7 +4543,7 @@
B63ED0DF26AFE32F00A9DAD1 /* GeolocationProviderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeolocationProviderMock.swift; sourceTree = "<group>"; };
B63ED0E226B3E7FA00A9DAD1 /* CLLocationManagerMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CLLocationManagerMock.swift; sourceTree = "<group>"; };
B63ED0E426BB8FB900A9DAD1 /* SharingMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingMenu.swift; sourceTree = "<group>"; };
B642738127B65BAC0005DFD1 /* SecureVaultErrorReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureVaultErrorReporter.swift; sourceTree = "<group>"; };
B642738127B65BAC0005DFD1 /* SecureVaultReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureVaultReporter.swift; sourceTree = "<group>"; };
B643BF1327ABF772000BACEC /* NSWorkspaceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSWorkspaceExtension.swift; sourceTree = "<group>"; };
B644B43929D565DB003FA9AB /* SearchNonexistentDomainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchNonexistentDomainTests.swift; sourceTree = "<group>"; };
B645D8F529FA95440024461F /* WKProcessPoolExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WKProcessPoolExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6843,7 +6843,7 @@
85CC1D7826A05E790062F04E /* Model */,
85CC1D7F26A05F6C0062F04E /* Services */,
85CC1D7926A05E820062F04E /* View */,
B642738127B65BAC0005DFD1 /* SecureVaultErrorReporter.swift */,
B642738127B65BAC0005DFD1 /* SecureVaultReporter.swift */,
);
path = SecureVault;
sourceTree = "<group>";
Expand Down Expand Up @@ -11031,7 +11031,7 @@
C1372EF52BBC5BAD003F8793 /* SecureTextField.swift in Sources */,
3706FC77293F65D500E42796 /* PageObserverUserScript.swift in Sources */,
4BF0E5132AD25A2600FFEC9E /* DuckDuckGoUserAgent.swift in Sources */,
3706FC78293F65D500E42796 /* SecureVaultErrorReporter.swift in Sources */,
3706FC78293F65D500E42796 /* SecureVaultReporter.swift in Sources */,
3706FC79293F65D500E42796 /* NSImageExtensions.swift in Sources */,
3706FEBD293F6EFF00E42796 /* BWCommand.swift in Sources */,
3706FC7B293F65D500E42796 /* PasswordManagementViewController.swift in Sources */,
Expand Down Expand Up @@ -12278,7 +12278,7 @@
4B957B982AC7AE700062CA31 /* BWError.swift in Sources */,
4B957B9A2AC7AE700062CA31 /* PixelDataRecord.swift in Sources */,
4B957B9B2AC7AE700062CA31 /* PageObserverUserScript.swift in Sources */,
4B957B9C2AC7AE700062CA31 /* SecureVaultErrorReporter.swift in Sources */,
4B957B9C2AC7AE700062CA31 /* SecureVaultReporter.swift in Sources */,
4B68DDFF2ACBA14100FB0973 /* FileLineError.swift in Sources */,
4B957B9D2AC7AE700062CA31 /* NSImageExtensions.swift in Sources */,
4B957B9E2AC7AE700062CA31 /* WaitlistKeychainStorage.swift in Sources */,
Expand Down Expand Up @@ -13121,7 +13121,7 @@
B68C92C42750EF76002AC6B0 /* PixelDataRecord.swift in Sources */,
853014D625E671A000FB8205 /* PageObserverUserScript.swift in Sources */,
B677FC4F2B06376B0099EB04 /* ReportFeedbackView.swift in Sources */,
B642738227B65BAC0005DFD1 /* SecureVaultErrorReporter.swift in Sources */,
B642738227B65BAC0005DFD1 /* SecureVaultReporter.swift in Sources */,
4B139AFD26B60BD800894F82 /* NSImageExtensions.swift in Sources */,
B62B48392ADE46FC000DECE5 /* Application.swift in Sources */,
4B9DB02C2A983B24000927DB /* WaitlistKeychainStorage.swift in Sources */,
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(reporter: 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
2 changes: 1 addition & 1 deletion DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
}

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

public func secureVaultManager(_: BrowserServicesKit.SecureVaultManager, didReceivePixel pixel: AutofillUserScript.JSPixel) {
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(reporter: 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(reporter: 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 @@ -30,7 +30,7 @@ final class BookmarksAndPasswordsImportStatusProvider: DataImportStatusProviding
let secureVault: (any AutofillSecureVault)?
let bookmarkManager: BookmarkManager

init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared),
init(secureVault: (any AutofillSecureVault)? = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared),
bookmarkManager: BookmarkManager = LocalBookmarkManager.shared) {
self.secureVault = secureVault
self.bookmarkManager = bookmarkManager
Expand Down
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(reporter: 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 @@ -664,7 +664,7 @@ extension MainViewController {
}

@objc func resetSecureVaultData(_ sender: Any?) {
let vault = try? AutofillSecureVaultFactory.makeVault(reporter: 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 @@ -1045,7 +1045,7 @@ extension AppDelegate: NSMenuItemValidation {
}

private var areTherePasswords: Bool {
let vault = try? AutofillSecureVaultFactory.makeVault(reporter: 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 @@ -27,7 +27,7 @@ final class AutofillNeverPromptWebsitesManager {

private let secureVault: (any AutofillSecureVault)?

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

fetchNeverPromptWebsites()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// SecureVaultErrorReporter.swift
// SecureVaultReporter.swift
//
// Copyright © 2022 DuckDuckGo. All rights reserved.
//
Expand All @@ -20,8 +20,8 @@ import Foundation
import BrowserServicesKit
import SecureStorage

final class SecureVaultErrorReporter: SecureVaultReporting {
static let shared = SecureVaultErrorReporter()
final class SecureVaultReporter: SecureVaultReporting {
static let shared = SecureVaultReporter()
private init() {}

func secureVaultError(_ error: SecureStorageError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ final class PasswordManagementViewController: NSViewController {
}

var secureVault: (any AutofillSecureVault)? {
try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared)
try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared)
}

private let passwordManagerCoordinator: PasswordManagerCoordinating = PasswordManagerCoordinator.shared
Expand Down Expand Up @@ -1073,7 +1073,7 @@ extension PasswordManagementViewController: NSMenuItemValidation {
}

private var haveDuckDuckGoPasswords: Bool {
guard let vault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared) else { return false }
guard let vault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared) else { return false }
let accounts = (try? vault.accounts()) ?? []
return !accounts.isEmpty
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ final class SaveCredentialsViewController: NSViewController {
}
}
} else {
_ = try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared).storeWebsiteCredentials(credentials)
_ = try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared).storeWebsiteCredentials(credentials)
NSApp.delegateTyped.syncService?.scheduler.notifyDataChanged()
os_log(.debug, log: OSLog.sync, "Requesting sync if enabled")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class SaveIdentityViewController: NSViewController {
identity.title = UserText.pmDefaultIdentityAutofillTitle

do {
try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared).storeIdentity(identity)
try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared).storeIdentity(identity)
Pixel.fire(.autofillItemSaved(kind: .identity))
} catch {
os_log("%s:%s: failed to store identity %s", type: .error, className, #function, error.localizedDescription)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ final class SavePaymentMethodViewController: NSViewController {
paymentMethod.title = CreditCardValidation.type(for: paymentMethod.cardNumber).displayName

do {
try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultErrorReporter.shared).storeCreditCard(paymentMethod)
try AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared).storeCreditCard(paymentMethod)
} catch {
os_log("%s:%s: failed to store payment method %s", type: .error, className, #function, error.localizedDescription)
Pixel.fire(.debug(event: .secureVaultError, error: error))
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/Sync/SyncCredentialsAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class SyncCredentialsAdapter {
syncDidCompletePublisher = syncDidCompleteSubject.eraseToAnyPublisher()
databaseCleaner = CredentialsDatabaseCleaner(
secureVaultFactory: secureVaultFactory,
secureVaultErrorReporter: SecureVaultErrorReporter.shared,
secureVaultErrorReporter: SecureVaultReporter.shared,
errorEvents: CredentialsCleanupErrorHandling(),
log: .passwordManager
)
Expand All @@ -70,7 +70,7 @@ final class SyncCredentialsAdapter {
do {
let provider = try CredentialsProvider(
secureVaultFactory: secureVaultFactory,
secureVaultErrorReporter: SecureVaultErrorReporter.shared,
secureVaultErrorReporter: SecureVaultReporter.shared,
metadataStore: metadataStore,
metricsEvents: metricsEventsHandler,
log: OSLog.sync,
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Tab/TabExtensions/AutofillTabExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extension AutofillTabExtension: SecureVaultManagerDelegate {
}

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

public func secureVaultManager(_: BrowserServicesKit.SecureVaultManager, didReceivePixel pixel: AutofillUserScript.JSPixel) {
Expand Down

0 comments on commit 077969e

Please sign in to comment.