Skip to content

Commit

Permalink
enable showing suggestions inside DDG (behind FF) (#5646)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/488551667048375/1209399460038441

### Description
show suggestions inside DDG app
Put it behind a FF in case we uncover unexpected behaviors

### Steps to test this PR

_Feature 1_
- [ ] Visiting fill.dev or other sites inside DDG
- [ ] focus on login fields
- [ ] you should see suggestions as in other apps

### UI changes
| Before  | After |
| ------ | ----- |
!(Upload before screenshot)|(Upload after screenshot)|
  • Loading branch information
cmonfortep authored Feb 13, 2025
1 parent 83a0f69 commit aacc744
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ interface AutofillServiceFeature {
@Toggle.DefaultValue(false)
@InternalAlwaysEnabled
fun canMapAppToDomain(): Toggle

@Toggle.DefaultValue(false)
@InternalAlwaysEnabled
fun canAutofillInsideDDG(): Toggle
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class RealAutofillService : AutofillService() {
val parsedRootNodes = autofillParser.parseStructure(structure)
val nodeToAutofill = parsedRootNodes.findBestFillableNode()
if (nodeToAutofill == null || shouldSkipAutofillSuggestions(nodeToAutofill)) {
Timber.v("DDGAutofillService onFillRequest: no autofill suggestions")
callback.onSuccess(null)
return@launch
}
Expand All @@ -108,7 +109,13 @@ class RealAutofillService : AutofillService() {

if (nodeToAutofill.packageId.equals("android", ignoreCase = true)) return true

if (nodeToAutofill.packageId in PACKAGES_TO_EXCLUDE) return true
if (autofillServiceFeature.canAutofillInsideDDG().isEnabled().not() && nodeToAutofill.packageId in DDG_PACKAGE_IDS) {
return true
}

if (nodeToAutofill.packageId in BROWSERS_PACKAGE_IDS && nodeToAutofill.website.isNullOrBlank()) {
return true // if a browser we require a website
}

return false
}
Expand Down Expand Up @@ -136,9 +143,10 @@ class RealAutofillService : AutofillService() {
}

companion object {
private val PACKAGES_TO_EXCLUDE = setOf(
private val DDG_PACKAGE_IDS = setOf(
"com.duckduckgo.mobile.android",
"com.duckduckgo.mobile.android.debug",
)
private val BROWSERS_PACKAGE_IDS = DDG_PACKAGE_IDS
}
}

0 comments on commit aacc744

Please sign in to comment.