Skip to content

feat: show time until usage window reset in notch usage bars#9

Merged
grayashh merged 2 commits into
talkvalue:mainfrom
Jduarte-BOA:feat/usage-reset-countdown
Jun 12, 2026
Merged

feat: show time until usage window reset in notch usage bars#9
grayashh merged 2 commits into
talkvalue:mainfrom
Jduarte-BOA:feat/usage-reset-countdown

Conversation

@Jduarte-BOA

@Jduarte-BOA Jduarte-BOA commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

The usage cache already stores resetsAt for both the five hour and seven day quota windows, and BuddyTabView already contains a formatResetTime helper, but it was never wired into the UI, so the open notch only shows utilization percentages. This PR appends the reset countdown to the UsageBar detail label:

  • Session 3% · 4h 52m
  • Weekly 23% · Thu 8 PM (existing helper falls back to day + hour when more than 24h away)

When resetsAt is missing the label falls back to the current percent-only format.

Type of change

  • Bug fix
  • New feature
  • Enhancement
  • Documentation
  • Chore (build, CI, refactor)

Checklist

  • I have tested this on a macOS device
  • My code follows the existing style of this project
  • I have updated documentation if needed
  • This PR is focused on a single change

Testing notes, in the spirit of the AI tool policy: this change was written with AI assistance and human-reviewed. The data path (usage-cache.json populated with resetsAt for both windows, rendered through formatResetTime) was verified against a live Buddi install on macOS 26.5 with an external display notch. I do not have a local Xcode release build of the full app, so I am relying on CI for build verification; happy to iterate if anything fails.

Screenshots

Label change only: the usage bar detail goes from 3% to 3% · 4h 52m.

Review in cubic

The usage cache already stores resetsAt for both the five hour and
seven day windows, and BuddyTabView already has a formatResetTime
helper, but it was never wired into the UI. Append the countdown to
the UsageBar detail label so the open notch shows e.g.
"Session 3% · 4h 52m" and "Weekly 23% · Thu 8 PM".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jduarte-BOA Jduarte-BOA requested a review from grayashh as a code owner June 12, 2026 16:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 3/5

  • In buddi/Buddi/Bridge/BuddyTabView.swift, the reset countdown text may stop updating because the view lacks a periodic refresh trigger, so users can see inaccurate time-remaining information after merging — add a timer-driven/state refresh (and a quick UI check) before merging.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread buddi/Buddi/Bridge/BuddyTabView.swift Outdated
The countdown string was computed at render time, so it only updated
when UsageService published new data (5 min poll, up to 30 min with
backoff). Drive the usage bars from a 60s TimelineView and compute the
remaining time from context.date so the label stays current between
polls. Extract the bars into a usageBars(now:) helper to keep layout
identical (explicit VStack, spacing 3).

Addresses cubic review feedback on the periodic refresh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@grayashh grayashh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for your contribution.

@grayashh grayashh merged commit ef70ed7 into talkvalue:main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants