Repository navigation
All five points are addressed. Fixed in #28. - #44
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
string "volume" in place of the figure; that is fixed.
api.coinpaprika.com/v1/tickers/doi-doicoin?quotes=<CUR>, read fromquotes.<CUR>.pricerather than from an opening price. Verified on a device:0.038911857349859975USD.matches what is drawn. Confirmed on a device.