You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent onboarded autofill metric overfiring if called multiple times quickly (#4563)
Task/Issue URL:
https://app.asana.com/0/608920331025315/1207360368013215/f
### Description
Prevent onboarding metric getting over-triggered if multiple credentials
added quickly in a short amount of time
### Steps to test this PR
QA-optional
Copy file name to clipboardExpand all lines: autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/engagement/EngagementPasswordAddedListener.kt
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,15 @@ class EngagementPasswordAddedListener @Inject constructor(
38
38
privatevalpixel:Pixel,
39
39
) : PasswordStoreEventListener {
40
40
41
+
// keep in-memory state to avoid sending the pixel multiple times if called repeatedly in a short time
42
+
privatevar credentialAdded =false
43
+
44
+
@Synchronized
41
45
overridefunonCredentialAdded(id:Long) {
46
+
if (credentialAdded) return
47
+
48
+
credentialAdded =true
49
+
42
50
appCoroutineScope.launch(dispatchers.io()) {
43
51
val daysInstalled = userBrowserProperties.daysSinceInstalled()
Copy file name to clipboardExpand all lines: autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/engagement/EngagementPasswordAddedListenerTest.kt
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ class EngagementPasswordAddedListenerTest {
0 commit comments