From 5faff385260d03da549019ca5f2f3a13669b66f6 Mon Sep 17 00:00:00 2001 From: amddg44 Date: Tue, 4 Jun 2024 16:59:34 +0200 Subject: [PATCH] Removing the temporary password manager survey code (#2910) Task/Issue URL: https://app.asana.com/0/0/1207424646529837/f Tech Design URL: CC: Description: Cleaning out all (now obsolete) code related to the temporary password manager survey --- Core/PixelEvent.swift | 3 - Core/UserDefaultsPropertyWrapper.swift | 1 - DuckDuckGo.xcodeproj/project.pbxproj | 4 - DuckDuckGo/AppSettings.swift | 1 - DuckDuckGo/AppUserDefaults.swift | 3 - .../Contents.json | 12 -- .../Passwords-DDG-96x96.svg | 26 ---- DuckDuckGo/AutofillDebugViewController.swift | 4 - DuckDuckGo/AutofillLoginListViewModel.swift | 8 -- ...ofillLoginSettingsListViewController.swift | 43 ------ DuckDuckGo/Debug.storyboard | 27 ++-- DuckDuckGo/PasswordsSurveyView.swift | 132 ------------------ .../RemoteMessagingSurveyURLBuilder.swift | 24 ---- DuckDuckGoTests/AppSettingsMock.swift | 2 - 14 files changed, 9 insertions(+), 281 deletions(-) delete mode 100644 DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Contents.json delete mode 100644 DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Passwords-DDG-96x96.svg delete mode 100644 DuckDuckGo/PasswordsSurveyView.swift diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index 34413a1328..d57161e78f 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -250,8 +250,6 @@ extension Pixel { case autofillLoginsPasswordGenerationPromptConfirmed case autofillLoginsPasswordGenerationPromptDismissed - case autofillManagementScreenVisitSurveyAvailable - case autofillLoginsLaunchWidgetHome case autofillLoginsLaunchWidgetLock case autofillLoginsLaunchAppShortcut @@ -953,7 +951,6 @@ extension Pixel.Event { case .autofillLoginsPasswordGenerationPromptConfirmed: return "m_autofill_logins_password_generation_prompt_confirmed" case .autofillLoginsPasswordGenerationPromptDismissed: return "m_autofill_logins_password_generation_prompt_dismissed" - case .autofillManagementScreenVisitSurveyAvailable: return "m_autofill_management_screen_visit_survey_available" case .autofillLoginsLaunchWidgetHome: return "m_autofill_logins_launch_widget_home" case .autofillLoginsLaunchWidgetLock: return "m_autofill_logins_launch_widget_lock" case .autofillLoginsLaunchAppShortcut: return "m_autofill_logins_launch_app_shortcut" diff --git a/Core/UserDefaultsPropertyWrapper.swift b/Core/UserDefaultsPropertyWrapper.swift index 9accccda03..40b62d91d3 100644 --- a/Core/UserDefaultsPropertyWrapper.swift +++ b/Core/UserDefaultsPropertyWrapper.swift @@ -83,7 +83,6 @@ public struct UserDefaultsWrapper { case autofillCredentialsHasBeenEnabledAutomaticallyIfNecessary = "com.duckduckgo.ios.autofillCredentialsHasBeenEnabledAutomaticallyIfNecessary" case autofillImportViaSyncStart = "com.duckduckgo.ios.autofillImportViaSyncStart" - case autofillSurveyEnabled = "com.duckduckgo.ios.autofillSurveyEnabled" case autofillSearchDauDate = "com.duckduckgo.app.autofill.SearchDauDate" case autofillFillDate = "com.duckduckgo.app.autofill.FillDate" case autofillOnboardedUser = "com.duckduckgo.app.autofill.OnboardedUser" diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index b50474cc73..26fd284d71 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -665,7 +665,6 @@ C12726EE2A5FF88C00215B02 /* EmailSignupPromptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C12726ED2A5FF88C00215B02 /* EmailSignupPromptView.swift */; }; C12726F02A5FF89900215B02 /* EmailSignupPromptViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C12726EF2A5FF89900215B02 /* EmailSignupPromptViewModel.swift */; }; C12726F22A5FF8CB00215B02 /* EmailSignupPromptViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C12726F12A5FF8CB00215B02 /* EmailSignupPromptViewController.swift */; }; - C136C7542BEB8CFC00ACC3B0 /* PasswordsSurveyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C136C7532BEB8CFC00ACC3B0 /* PasswordsSurveyView.swift */; }; C13B32D22A0E750700A59236 /* AutofillSettingStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13B32D12A0E750700A59236 /* AutofillSettingStatus.swift */; }; C13F3F682B7F88100083BE40 /* AuthConfirmationPromptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13F3F672B7F88100083BE40 /* AuthConfirmationPromptView.swift */; }; C13F3F6A2B7F883A0083BE40 /* AuthConfirmationPromptViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13F3F692B7F883A0083BE40 /* AuthConfirmationPromptViewController.swift */; }; @@ -2272,7 +2271,6 @@ C12726ED2A5FF88C00215B02 /* EmailSignupPromptView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailSignupPromptView.swift; sourceTree = ""; }; C12726EF2A5FF89900215B02 /* EmailSignupPromptViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailSignupPromptViewModel.swift; sourceTree = ""; }; C12726F12A5FF8CB00215B02 /* EmailSignupPromptViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailSignupPromptViewController.swift; sourceTree = ""; }; - C136C7532BEB8CFC00ACC3B0 /* PasswordsSurveyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordsSurveyView.swift; sourceTree = ""; }; C13B32D12A0E750700A59236 /* AutofillSettingStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutofillSettingStatus.swift; sourceTree = ""; }; C13F3F672B7F88100083BE40 /* AuthConfirmationPromptView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthConfirmationPromptView.swift; sourceTree = ""; }; C13F3F692B7F883A0083BE40 /* AuthConfirmationPromptViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthConfirmationPromptViewController.swift; sourceTree = ""; }; @@ -5393,7 +5391,6 @@ C1CDA3152AFB9C7F006D1476 /* AutofillNeverPromptWebsitesManager.swift */, C13B32D12A0E750700A59236 /* AutofillSettingStatus.swift */, 319A370F28299A850079FBCE /* PasswordHider.swift */, - C136C7532BEB8CFC00ACC3B0 /* PasswordsSurveyView.swift */, 31C70B5428045E3500FB6AD1 /* SecureVaultReporter.swift */, C1AFFC4B2B8773060060448E /* AuthConfirmation */, F407605328131910006B1E0B /* AutofillLoginUI */, @@ -6548,7 +6545,6 @@ BD862E0B2B30F9300073E2EE /* VPNFeedbackFormView.swift in Sources */, 850365F323DE087800D0F787 /* UIImageViewExtension.swift in Sources */, 373608922ABB430D00629E7F /* FavoritesDisplayMode+UserDefaults.swift in Sources */, - C136C7542BEB8CFC00ACC3B0 /* PasswordsSurveyView.swift in Sources */, C160544129D6044D00B715A1 /* AutofillInterfaceUsernameTruncator.swift in Sources */, 31C70B5528045E3500FB6AD1 /* SecureVaultReporter.swift in Sources */, F4CE6D1B257EA33C00D0A6AA /* FireButtonAnimator.swift in Sources */, diff --git a/DuckDuckGo/AppSettings.swift b/DuckDuckGo/AppSettings.swift index 484198db9d..969f39d7e8 100644 --- a/DuckDuckGo/AppSettings.swift +++ b/DuckDuckGo/AppSettings.swift @@ -71,7 +71,6 @@ protocol AppSettings: AnyObject { func setAutofillIsNewInstallForOnByDefault() var autofillImportViaSyncStart: Date? { get set } func clearAutofillImportViaSyncStart() - var autofillSurveyEnabled: Bool { get set } var voiceSearchEnabled: Bool { get set } diff --git a/DuckDuckGo/AppUserDefaults.swift b/DuckDuckGo/AppUserDefaults.swift index dacbfe6831..51f0f694a1 100644 --- a/DuckDuckGo/AppUserDefaults.swift +++ b/DuckDuckGo/AppUserDefaults.swift @@ -300,9 +300,6 @@ public class AppUserDefaults: AppSettings { autofillImportViaSyncStart = nil } - @UserDefaultsWrapper(key: .autofillSurveyEnabled, defaultValue: true) - var autofillSurveyEnabled: Bool - @UserDefaultsWrapper(key: .voiceSearchEnabled, defaultValue: false) var voiceSearchEnabled: Bool diff --git a/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Contents.json deleted file mode 100644 index 608aeb0457..0000000000 --- a/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "Passwords-DDG-96x96.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Passwords-DDG-96x96.svg b/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Passwords-DDG-96x96.svg deleted file mode 100644 index 03cd133d04..0000000000 --- a/DuckDuckGo/Assets.xcassets/Passwords-DDG-96x96.imageset/Passwords-DDG-96x96.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DuckDuckGo/AutofillDebugViewController.swift b/DuckDuckGo/AutofillDebugViewController.swift index 2e369e1e79..674319ae37 100644 --- a/DuckDuckGo/AutofillDebugViewController.swift +++ b/DuckDuckGo/AutofillDebugViewController.swift @@ -29,7 +29,6 @@ class AutofillDebugViewController: UITableViewController { case resetEmailProtectionInContextSignUp = 202 case resetDaysSinceInstalledTo0 = 203 case resetAutofillData = 204 - case toggleAutofillSurvey = 205 } let defaults = AppUserDefaults() @@ -56,9 +55,6 @@ class AutofillDebugViewController: UITableViewController { eventMapping: EventMapping { _, _, _, _ in }) autofillPixelReporter.resetStoreDefaults() ActionMessageView.present(message: "Autofill Data reset") - } else if cell.tag == Row.toggleAutofillSurvey.rawValue { - defaults.autofillSurveyEnabled = true - ActionMessageView.present(message: "Passwords Survey enabled") } else if cell.tag == Row.resetEmailProtectionInContextSignUp.rawValue { EmailManager().resetEmailProtectionInContextPrompt() tableView.deselectRow(at: indexPath, animated: true) diff --git a/DuckDuckGo/AutofillLoginListViewModel.swift b/DuckDuckGo/AutofillLoginListViewModel.swift index 04a13a25ba..2b3850f1b5 100644 --- a/DuckDuckGo/AutofillLoginListViewModel.swift +++ b/DuckDuckGo/AutofillLoginListViewModel.swift @@ -128,14 +128,6 @@ final class AutofillLoginListViewModel: ObservableObject { // MARK: Public Methods - func isAutofillSurveyEnabled() -> Bool { - return false - } - - func disableAutofillSurvey() { - appSettings.autofillSurveyEnabled = false - } - func delete(at indexPath: IndexPath) -> Bool { let section = sections[indexPath.section] switch section { diff --git a/DuckDuckGo/AutofillLoginSettingsListViewController.swift b/DuckDuckGo/AutofillLoginSettingsListViewController.swift index df88b9ef0f..5bbd610a6e 100644 --- a/DuckDuckGo/AutofillLoginSettingsListViewController.swift +++ b/DuckDuckGo/AutofillLoginSettingsListViewController.swift @@ -206,43 +206,6 @@ final class AutofillLoginSettingsListViewController: UIViewController { updateViewState() configureNotification() registerForKeyboardNotifications() - - addSurveyView() - } - - func addSurveyView() { - guard Locale.current.isEnglishLanguage, viewModel.isAutofillSurveyEnabled() else { - if tableView.tableHeaderView != nil { - tableView.tableHeaderView = nil - } - return - } - let messageView = PasswordsSurveyView(surveyButtonAction: { [weak self] in - let survey = "https://selfserve.decipherinc.com/survey/selfserve/32ab/240409" - if let surveyURL = URL(string: survey) { - let surveyURLBuilder = DefaultRemoteMessagingSurveyURLBuilder() - let surveyURLWithParameters = surveyURLBuilder.addPasswordsCountSurveyParameter(to: surveyURL) - LaunchTabNotification.postLaunchTabNotification(urlString: surveyURLWithParameters.absoluteString) - } else { - LaunchTabNotification.postLaunchTabNotification(urlString: survey) - } - self?.viewModel.disableAutofillSurvey() - self?.dismiss(animated: true) - - }, closeButtonAction: { [weak self] in - self?.viewModel.disableAutofillSurvey() - self?.removeSurveyView() - }) - - let hostingController = UIHostingController(rootView: messageView) - hostingController.view.frame = CGRect(origin: .zero, size: hostingController.sizeThatFits(in: UIScreen.main.bounds.size)) - hostingController.view.layoutIfNeeded() - hostingController.view.backgroundColor = .clear - tableView.tableHeaderView = hostingController.view - } - - func removeSurveyView() { - tableView.tableHeaderView = nil } override func viewDidAppear(_ animated: Bool) { @@ -285,12 +248,6 @@ final class AutofillLoginSettingsListViewController: UIViewController { viewModel.isEditing = editing tableView.reloadData() - if editing { - removeSurveyView() - } else { - addSurveyView() - } - updateNavigationBarButtons() updateSearchController() updateToolbar() diff --git a/DuckDuckGo/Debug.storyboard b/DuckDuckGo/Debug.storyboard index a448655a3d..0599921021 100644 --- a/DuckDuckGo/Debug.storyboard +++ b/DuckDuckGo/Debug.storyboard @@ -391,21 +391,12 @@ - - - - - - - - - - + @@ -414,7 +405,7 @@ - + @@ -934,17 +925,17 @@ - + - + - + - + diff --git a/DuckDuckGo/PasswordsSurveyView.swift b/DuckDuckGo/PasswordsSurveyView.swift deleted file mode 100644 index 0af969ee6e..0000000000 --- a/DuckDuckGo/PasswordsSurveyView.swift +++ /dev/null @@ -1,132 +0,0 @@ -// -// PasswordsSurveyView.swift -// DuckDuckGo -// -// 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 SwiftUI -import Core -import DesignResourcesKit -import DuckUI - -struct PasswordsSurveyView: View { - - var surveyButtonAction: (() -> Void)? - var closeButtonAction: (() -> Void)? - - var body: some View { - ZStack(alignment: .topTrailing) { - VStack(spacing: 8) { - Group { - Image(.passwordsDDG96X96) - .resizable() - .frame(width: 50, height: 50, alignment: .center) - - Text("Help us improve!") - .daxHeadline() - .foregroundColor(Color(designSystemColor: .textPrimary)) - .padding(.top, 8) - .frame(maxWidth: .infinity) - - Text("We want to make using passwords in DuckDuckGo better.") - .daxBodyRegular() - .foregroundColor(Color(designSystemColor: .textPrimary)) - .padding(.top, 4) - - Button { - surveyButtonAction?() - } label: { - HStack { - Text("Take Survey") - .daxButton() - } - } - .buttonStyle(SurveyButtonStyle()) - .padding(.top, 8) - } - .padding(.horizontal, 24) - } - .multilineTextAlignment(.center) - .padding(.vertical) - .padding(.horizontal, 8) - - closeButtonHeader - .alignmentGuide(.top) { dimension in - dimension[.top] - } - } - .background(RoundedRectangle(cornerRadius: 8.0) - .fill(Color("HomeMessageBackgroundColor")) - ) - .onFirstAppear { - Pixel.fire(pixel: .autofillManagementScreenVisitSurveyAvailable) - } - .frame(maxWidth: 380) - .padding([.horizontal, .top], 20) - .padding(.bottom, 30) - } - - private var closeButtonHeader: some View { - VStack { - HStack { - Spacer() - closeButton - .padding(0) - } - } - } - - private var closeButton: some View { - Button { - closeButtonAction?() - } label: { - Image("Close-24") - .foregroundColor(.primary) - } - .frame(width: 44, height: 44) - .contentShape(Rectangle()) - } -} - -private struct SurveyButtonStyle: ButtonStyle { - @Environment(\.colorScheme) private var colorScheme - - func makeBody(configuration: Self.Configuration) -> some View { - let isDark = colorScheme == .dark - - let backgroundColor = isDark ? Color.blue30 : Color.blueBase - let foregroundColor = isDark ? Color.black.opacity(0.84) : Color.white - let pressedBackgroundColor = isDark ? Color.blueBase : Color.blue70 - - configuration.label - .padding(.horizontal, 16) - .padding(.vertical, 9) - .frame(height: 40) - .foregroundColor(foregroundColor) - .background(configuration.isPressed ? pressedBackgroundColor : backgroundColor) - .cornerRadius(8) - } -} - -#Preview("Light") { - PasswordsSurveyView() - .preferredColorScheme(.light) -} - -#Preview("Dark") { - PasswordsSurveyView() - .preferredColorScheme(.dark) -} diff --git a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift index 05b75d6118..c6034c5e8f 100644 --- a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift +++ b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift @@ -77,21 +77,6 @@ struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActionMappin return components.url ?? surveyURL } - func addPasswordsCountSurveyParameter(to surveyURL: URL) -> URL { - let surveyURLWithParameters = add(parameters: RemoteMessagingSurveyActionParameter.allCases, to: surveyURL) - - guard var components = URLComponents(string: surveyURLWithParameters.absoluteString), let bucket = passwordsCountBucket() else { - return surveyURLWithParameters - } - - var queryItems = components.queryItems ?? [] - queryItems.append(URLQueryItem(name: "saved_passwords", value: bucket)) - - components.queryItems = queryItems - - return components.url ?? surveyURL - } - private func hardwareModel() -> String { var systemInfo = utsname() uname(&systemInfo) @@ -105,13 +90,4 @@ struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActionMappin return identifier } - private func passwordsCountBucket() -> String? { - guard let secureVault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared), - let bucket = try? secureVault.accountsCountBucket() else { - return nil - } - - return bucket - } - } diff --git a/DuckDuckGoTests/AppSettingsMock.swift b/DuckDuckGoTests/AppSettingsMock.swift index e49b522144..7d3b34886d 100644 --- a/DuckDuckGoTests/AppSettingsMock.swift +++ b/DuckDuckGoTests/AppSettingsMock.swift @@ -71,8 +71,6 @@ class AppSettingsMock: AppSettings { autofillImportViaSyncStart = nil } - var autofillSurveyEnabled: Bool = false - var voiceSearchEnabled: Bool = false var widgetInstalled: Bool = false