Skip to content

Commit

Permalink
Email Manager keychain error reporting (#662)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1202679436624547/f
Tech Design URL:
CC:

Description:

This PR is the macOS equivalent of duckduckgo/BrowserServicesKit#123.

Steps to test this PR:

See the BSK PR for testing steps
The one difference is that you will have to turn Pixel logging on in Logging.swift
  • Loading branch information
samsymons authored Jul 29, 2022
1 parent 3811d69 commit a182c96
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5988,7 +5988,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 18.0.5;
version = 19.0.0;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
13 changes: 13 additions & 0 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR
}.resume()
}
// swiftlint:enable function_parameter_count

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)
}

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

private enum Constants {
static let minWidth: CGFloat = 315
Expand Down
13 changes: 13 additions & 0 deletions DuckDuckGo/Email/EmailManagerRequestDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,18 @@ extension EmailManagerRequestDelegate {
}.resume()
}
// swiftlint:enable function_parameter_count

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)
}

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

}
2 changes: 2 additions & 0 deletions DuckDuckGo/Statistics/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ extension Pixel {
case feedbackReportingFailed = "feedback_reporting_failed"

case blankNavigationOnBurnFailed = "blank_navigation_on_burn_failed"

case emailAutofillKeychainError = "email_autofill_keychain_error"
}

}
Expand Down

0 comments on commit a182c96

Please sign in to comment.