Skip to content

Commit 5f08423

Browse files
authored
Set password last-used timestamp upon creation (#7170)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1203822806345703/task/1206929637235170?focus=true ### Description Set last used timestamp for any new credentials created either via the Save prompt or manually. It will not be set / updated via any password edit or update actions. ### Steps to test this PR _Feature 1_ - [ ] - [ ] ### UI changes | Before | After | | ------ | ----- | !(Upload before screenshot)|(Upload after screenshot)|
1 parent 095ce56 commit 5f08423

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/SecureStoreBackedAutofillStore.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,14 @@ class SecureStoreBackedAutofillStore @Inject constructor(
167167

168168
logcat(INFO) { "Saving login credentials for $url. username=${credentials.username}" }
169169

170+
val timestamp = lastUpdatedTimeProvider.getInMillis()
171+
170172
val loginDetails = WebsiteLoginDetails(
171173
domain = url,
172174
username = credentials.username,
173175
domainTitle = credentials.domainTitle,
174-
lastUpdatedMillis = lastUpdatedTimeProvider.getInMillis(),
176+
lastUpdatedMillis = timestamp,
177+
lastUsedInMillis = timestamp,
175178
)
176179
val webSiteLoginCredentials = WebsiteLoginDetailsWithCredentials(
177180
details = loginDetails,

autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/SecureStoreBackedAutofillStoreTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,10 @@ class SecureStoreBackedAutofillStoreTest {
547547
)
548548
testee.saveCredentials(url, credentials)
549549

550-
assertEquals(credentials.copy(domain = "example.com", lastUpdatedMillis = UPDATED_INITIAL_LAST_UPDATED), testee.getCredentials(url)[0])
550+
assertEquals(
551+
credentials.copy(domain = "example.com", lastUpdatedMillis = UPDATED_INITIAL_LAST_UPDATED, lastUsedMillis = UPDATED_INITIAL_LAST_UPDATED),
552+
testee.getCredentials(url)[0],
553+
)
551554
}
552555

553556
@Test

0 commit comments

Comments
 (0)