Add per-source sleep stage comparison bars on recent sleep rows#24
Draft
gsbernstein wants to merge 3 commits into
Draft
Add per-source sleep stage comparison bars on recent sleep rows#24gsbernstein wants to merge 3 commits into
gsbernstein wants to merge 3 commits into
Conversation
Expose unfiltered allSleepSessions from HealthKitManager so the UI can compare data across sources even when some are disabled in settings. Add SleepSourceComparisonView with aligned, color-coded stage timelines — one bar per source, dimmed when the source is excluded. Show the comparison at the bottom of each collapsed day row when multiple sources contribute data or a disabled source still has samples for that night. Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.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.
Summary
Adds aligned, color-coded sleep stage timelines to each day row in Recent Sleep so you can quickly compare tracked data across HealthKit sources — including sources you've disabled in settings.
Changes
HealthKitManager: publishesallSleepSessionsalongside the filteredsleepSessions, so comparison UI can show disabled sources without affecting sleep bank calculations.SleepSourceComparisonView: new component with one horizontal bar per source, segments colored by sleep stage (deep, REM, core, etc.) and aligned to a shared time range for the night. Each row now shows total measured sleep (H:MM) on the right.SleepDayGroup: shows the comparison bars at the bottom of each collapsed row when multiple sources have data for that night, or when a disabled source still has samples.UI behavior
Testing
Requires macOS/Xcode — build and run on simulator/device with sleep data from multiple HealthKit sources (e.g. Apple Watch + iPhone). Use Settings → Data Sources to toggle sources and verify dimmed bars still appear for disabled ones.