Skip to content

[Feature]: AI token usage meter / daily quota display #37

Description

@MRAKS05

Problem

The app tracks daily Gemini API usage (SettingsManager.kt, lines 105-137) with a 20-request-per-day limit, but users have no visibility into how many requests they've used. The only indication is in DashboardScreen.kt (line 138) which shows "Limit Reached" or a generic status — no usage count, no progress, no reset timer.

Current state in codebase

  • SettingsManager.geminiApiCount: Tracks today's usage (lines 105-108)
  • SettingsManager.lastApiDate: Tracks which day the count is for (lines 111-114)
  • SettingsManager.canUseGeminiApi(): Returns boolean — over/under limit (lines 117-123)
  • SettingsManager.tryUseGeminiApi(): Atomically checks and increments (lines 125-137)
  • No getter to expose the current count publicly — geminiApiCount is a private var

Proposed Solution

Add a visible usage meter showing the user their daily AI service consumption.

Requirements

  • Usage counter: Show "X / 20 requests used today" in a visible location
  • Progress bar: Visual indicator (green → yellow → red as limit approaches)
  • Reset timer: Show when quota resets ("Resets at midnight")
  • Dashboard card: Add or update the Gemini status in DashboardScreen.kt (currently just shows "Active"/"Quota Exceeded"/"Not Configured" on lines 130-142)
  • Settings card: Add usage stats in the Settings API configuration section
  • Future-proof: Design to work with multiple providers from issue [Feature]: Support multiple AI service providers (beyond Gemini) #35 — each provider would have its own usage tracker

Implementation notes

  • Expose current count from SettingsManager (add a getter for geminiApiCount)
  • Add a simple progress composable: ${usedCount} / ${dailyLimit} with a LinearProgressIndicator
  • Calculate time until next reset from current time to midnight
  • For Gemini, the daily limit is hardcoded at 20 — make it configurable or expose it

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: dataSettingsManager, ExceptionsManager, Room database, SharedPreferencesarea: uiScreens, navigation, composables, themingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions