Repository navigation
feat(mobile): Used/Remaining setting for the phone's usage bars - #43864
Conversation
Settings > Appearance gets a per-device Usage percentages choice. Home and Accounts bars fill to the chosen percentage, keep colouring by consumption, and read "N% left" when showing what remains. Open Accounts pages follow the setting through the page storage refresh; older pages and phones keep showing used. Co-authored-by: gsxdsm <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
Desktop lets you choose whether usage bars count up (how much you've used) or count down (how much is left). The phone always counted up. Now the phone has the same choice in Settings › Appearance.
What Changed
orca:usagePercentageDisplayis now in the page storage allowlist, in the negotiated keys, and in the list of keys the app republishes when Settings changes. On a page, the hook reads the app's copy of the setting.composer-usage-display-preference.tsin feat(mobile): usage meter in the chat composer #36746, renamed and pointed at the bars.Why
The phone always showed percentage used, but desktop has a Used/Remaining preference (
usagePercentageDisplay). The issue asks for the same choice on the phone. Kelvin approved this design (option A) before it was built.Supersedes the Used/Remaining part of #36746 by @gsxdsm. We kept their per-device preference store. Their PR is mostly a chat-composer usage meter stacked on #36726, which is parked for now.
Linked Issue
Fixes #27737
Visual Proof
These are rendered from the real mobile components (React Native Web, 390 pt wide) on the same host snapshot. Settings and Home are native screens, so they're shown with the same section, row and meter components and the same styles, not inside the app shell.
Testing
Mobile typecheck and test typecheck pass, as do
check:changed,check:code-quality:changedandverify:mobile-localization.The 35 mobile test files related to the changed modules pass (131 tests). These include the page storage key and page AsyncStorage suites.
The path from native Settings to an open Accounts page was traced by both reviewers but not run on a device:
persistMirrored, then the mirrored-key listener, then the page storage refresh frame, then the page'suseShellStorage. It's the same pathorca:nativeChatTextalready uses.No tests added. The display math is desktop's shared
getDisplayedUsagePercentage, and the storage lists are plain allowlist entries.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part is the page storage contract. The new key is negotiated, so the app only sends it to a page that lists it in
storageKeys. An Accounts page served by an older desktop never receives it and keeps showing Used. An older phone never sends it, so a newer page also shows Used. Home and Settings are native, so they follow the setting on any host.Users who never touch the setting see no change.
Back out with a plain revert. A saved
orca:usagePercentageDisplayvalue stays in phone storage, unused.Level: Low
AI Disclosure
Review
Two reviewers, one round. Neither found a P0, P1 or P2. Changes from the review:
Agent skill upstream boundary
Notes
The preference store is credited to @gsxdsm (#36746) with a
Co-authored-bytrailer. Mobile: older phones and older desktop pages keep Used, as described above. SSH/remote: none. Cross-platform: none.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)