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

Autofill password generation support for iOS #1212

Merged
merged 7 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8657,8 +8657,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 57.6.0;
branch = "autofill/anya/password-generation";
kind = branch;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "b19b5e4383a7fdae5e69f1ecbf64ee8f5dbb4a55",
"version" : "57.6.0"
"branch" : "autofill/anya/password-generation",
"revision" : "35b7f5c7703a3dfcb019ef039b03bad4c7239001"
}
},
{
Expand Down
18 changes: 16 additions & 2 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
return true
}

public func secureVaultManager(_: SecureVaultManager, promptUserToStoreAutofillData data: AutofillData) {
public func secureVaultManager(_: SecureVaultManager, promptUserToStoreAutofillData data: AutofillData, hasGeneratedPassword generatedPassword: Bool, withTrigger trigger: AutofillUserScript.GetTriggerType?) {
// No-op, the content overlay view controller should not be prompting the user to store data
}

Expand All @@ -231,14 +231,24 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
// no-op on macOS
}

public func secureVaultManager(_: SecureVaultManager,
promptUserWithGeneratedPassword password: String,
completionHandler: @escaping (Bool) -> Void) {
// no-op on macOS
}

public func secureVaultManager(_: SecureVaultManager, didAutofill type: AutofillType, withObjectId objectId: String) {
Pixel.fire(.formAutofilled(kind: type.formAutofillKind))
}

public func secureVaultManagerShouldAutomaticallyUpdateCredentialsWithoutUsername(_: SecureVaultManager) -> Bool {
public func secureVaultManagerShouldAutomaticallyUpdateCredentialsWithoutUsername(_: SecureVaultManager, shouldSilentlySave: Bool) -> Bool {
return true
}

public func secureVaultManagerShouldSilentlySaveGeneratedPassword(_: SecureVaultManager) -> Bool {
return false
}

public func secureVaultManager(_: SecureVaultManager, didRequestAuthenticationWithCompletionHandler handler: @escaping (Bool) -> Void) {
DeviceAuthenticator.shared.authenticateUser(reason: .autofill) { authenticationResult in
handler(authenticationResult.authenticated)
Expand All @@ -263,6 +273,10 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
}
}

public func secureVaultManager(_: SecureVaultManager, promptUserToUseGeneratedPasswordForDomain: String, withGeneratedPassword generatedPassword: String, completionHandler: @escaping (Bool) -> Void) {
// no-op on macOS
}

public func secureVaultManager(_: SecureVaultManager, didRequestCreditCardsManagerForDomain domain: String) {
autofillPreferencesModel.showAutofillPopover(.cards)
}
Expand Down
16 changes: 14 additions & 2 deletions DuckDuckGo/Tab/TabExtensions/AutofillTabExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extension AutofillTabExtension: SecureVaultManagerDelegate {
return true
}

func secureVaultManager(_: SecureVaultManager, promptUserToStoreAutofillData data: AutofillData) {
func secureVaultManager(_: SecureVaultManager, promptUserToStoreAutofillData data: AutofillData, hasGeneratedPassword generatedPassword: Bool, withTrigger trigger: AutofillUserScript.GetTriggerType?) {
self.autofillDataToSave = data
}

Expand All @@ -91,6 +91,10 @@ extension AutofillTabExtension: SecureVaultManagerDelegate {
// no-op on macOS
}

func secureVaultManager(_: SecureVaultManager, promptUserWithGeneratedPassword password: String, completionHandler: @escaping (Bool) -> Void) {
// no-op on macOS
}

func secureVaultManager(_: SecureVaultManager, didAutofill type: AutofillType, withObjectId objectId: String) {
Pixel.fire(.formAutofilled(kind: type.formAutofillKind))
}
Expand All @@ -109,10 +113,18 @@ extension AutofillTabExtension: SecureVaultManagerDelegate {
Pixel.fire(.jsPixel(pixel))
}

func secureVaultManagerShouldAutomaticallyUpdateCredentialsWithoutUsername(_: SecureVaultManager) -> Bool {
func secureVaultManagerShouldAutomaticallyUpdateCredentialsWithoutUsername(_: SecureVaultManager, shouldSilentlySave: Bool) -> Bool {
return true
}

func secureVaultManagerShouldSilentlySaveGeneratedPassword(_: SecureVaultManager) -> Bool {
return false
}

func secureVaultManager(_: SecureVaultManager, promptUserToUseGeneratedPasswordForDomain: String, withGeneratedPassword generatedPassword: String, completionHandler: @escaping (Bool) -> Void) {
// no-op on macOS
}

public func secureVaultManager(_: SecureVaultManager, didRequestCreditCardsManagerForDomain domain: String) {
// no-op
}
Expand Down