Android icon indicating copy to clipboard operation
Android copied to clipboard

Refactor install-age calculation into AppInstall.getInstallAge()

Open lmac012 opened this issue 5 months ago • 1 comments

Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1215957241503520?focus=true Tech Design URL (if applicable):

Description

Extracts the "time since install" calculation out of DuckChatJSHelper behind a new suspend fun AppInstall.getInstallAge(): Duration? (kotlin.time). getInstallAgeBucket() is now a thin mapping from the returned Duration to the existing buckets, and the withContext(io) + clock + Instant/ChronoUnit plumbing moves into AppInstallRepository.

getInstallationTimestamp() is unchanged, so the attributed-metrics consumers are untouched. The Duck.ai install-age pixel semantics are unchanged (null when the timestamp is not recorded or is in the future).

Note: this adds a method to the :browser-api AppInstall public API; a separate API proposal accompanies it.

Steps to test this PR

Install-age bucketing is unchanged

  • [ ] ./gradlew :duckchat-impl:testDebugUnitTest --tests "com.duckduckgo.duckchat.impl.helper.RealDuckChatJSHelperTest" — install-age bucket tests pass (days→bucket 0..5; null → param omitted).
  • [ ] ./gradlew :app:testPlayDebugUnitTest --tests "com.duckduckgo.app.global.install.AppInstallRepositoryTest" — not-recorded and future → null; past → elapsed Duration.

UI changes

Before After
No UI changes No UI changes

lmac012 avatar Jun 24 '26 22:06 lmac012

This stack of pull requests is managed by Graphite. Learn more about stacking.

lmac012 avatar Jun 24 '26 22:06 lmac012