Description
Create the StatsCollector service that orchestrates statistics collection and sending, as well as its integration into MainRepository.
File to create
app/src/main/java/com/vrhub/data/StatsCollector.kt
Service API
| Method |
Description |
collectStats(installedGames, userTier) |
Checks consent, builds payload and sends via StatsApiService |
updateConsent(enabled) |
Updates consent on the server side |
getUserTier(email) |
Fetches tier from /user/tier |
Integration points in MainRepository
- After
syncCatalog() → maybeCollectStats()
- After
toggleFavorite() → maybeCollectStats()
Error handling
- Network Error → Retry max 3 (exponential backoff)
- HTTP 403 → Consent revoked server-side, stop future collections
- HTTP 5xx → Retry max 3
- Other → Log error, do not block UI
Reference
docs/CLIENT_SPEC.md §3, §4
docs/CLIENT_IMPLEMENTATION.md §7, §8
Description
Create the
StatsCollectorservice that orchestrates statistics collection and sending, as well as its integration intoMainRepository.File to create
app/src/main/java/com/vrhub/data/StatsCollector.ktService API
collectStats(installedGames, userTier)StatsApiServiceupdateConsent(enabled)getUserTier(email)/user/tierIntegration points in
MainRepositorysyncCatalog()→maybeCollectStats()toggleFavorite()→maybeCollectStats()Error handling
Reference
docs/CLIENT_SPEC.md§3, §4docs/CLIENT_IMPLEMENTATION.md§7, §8