fix: detect source unit from companion app package name in UiBasedCollector - #4648
Open
ryceg wants to merge 1 commit into
Open
fix: detect source unit from companion app package name in UiBasedCollector#4648ryceg wants to merge 1 commit into
ryceg wants to merge 1 commit into
Conversation
…lector Companion apps like CamAPS and Dexcom encode their unit choice in the package suffix (e.g. `.mmoll`, `.mgdl`). Previously UiBasedCollector parsed scraped values using xDrip's own unit preference, which silently corrupted readings when the user's xDrip was set to mg/dL but the source app was a mmol build (or vice-versa). Introduces `sourcePackageUsesMgDl()` which checks the captured `lastPackage` for `.mmol`/`.mmoll`/`.mgdl` markers before falling back to xDrip's `Unitized.usingMgDl()`. Covers CamAPS fx_alert (mmoll/mgdl, with optional hx and region suffixes) and Dexcom G6 region1/2/4 variants. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Split out of #4529 so it can be reviewed on its own merits.
Many companion apps encode their glucose unit in the package name (e.g.
.mmol,.mmoll,.mgdl). UiBasedCollector previously interpreted scraped values using xDrip's own display unit preference, so an mmol/L value from a companion app could be parsed as mg/dL (or vice versa) when the two disagreed. This detects the source unit from the companion package name and falls back to xDrip's preference when the name carries no unit hint.Includes unit tests for the package-name detection.