Skip to content

[Service] Create StatsCollector and integrate with MainRepository #40

@LeGeRyChEeSe

Description

@LeGeRyChEeSe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions