Bars widget: fix empty progress bar + dead-feeling date pickers (KC-18)
- Persist a per-event "first tracked" anchor in the App Group instead of
resetting the progress start to now on every refresh (auto mode), so
the bar actually fills toward the event. Explicit "Counting from" wins
when it's before the event date.
- Make Event date / Counting from optional ("Choose") — the same-second
defaults produced a zero-length span (always 0%) and looked broken.
- Pre-render timeline entries every 30 min (12h horizon) so the bar and
time-left label move between refreshes instead of only at midnight.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -550,3 +550,37 @@ to standard and removed entirely from the gallery.
|
||||
Files modified: `KisaniCalWidgets.swift`, `EventCountdownWidget.swift`,
|
||||
`WidgetViews.swift`, `WidgetData.swift`. No files deleted (shared code remains
|
||||
in EventCountdownWidget.swift). No app-side settings referenced these widgets.
|
||||
|
||||
---
|
||||
|
||||
## KC-18 — Bars widget: progress bar never fills; date pickers felt broken
|
||||
|
||||
**Status:** In Progress (implemented & build-verified, pending device build)
|
||||
**Reported by:** User
|
||||
**Area:** Widgets
|
||||
|
||||
### Symptoms
|
||||
The Event Countdown (Bars) widget showed all bars dim regardless of time left,
|
||||
and the Event date / Counting from rows in the config appeared not to work.
|
||||
|
||||
### Root causes
|
||||
1. Auto (upcoming-queue) mode anchored progress to `Date()` on **every** refresh,
|
||||
so elapsed time was always ~0 → empty bar forever.
|
||||
2. Custom mode defaulted both `Event date` and `Counting from` to the same
|
||||
instant (`Date.now` at config time) → zero-length span → progress 0. The raw
|
||||
second-precision defaults also made the picker rows look broken.
|
||||
3. The timeline only refreshed at midnight, so even a correct bar wouldn't move
|
||||
during an "X hr left" countdown.
|
||||
|
||||
### Fix
|
||||
- Persistent per-event anchor (`kisani.widget.anchor.<id>` in the App Group):
|
||||
progress fills from when an event was first tracked and resets naturally when
|
||||
the tracked event changes. An explicit "Counting from" before the event wins.
|
||||
- `targetDate`/`startDate` are now optional — rows read "Choose" until set, and a
|
||||
missing custom date falls back to a 2-day stub window.
|
||||
- Timeline pre-renders an entry every 30 minutes (12 h horizon) so the bar and
|
||||
time-left label keep moving.
|
||||
|
||||
Files: `KisaniCalWidgets/EventCountdownWidget.swift`.
|
||||
Note: existing widget instances re-read their config; dates must be re-picked
|
||||
once (params changed to optional).
|
||||
|
||||
Reference in New Issue
Block a user