Add tap-to-toggle Mbps / bytes-per-second display for live rates - #2
Open
NickLD wants to merge 6 commits into
Open
Add tap-to-toggle Mbps / bytes-per-second display for live rates#2NickLD wants to merge 6 commits into
NickLD wants to merge 6 commits into
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S55LqTjgjjwnYv9YVcYL4h
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S55LqTjgjjwnYv9YVcYL4h
…erSec naming Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S55LqTjgjjwnYv9YVcYL4h
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.
What this adds
Tapping the unit label on the "Proxy Speed" card cycles the live upload/download rate display between the existing binary bytes/sec ladder (B/s, KB/s, MB/s, GB/s) and standard decimal Mbps (bps, Kbps, Mbps, Gbps) — the convention carriers, speed-test tools, and routers use for reporting speed. The choice persists across restarts and is reflected in both the in-app card and the persistent foreground notification, so the two never disagree.
Why
Comparing DataProxy's reported speed against a carrier's advertised rate, a speed-test app, or a router's throughput display currently means mentally converting bytes to bits. This makes that comparison direct.
Implementation
RateUnitenum (BytesPerSecond/Mbps), modeled on the existingThemeModepreference pattern.SpeedometerCard, one inProxyService, one already-unused inByteFormatter) into a singleByteFormatter.rate(bps, unit). Mbps math is bytes→bits (×8) then walked on a decimal (÷1000) ladder — deliberately not the same ÷1024 base as the byte ladder, since that's how Mbps is conventionally reported.SharedPreferencesfile as every other setting, in a key shared betweenMainViewModel(writes on tap) andProxyService(reads live on every notification rebuild, same pattern already used for auth config) — so toggling while the proxy is running updates the notification within a second, no restart needed.Default is the existing byte-based display, so nothing changes for anyone who doesn't tap it.
Testing
This project has no automated test framework, so this was verified by building and manually walking through it on a real device: default state, tap-to-toggle (confirmed both the download and upload tiles switch together, since it's one shared preference, not two independent ones), notification match, persistence across a force-stop/relaunch, and toggling back.
Scope
Independent of my other open PR (the connection-concurrency fix) — this one touches entirely different files (UI/preferences vs. relay threading) and has no dependency on it either direction.