Skip to content

Commit fb4f64c

Browse files
authored
Add exclusion for Duck Address setup URL so it won't show import promo (#6534)
Task/Issue URL: https://app.asana.com/1/137249556945/project/608920331025315/task/1210976518417926?focus=true ### Description Excludes Email Protection setup pages from showing password import prompts. ### Steps to test this PR - QA optional - If you want to test, can fresh install, then can access Email Protection set up pages and confirm promo doesn't show Co-authored-by: Craig Russell <[email protected]>
1 parent 607f8bf commit fb4f64c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/InBrowserImportPromo.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RealInBrowserImportPromo @Inject constructor(
5353
return@withContext false
5454
}
5555

56-
if (url == null) {
56+
if (url == null || url.isExcludedFromPromo()) {
5757
return@withContext false
5858
}
5959

@@ -93,6 +93,10 @@ class RealInBrowserImportPromo @Inject constructor(
9393
}
9494
}
9595

96+
private fun String.isExcludedFromPromo(): Boolean {
97+
return this.startsWith(EMAIL_PROTECTION_SETTINGS_URL_PREFIX)
98+
}
99+
96100
private fun featureEnabled(): Boolean {
97101
if (autofillFeature.self().isEnabled().not()) return false
98102
if (autofillFeature.canPromoteImportGooglePasswordsInBrowser().isEnabled().not()) return false
@@ -102,5 +106,6 @@ class RealInBrowserImportPromo @Inject constructor(
102106
companion object {
103107
const val MAX_PROMO_SHOWN_COUNT = 5
104108
const val MAX_CREDENTIALS_FOR_PROMO = 25
109+
private const val EMAIL_PROTECTION_SETTINGS_URL_PREFIX = "https://duckduckgo.com/email/"
105110
}
106111
}

autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/importing/RealInBrowserImportPromoTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,20 @@ class RealInBrowserImportPromoParameterizedTest(
292292
expected = true,
293293
description = "eligible: promo not previously shown for url",
294294
),
295+
CanShowPromoTestCase(
296+
credentialsAvailableForCurrentPage = false,
297+
url = "https://duckduckgo.com/email/login",
298+
inBrowserPromoFeatureEnabled = true,
299+
autofillFeatureEnabled = true,
300+
hasEverImportedPasswords = false,
301+
hasDeclinedPromo = false,
302+
credentialCount = 0,
303+
promoShownCount = 0,
304+
webViewSupportsImportingPasswords = true,
305+
promoPreviouslyShownForUrl = false,
306+
expected = false,
307+
description = "ineligible: promo won't show for Email Protection URLs",
308+
),
295309
)
296310
}
297311

0 commit comments

Comments
 (0)