Skip to content

Commit 9c64afe

Browse files
authored
Remove old password management list view implementation (#6473)
Task/Issue URL: https://app.asana.com/1/137249556945/project/608920331025315/task/1209443099736785?focus=true ### Description In #5654 we changed the implementation of the password management screen so that everything was rendered as a list item. We kept the old implementation around as a fallback, guarded by a kill switch. There's been no reported issues with the new approach. This PR removes the old implementation. ### Steps to test this PR #### Normal Autofill - [x] Smoke test normal Autofill screens, including password management and password settings screens - [x] Smoke test the `AutofillService` screen that happens when you to choose to open the passwords screen to pick your own one to autofill. --------- Co-authored-by: Craig Russell <[email protected]>
1 parent 1ba514c commit 9c64afe

File tree

8 files changed

+29
-1099
lines changed

8 files changed

+29
-1099
lines changed

autofill/autofill-api/src/main/java/com/duckduckgo/autofill/api/AutofillFeature.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ interface AutofillFeature {
131131
@Toggle.DefaultValue(DefaultFeatureValue.TRUE)
132132
fun deepDomainComparisonsOnExistingCredentialsChecks(): Toggle
133133

134-
/**
135-
* Kill switch for the new layout of list mode where everything is inside the recycler view
136-
*/
137-
@Toggle.DefaultValue(defaultValue = DefaultFeatureValue.TRUE)
138-
fun newScrollBehaviourInPasswordManagementScreen(): Toggle
139-
140134
/**
141135
* Kill switch for making case insensitive checks on existing username matches
142136
*/

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillSimpleCredentialsListFragment.kt

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ import com.duckduckgo.autofill.impl.R
3838
import com.duckduckgo.autofill.impl.databinding.FragmentAutofillProviderListBinding
3939
import com.duckduckgo.autofill.impl.deviceauth.DeviceAuthenticator
4040
import com.duckduckgo.autofill.impl.pixel.AutofillPixelNames.AUTOFILL_SERVICE_PASSWORDS_SEARCH
41-
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillManagementRecyclerAdapterLegacy
41+
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillManagementRecyclerAdapter
42+
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillManagementRecyclerAdapter.AutofillToggleState
43+
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillManagementRecyclerAdapter.CredentialsLoadedState.Loaded
4244
import com.duckduckgo.autofill.impl.ui.credential.management.sorting.CredentialGrouper
4345
import com.duckduckgo.autofill.impl.ui.credential.management.sorting.InitialExtractor
4446
import com.duckduckgo.autofill.impl.ui.credential.management.suggestion.SuggestionListBuilder
@@ -96,7 +98,7 @@ class AutofillSimpleCredentialsListFragment : DuckDuckGoFragment(R.layout.fragme
9698
}
9799

98100
private val binding: FragmentAutofillProviderListBinding by viewBinding()
99-
private lateinit var adapter: AutofillManagementRecyclerAdapterLegacy
101+
private lateinit var adapter: AutofillManagementRecyclerAdapter
100102

101103
private var searchMenuItem: MenuItem? = null
102104

@@ -229,21 +231,35 @@ class AutofillSimpleCredentialsListFragment : DuckDuckGoFragment(R.layout.fragme
229231
logcat(INFO) { "DDGAutofillService showSuggestionsFor: $showSuggestionsFor" }
230232
val directSuggestions = suggestionMatcher.getDirectSuggestions(showSuggestionsFor, credentials)
231233
val shareableCredentials = suggestionMatcher.getShareableSuggestions(showSuggestionsFor)
232-
adapter.updateLogins(credentials, directSuggestions, shareableCredentials, false)
234+
val directSuggestionsListItems = suggestionListBuilder.build(directSuggestions, shareableCredentials, allowBreakageReporting = false)
235+
val groupedCredentials = credentialGrouper.group(credentials)
236+
237+
withContext(dispatchers.main()) {
238+
adapter.showLogins(
239+
credentialsLoadedState = Loaded(
240+
directSuggestionsListItems = directSuggestionsListItems,
241+
groupedCredentials = groupedCredentials,
242+
showGoogleImportPasswordsButton = false,
243+
),
244+
autofillToggleState = AutofillToggleState(enabled = true, visible = false),
245+
promotionView = null,
246+
)
247+
}
233248
}
234249
}
235250

236251
private fun configureRecyclerView() {
237-
adapter = AutofillManagementRecyclerAdapterLegacy(
252+
adapter = AutofillManagementRecyclerAdapter(
238253
this,
239-
dispatchers = dispatchers,
240254
faviconManager = faviconManager,
241-
grouper = credentialGrouper,
242255
initialExtractor = initialExtractor,
243-
suggestionListBuilder = suggestionListBuilder,
244256
onCredentialSelected = this::onCredentialsSelected,
245257
onContextMenuItemClicked = { },
246258
onReportBreakageClicked = { },
259+
onImportFromGoogleClicked = { },
260+
onAutofillToggleClicked = { },
261+
onImportViaDesktopSyncClicked = { },
262+
launchHelpPageClicked = { },
247263
).also { binding.logins.adapter = it }
248264
}
249265

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/AutofillManagementActivity.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsMa
5151
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowDeviceUnsupportedMode
5252
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowDisabledMode
5353
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowListMode
54-
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowListModeLegacy
5554
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowLockedMode
5655
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowUserPasswordCopied
5756
import com.duckduckgo.autofill.impl.ui.credential.management.AutofillPasswordsManagementViewModel.Command.ShowUserUsernameCopied
@@ -65,7 +64,6 @@ import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillMan
6564
import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillManagementDeviceUnsupportedMode
6665
import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillManagementDisabledMode
6766
import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillManagementListMode
68-
import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillManagementListModeLegacy
6967
import com.duckduckgo.autofill.impl.ui.credential.management.viewing.AutofillManagementLockedMode
7068
import com.duckduckgo.common.ui.DuckDuckGoActivity
7169
import com.duckduckgo.common.ui.view.SearchBar
@@ -198,8 +196,7 @@ class AutofillManagementActivity : DuckDuckGoActivity(), PasswordsScreenPromotio
198196
is ShowUserPasswordCopied -> showCopiedToClipboardSnackbar(CopiedToClipboardDataType.Password)
199197
is OfferUserUndoDeletion -> showUserCredentialDeletedWithUndoAction(command)
200198
is OfferUserUndoMassDeletion -> showUserCredentialsMassDeletedWithUndoAction(command)
201-
is ShowListMode -> showListMode(legacyList = false)
202-
is ShowListModeLegacy -> showListMode(legacyList = true)
199+
is ShowListMode -> showListMode()
203200
is ShowDisabledMode -> showDisabledMode()
204201
is ShowDeviceUnsupportedMode -> showDeviceUnsupportedMode()
205202
is ShowLockedMode -> showLockMode()
@@ -250,19 +247,15 @@ class AutofillManagementActivity : DuckDuckGoActivity(), PasswordsScreenPromotio
250247
}.show()
251248
}
252249

253-
private fun showListMode(legacyList: Boolean) {
250+
private fun showListMode() {
254251
resetToolbar()
255252
val currentUrl = extractSuggestionsUrl()
256253
val privacyProtectionStatus = extractPrivacyProtectionEnabled()
257254
val launchSource = extractLaunchSource()
258-
logcat(VERBOSE) { "showListMode (isLegacy = $legacyList). currentUrl is $currentUrl" }
255+
logcat(VERBOSE) { "showListMode. currentUrl is $currentUrl" }
259256

260257
supportFragmentManager.commitNow {
261-
val fragment = if (legacyList) {
262-
AutofillManagementListModeLegacy.instance(currentUrl, privacyProtectionStatus, launchSource)
263-
} else {
264-
AutofillManagementListMode.instance(currentUrl, privacyProtectionStatus, launchSource)
265-
}
258+
val fragment = AutofillManagementListMode.instance(currentUrl, privacyProtectionStatus, launchSource)
266259
replace(R.id.fragment_container_view, fragment, TAG_ALL_CREDENTIALS)
267260
}
268261
}

0 commit comments

Comments
 (0)