Repository navigation
Only let Loop purge its HealthKit glucose while eavesdropping - #95
Merged
Merged
Conversation
managedDataInterval was always 3 hours, so Loop deleted its own glucose samples from HealthKit after 3 hours even in direct mode, where the Dexcom app isn't connected and never writes its copies. HealthKit was left with only the last 3 hours of readings. It is now nil in direct mode, as CGMBLEKit already does outside passive mode.
This was referenced Oct 15, 2026
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.
managedDataIntervalwas always 3 hours. Loop therefore deleted its own glucose samples from HealthKit after 3 hours even in direct mode. In that mode the Dexcom app isn't connected and never writes its copies, so Health was left with only the last 3 hours of readings. That matches a next-dev user's report on Zulip of glucose data disappearing from Apple Health.It is now nil in direct mode and stays 3 hours while eavesdropping. CGMBLEKit already handles G5/G6 this way, returning 3 hours only in passive mode.
Related:
managedDataIntervalat setup. Refresh the managed HealthKit interval on CGM status updates Loop#2584 refreshes it on status updates, so a switch between modes takes effect right away.Tested: simulator build of the LoopWorkspace scheme. Not tested with a sensor.