Skip to content

Commit

Permalink
Promote password import in autofill menu (#3220)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/72649045549333/1207617229892922/f
BSK PR: duckduckgo/BrowserServicesKit#976

**Description**:

When adopting a new browser after a long time using something else, you
expect your browser to have all your data. If you skipped import during
onboarding you will find out about the missing data at the time when
you're trying to use the password. This creates huge friction right in
the middle of a task. See [Comment by Peter Dolanjski on Password and
autofill
issues](https://app.asana.com/0/0/1207533847538452/1207544369978642/f).
Reminding users of the option to import right when that friction happens
could be a way to quickly give recourse and solve the problem for all
subsequent browsing needs.

This feature promotes the import in autofill scenarios when the user has
few or no passwords saved.

**Steps to test this PR**:
https://app.asana.com/0/72649045549333/1208245520043990/f

**Definition of Done**:

* [ ] Does this PR satisfy our [Definition of
Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)?

---
###### Internal references:
[Pull Request Review
Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f)
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)
[Pull Request
Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)
  • Loading branch information
graeme authored Sep 10, 2024
1 parent 58cfc44 commit ba40958
Show file tree
Hide file tree
Showing 16 changed files with 276 additions and 12 deletions.
20 changes: 19 additions & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2789,6 +2789,8 @@
EE02D4212BB460FE00DBE6B3 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF2624923EC70071C2E8 /* StringExtension.swift */; };
EE02D4222BB4611A00DBE6B3 /* TestsURLExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6EC37FB29B83E99001ACE79 /* TestsURLExtension.swift */; };
EE0429E02BA31D2F009EB20F /* FindInPageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0429DF2BA31D2F009EB20F /* FindInPageTests.swift */; };
EE098E772C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE098E762C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift */; };
EE098E782C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE098E762C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift */; };
EE2F9C5B2B90F2FF00D45FC9 /* Subscription in Frameworks */ = {isa = PBXBuildFile; productRef = EE2F9C5A2B90F2FF00D45FC9 /* Subscription */; };
EE339228291BDEFD009F62C1 /* JSAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE339227291BDEFD009F62C1 /* JSAlertController.swift */; };
EE3424602BA0853900173B1B /* VPNUninstaller.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE34245D2BA0853900173B1B /* VPNUninstaller.swift */; };
Expand Down Expand Up @@ -2831,6 +2833,8 @@
EEC8EB402982CD550065AA39 /* JSAlertViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF53E172950CED5002D78F4 /* JSAlertViewModelTests.swift */; };
EECE10E529DD77E60044D027 /* FeatureFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECE10E429DD77E60044D027 /* FeatureFlag.swift */; };
EECE10E629DD77E60044D027 /* FeatureFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECE10E429DD77E60044D027 /* FeatureFlag.swift */; };
EED4D3DF2C8A298D00C79EEA /* AutofillPixelEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */; };
EED4D3E02C8A298D00C79EEA /* AutofillPixelEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */; };
EED735362BB46B6000F173D6 /* AutocompleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EED735352BB46B6000F173D6 /* AutocompleteTests.swift */; };
EED9A6752C37FE6900E0FAB9 /* login_deduplication_test_data.csv in Resources */ = {isa = PBXBuildFile; fileRef = EED9A6732C37FE6800E0FAB9 /* login_deduplication_test_data.csv */; };
EED9A6762C37FE6900E0FAB9 /* login_deduplication_test_data.csv in Resources */ = {isa = PBXBuildFile; fileRef = EED9A6732C37FE6800E0FAB9 /* login_deduplication_test_data.csv */; };
Expand All @@ -2842,6 +2846,8 @@
EEE0E1CF2C32F6530058E148 /* mock_login_data_large.csv in Resources */ = {isa = PBXBuildFile; fileRef = EEE0E1CE2C32F6530058E148 /* mock_login_data_large.csv */; };
EEE0E1D02C32F6530058E148 /* mock_login_data_large.csv in Resources */ = {isa = PBXBuildFile; fileRef = EEE0E1CE2C32F6530058E148 /* mock_login_data_large.csv */; };
EEE0E1D12C32F8620058E148 /* CSVImporterIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE0E1CC2C32F5690058E148 /* CSVImporterIntegrationTests.swift */; };
EEE11C5E2C7F54AD000ABD7E /* AutofillLoginImportState.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE11C5D2C7F54AD000ABD7E /* AutofillLoginImportState.swift */; };
EEE11C5F2C7F54AD000ABD7E /* AutofillLoginImportState.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE11C5D2C7F54AD000ABD7E /* AutofillLoginImportState.swift */; };
EEE50C292C38249C003DD7FF /* OptionalExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE50C282C38249C003DD7FF /* OptionalExtension.swift */; };
EEE50C2A2C38249C003DD7FF /* OptionalExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE50C282C38249C003DD7FF /* OptionalExtension.swift */; };
EEF12E6F2A2111880023E6BF /* MacPacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF12E6D2A2111880023E6BF /* MacPacketTunnelProvider.swift */; };
Expand Down Expand Up @@ -4529,6 +4535,7 @@
EE02D4192BB4609900DBE6B3 /* UITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITests.swift; sourceTree = "<group>"; };
EE02D41B2BB460A600DBE6B3 /* BrowsingHistoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BrowsingHistoryTests.swift; sourceTree = "<group>"; };
EE0429DF2BA31D2F009EB20F /* FindInPageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindInPageTests.swift; sourceTree = "<group>"; };
EE098E762C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillCredentialsImportManager.swift; sourceTree = "<group>"; };
EE339227291BDEFD009F62C1 /* JSAlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSAlertController.swift; sourceTree = "<group>"; };
EE34245D2BA0853900173B1B /* VPNUninstaller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNUninstaller.swift; sourceTree = "<group>"; };
EE42CBCB2BC8004700AD411C /* PermissionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PermissionsTests.swift; sourceTree = "<group>"; };
Expand All @@ -4549,12 +4556,14 @@
EEC4A6702B2C90AB00F7C0AA /* VPNLocationPreferenceItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNLocationPreferenceItem.swift; sourceTree = "<group>"; };
EEC7BE2D2BC6C09400F86835 /* AddressBarKeyboardShortcutsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddressBarKeyboardShortcutsTests.swift; sourceTree = "<group>"; };
EECE10E429DD77E60044D027 /* FeatureFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlag.swift; sourceTree = "<group>"; };
EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillPixelEvent.swift; sourceTree = "<group>"; };
EED735352BB46B6000F173D6 /* AutocompleteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutocompleteTests.swift; sourceTree = "<group>"; };
EED9A6732C37FE6800E0FAB9 /* login_deduplication_test_data.csv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = login_deduplication_test_data.csv; sourceTree = "<group>"; };
EED9A6742C37FE6900E0FAB9 /* login_deduplication_starting_data.csv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = login_deduplication_starting_data.csv; sourceTree = "<group>"; };
EEDE50102BA360C80017F3C4 /* NetworkProtection+VPNAgentConvenienceInitializers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NetworkProtection+VPNAgentConvenienceInitializers.swift"; sourceTree = "<group>"; };
EEE0E1CC2C32F5690058E148 /* CSVImporterIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CSVImporterIntegrationTests.swift; sourceTree = "<group>"; };
EEE0E1CE2C32F6530058E148 /* mock_login_data_large.csv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mock_login_data_large.csv; sourceTree = "<group>"; };
EEE11C5D2C7F54AD000ABD7E /* AutofillLoginImportState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillLoginImportState.swift; sourceTree = "<group>"; };
EEE50C282C38249C003DD7FF /* OptionalExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionalExtension.swift; sourceTree = "<group>"; };
EEF12E6D2A2111880023E6BF /* MacPacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacPacketTunnelProvider.swift; sourceTree = "<group>"; };
EEF53E172950CED5002D78F4 /* JSAlertViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSAlertViewModelTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5988,6 +5997,7 @@
4B723DF426B0002B00E14D75 /* LoginImport.swift */,
4B723DF226B0002B00E14D75 /* SecureVault */,
4B723DF526B0002B00E14D75 /* CSV */,
EEE11C5D2C7F54AD000ABD7E /* AutofillLoginImportState.swift */,
);
path = Logins;
sourceTree = "<group>";
Expand Down Expand Up @@ -6522,6 +6532,8 @@
C13909EE2B85FD4E001626ED /* AutofillActionExecutor.swift */,
C1E961EE2B87AA29001760E1 /* AutofillActionBuilder.swift */,
C13909FA2B861039001626ED /* AutofillActionPresenter.swift */,
EED4D3DE2C8A298D00C79EEA /* AutofillPixelEvent.swift */,
EE098E762C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift */,
);
path = Autofill;
sourceTree = "<group>";
Expand Down Expand Up @@ -10649,6 +10661,7 @@
3706FB31293F65D500E42796 /* PinnedTabsHostingView.swift in Sources */,
B6AFE6BC29A5D3F8002FF962 /* PrivacyDashboardTabExtension.swift in Sources */,
3706FB32293F65D500E42796 /* FirefoxBookmarksReader.swift in Sources */,
EE098E782C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift in Sources */,
3199AF7E2C80734A003AEBDC /* TabModal.swift in Sources */,
1D39E57B2C2C0F3700757339 /* ReleaseNotesUserScript.swift in Sources */,
3706FB33293F65D500E42796 /* DeviceIdleStateDetector.swift in Sources */,
Expand Down Expand Up @@ -10866,6 +10879,7 @@
B626A7552991413000053070 /* SerpHeadersNavigationResponder.swift in Sources */,
B68D21C42ACBC917002DA3C2 /* ContentBlockingMock.swift in Sources */,
3706FBB1293F65D500E42796 /* HomePageView.swift in Sources */,
EEE11C5F2C7F54AD000ABD7E /* AutofillLoginImportState.swift in Sources */,
3706FBB2293F65D500E42796 /* WebKitDownloadTask.swift in Sources */,
3706FBB3293F65D500E42796 /* ChromiumLoginReader.swift in Sources */,
3706FBB4293F65D500E42796 /* NSAlert+PasswordManager.swift in Sources */,
Expand Down Expand Up @@ -10950,6 +10964,7 @@
3706FBE1293F65D500E42796 /* AppStateRestorationManager.swift in Sources */,
9FA173EC2B7B232200EE4E6E /* AddEditBookmarkDialogView.swift in Sources */,
3706FBE2293F65D500E42796 /* ClickToLoadUserScript.swift in Sources */,
EED4D3E02C8A298D00C79EEA /* AutofillPixelEvent.swift in Sources */,
3706FBE3293F65D500E42796 /* WindowControllersManager.swift in Sources */,
37197EAA2942443D00394917 /* ModalSheetCancellable.swift in Sources */,
31267C6B2B640C5200FEF811 /* DataBrokerProtectionAppEvents.swift in Sources */,
Expand Down Expand Up @@ -12090,6 +12105,7 @@
4B8A4E0127C8447E005F40E8 /* SaveIdentityPopover.swift in Sources */,
B637273B26CBC8AF00C8CB02 /* AuthenticationAlert.swift in Sources */,
1DFAB51D2A8982A600A0F7F6 /* SetExtension.swift in Sources */,
EEE11C5E2C7F54AD000ABD7E /* AutofillLoginImportState.swift in Sources */,
315AA07028CA5CC800200030 /* YoutubePlayerNavigationHandler.swift in Sources */,
37AFCE9227DB8CAD00471A10 /* PreferencesAboutView.swift in Sources */,
F1D042A12BFBB4DD00A31506 /* DataBrokerProtectionSettings+Environment.swift in Sources */,
Expand Down Expand Up @@ -12542,6 +12558,7 @@
7B60AFFF2C51426A008E32A3 /* VPNURLEventHandler.swift in Sources */,
D64A5FF82AEA5C2B00B6D6E7 /* HomeButtonMenuFactory.swift in Sources */,
37A6A8F62AFCCA59008580A3 /* FaviconsFetcherOnboardingViewController.swift in Sources */,
EE098E772C8EDE2C009EBA7F /* AutofillCredentialsImportManager.swift in Sources */,
3199AF6F2C80734A003AEBDC /* DuckPlayerOnboardingDecider.swift in Sources */,
AA3F895324C18AD500628DDE /* SuggestionViewModel.swift in Sources */,
4B9292A326670D2A00AD2C21 /* BookmarkManagedObject.swift in Sources */,
Expand Down Expand Up @@ -12667,6 +12684,7 @@
9F56CFA92B82DC4300BB7F11 /* AddEditBookmarkFolderView.swift in Sources */,
37445F9C2A1569F00029F789 /* SyncBookmarksAdapter.swift in Sources */,
C1E961EF2B87AA29001760E1 /* AutofillActionBuilder.swift in Sources */,
EED4D3DF2C8A298D00C79EEA /* AutofillPixelEvent.swift in Sources */,
4B9292AF26670F5300AD2C21 /* NSOutlineViewExtensions.swift in Sources */,
9F56CFAD2B84326C00BB7F11 /* AddEditBookmarkDialogViewModel.swift in Sources */,
1D4071AE2BD64267002D4537 /* DockCustomizer.swift in Sources */,
Expand Down Expand Up @@ -14128,7 +14146,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 192.0.0;
version = 193.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
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" : "3dc2650ab4a88e471e9a194360f75b66ffbce9bd",
"version" : "192.0.0"
"revision" : "e036123b9e0babf0e7c8ada24d4edb932a2730b3",
"version" : "193.0.0"
}
},
{
Expand All @@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/duckduckgo-autofill.git",
"state" : {
"revision" : "1f12b78d9bac4a1d9b6bad18dc2ef0593bed34a3",
"version" : "13.0.0"
"revision" : "1fee787458d13f8ed07f9fe81aecd6e59609339e",
"version" : "13.1.0"
}
},
{
Expand Down
70 changes: 70 additions & 0 deletions DuckDuckGo/Autofill/AutofillCredentialsImportManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// AutofillCredentialsImportManager.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import PixelKit
import BrowserServicesKit

public protocol AutofillCredentialsImportPresentationDelegate: AnyObject {
func autofillDidRequestCredentialsImportFlow(onFinished: @escaping () -> Void, onCancelled: @escaping () -> Void)
}

final public class AutofillCredentialsImportManager {
private let userDefaults: UserDefaults

weak var presentationDelegate: AutofillCredentialsImportPresentationDelegate?

init(userDefaults: UserDefaults = .standard) {
self.userDefaults = userDefaults
}
}

extension AutofillCredentialsImportManager: AutofillPasswordImportDelegate {

private struct CredentialsImportInputContext: Decodable {
var inputType: String
var credentialsImport: Bool
}

public func autofillUserScriptDidRequestPasswordImportFlow(_ completion: @escaping () -> Void) {
PixelKit.fire(AutofillPixelKitEvent.importCredentialsFlowStarted.withoutMacPrefix)
presentationDelegate?.autofillDidRequestCredentialsImportFlow(
onFinished: {
PixelKit.fire(AutofillPixelKitEvent.importCredentialsFlowEnded.withoutMacPrefix)
completion()
},
onCancelled: {
PixelKit.fire(AutofillPixelKitEvent.importCredentialsFlowCancelled.withoutMacPrefix)
completion()
}
)
}

public func autofillUserScriptDidFinishImportWithImportedCredentialForCurrentDomain() {
PixelKit.fire(AutofillPixelKitEvent.importCredentialsFlowHadCredentials.withoutMacPrefix)
}

public func autofillUserScriptWillDisplayOverlay(_ serializedInputContext: String) {
if let data = serializedInputContext.data(using: .utf8),
let decoded = try? JSONDecoder().decode(CredentialsImportInputContext.self, from: data) {
if decoded.credentialsImport {
AutofillLoginImportState().credentialsImportPromptPresentationCount += 1
}
}
}
}
48 changes: 48 additions & 0 deletions DuckDuckGo/Autofill/AutofillPixelEvent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// AutofillPixelEvent.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import PixelKit

enum AutofillPixelKitEvent: PixelKitEventV2 {
case importCredentialsFlowStarted
case importCredentialsFlowCancelled
case importCredentialsFlowHadCredentials
case importCredentialsFlowEnded

var name: String {
switch self {
case .importCredentialsFlowStarted: "autofill_import_credentials_flow_started"
case .importCredentialsFlowCancelled: "autofill_import_credentials_flow_cancelled"
case .importCredentialsFlowHadCredentials: "autofill_import_credentials_flow_had_credentials"
case .importCredentialsFlowEnded: "autofill_import_credentials_flow_ended"
}
}

var parameters: [String: String]? {
nil
}

var error: (any Error)? {
nil
}

var withoutMacPrefix: NonStandardEvent {
NonStandardEvent(self)
}
}
18 changes: 17 additions & 1 deletion DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR
return manager
}()

lazy var credentialsImportManager: AutofillCredentialsImportManager = {
let manager = AutofillCredentialsImportManager()
manager.presentationDelegate = self
return manager
}()

lazy var autofillPreferencesModel: AutofillPreferencesModel = {
let model = AutofillPreferencesModel()
return model
Expand Down Expand Up @@ -129,7 +135,7 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR

private func initWebView() {
let scriptSourceProvider = buildAutofillSource()
self.topAutofillUserScript = OverlayAutofillUserScript(scriptSourceProvider: scriptSourceProvider, overlay: self)
self.topAutofillUserScript = OverlayAutofillUserScript(scriptSourceProvider: scriptSourceProvider, overlay: self, loginImportStateProvider: AutofillLoginImportState())
guard let topAutofillUserScript = topAutofillUserScript else { return }
let configuration = WKWebViewConfiguration()

Expand All @@ -148,6 +154,7 @@ public final class ContentOverlayViewController: NSViewController, EmailManagerR
topAutofillUserScript.contentOverlay = self
topAutofillUserScript.emailDelegate = emailManager
topAutofillUserScript.vaultDelegate = vaultManager
topAutofillUserScript.passwordImportDelegate = credentialsImportManager
}

// EmailManagerRequestDelegate
Expand Down Expand Up @@ -328,6 +335,8 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {

PixelKit.fire(NonStandardEvent(GeneralPixel.jsPixel(pixel)), withAdditionalParameters: pixelParameters)
NotificationCenter.default.post(name: .autofillFillEvent, object: nil)
} else if pixel.isCredentialsImportPromotionPixel {
PixelKit.fire(NonStandardEvent(GeneralPixel.jsPixel(pixel)))
} else {
if pixel.isIdentityPixel {
NotificationCenter.default.post(name: .autofillFillEvent, object: nil)
Expand Down Expand Up @@ -367,3 +376,10 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
completionHandler(runtimeConfiguration)
}
}

extension ContentOverlayViewController: AutofillCredentialsImportPresentationDelegate {
public func autofillDidRequestCredentialsImportFlow(onFinished: @escaping () -> Void, onCancelled: @escaping () -> Void) {
let viewModel = DataImportViewModel(onFinished: onFinished, onCancelled: onCancelled)
DataImportView(model: viewModel).show()
}
}
Loading

0 comments on commit ba40958

Please sign in to comment.