Add dismissable top banner for Nightscout, Dexcom, and heartbeat issues#696
Open
bjorkert wants to merge 2 commits into
Open
Add dismissable top banner for Nightscout, Dexcom, and heartbeat issues#696bjorkert wants to merge 2 commits into
bjorkert wants to merge 2 commits into
Conversation
Failed BG downloads were only visible in the log viewer, and a failed Dexcom Share login silently fell back to Nightscout. Users with a bad token, mistyped URL, or wrong Dexcom credentials saw no data with no explanation. Add a banner above the tab view (visible on every tab, pushes content down) that surfaces these failures with a clear cause: - Nightscout fetch failures trigger a rate-limited status.json probe to classify the error (invalid token, token required, site not found, no network) using the existing NightscoutError messages. - Dexcom Share errors are mapped to friendly text (account not found, incorrect username or password, too many attempts), including the current AccountPasswordInvalid code alongside the legacy SSO_ ones. The previously silent Nightscout fallback is now shown as a warning. - Banners clear automatically on a successful fetch or when the source is deconfigured. Dismissing a banner suppresses that exact error for 30 minutes; a different error shows immediately. - Repeated failing retries reuse the same message so the banner does not re-animate every cycle. Also fix verifyURLAndToken transport-error classification, which reported DNS/connection failures as siteNotFound and everything else as networkError; it now distinguishes them by URLError code, which also improves the settings status label.
Member
Author
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.

Summary
Failed BG downloads are currently only visible in the log viewer, and a failed Dexcom Share login silently falls back to Nightscout — a user with a bad token, mistyped URL, or wrong Dexcom credentials sees no data with no explanation.
This adds a dismissable banner above the tab view. It is visible on every tab and pushes the content down (up to 3 lines) rather than overlaying it.
What it does
status.jsonclassifies the cause, so the banner can say why — "The token is invalid.", "A token is required.", "The site was not found.", "A network error occurred." — reusing the sameNightscoutErrormessages the settings screen shows. If the server is reachable but the data fetch still failed, a softer warning says so.ShareErrorlogin codes are mapped to friendly text (account not found, incorrect username or password, too many failed attempts). Matching is by substring so both the legacySSO_Authenticate…codes and the currentAccountPasswordInvalidare covered. When Nightscout is configured as backup, the previously silent fallback is now surfaced as a warning ("… Using Nightscout as backup.") while data keeps flowing.The banner system is generic (
BannerManager.report/clearwith acustomsource), so other important notices can use it later.Also fixed
NightscoutUtils.verifyURLAndTokenclassified transport errors backwards: DNS/connection failures were reported assiteNotFoundand everything else asnetworkError. It now distinguishes them byURLErrorcode, which also improves the status label in Nightscout settings.