Skip to content

All five points are addressed. Fixed in #28. - #44

Merged
davidreband merged 3 commits into
Doichain:devfrom
davidreband:dev
Oct 15, 2026
Merged

davidreband merged 3 commits into
Doichain:devfrom
davidreband:dev

Conversation

@davidreband

Copy link
Copy Markdown
Collaborator
  1. The widget labels the amount "DOI:" in all three of its states.
  2. The volume is labelled "Volume 24h:". Its cached state printed the literal
    string "volume" in place of the figure; that is fixed.
  3. and 4. The price comes from the ticker endpoint asked for here,
    api.coinpaprika.com/v1/tickers/doi-doicoin?quotes=<CUR>, read from
    quotes.<CUR>.price rather than from an opening price. Verified on a device:
    0.038911857349859975 USD.
  4. The frame that stood off from the widget is gone and the reserved area
    matches what is drawn. Confirmed on a device.

David Reband and others added 3 commits October 15, 2026 12:22
The widget passed the string the API returned straight into the view, so
a reported change of 32.0099 appeared as "32.0099%" while the price and
the volume beside it were formatted through NumberFormat. The change now
goes through a NumberFormat of its own, which rounds it to two digits and
follows the same locale as its neighbours.

The value is parsed once with toDoubleOrNull rather than twice with
toDouble, so a malformed reading hides the block instead of throwing. The
null check it replaces could never fire - the parameter is non-null.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three faults sat in the paths the widget takes when the price fetch does
not go cleanly.

handlePriceResult asserted volume and percent non-null with !! before
handing them to displayCachedPrice - on the very branch that runs when
the fetch failed, which is where both are most likely to be absent. The
widget threw instead of showing the cached price. Both parameters are
nullable now, and the renderers decide what to draw.

displayCachedPrice wrote the literal string "volume" into the volume
field and left the change hidden behind a commented-out line, so a widget
falling back to its cache looked broken. Both now render for real.

showLoadingError left the change block visible with whatever it held
before, so an error state kept displaying a stale figure.

Drawing the change and the volume moved into renderPercentChange and
renderVolume, shared by all three states. The volume is formatted as a
Double rather than converted to an Int, which pinned anything above
roughly 2.1 billion to Int.MAX_VALUE, and the arrow follows the rounded
change so that one displaying as 0.00% is not drawn as a fall.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
scheduleWork enqueued a periodic request alone. A periodic request does
not run when it is enqueued - its first execution falls somewhere inside
the first interval - and the policy was REPLACE, so every refreshWidget
call cancelled the pending run and started the fifteen minutes over.
refreshWidget runs on every onUpdate and on every resize, and it puts the
widget into its loading state first, so a widget the launcher refreshed
often enough never reached a reading at all. On the test device the
worker had not run once.

A one-off request now carries the immediate update and the periodic one
keeps its schedule with KEEP. Measured on the device, the worker starts
0.18s after the widget asks for a refresh and has a price 2s later.

onDisabled cancels both unique work names.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@davidreband
davidreband merged commit 2e9fca6 into Doichain:dev Oct 15, 2026
2 checks 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.

1 participant