Show all days in recent sleep list, including days without data#9
Merged
Conversation
Fill the Recent Sleep list with every day in the 30-day history window instead of only days that have HealthKit sessions. Empty days display 'No sleep data', 0:00 duration, and the full goal deficit. Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the “Recent Sleep” UI to display a continuous day-by-day history (including days with no HealthKit sleep sessions), and centralizes the shared history window length used across fetching and display.
Changes:
- Introduces
Constants.sleepHistoryDaysto share the history window length. - Builds the Recent Sleep list from a complete day range rather than only days with sessions.
- Adds an empty-state presentation for days with no sessions and disables expansion for those rows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Bedtime/Bedtime/Views/RecentSleepSessionsCard.swift | Generates a fixed day range for the recent list and fills missing days with empty session arrays. |
| Bedtime/Bedtime/Views/Components/SleepDayGroup.swift | Adds “No sleep data” UI and prevents expanding rows with no sessions. |
| Bedtime/Bedtime/Models/HealthKitManager.swift | Uses the shared constant for the HealthKit lookback window. |
| Bedtime/Bedtime/Constants.swift | Adds sleepHistoryDays constant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@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
The Recent Sleep list previously only showed days that had HealthKit sleep sessions. Days with no tracked sleep were omitted entirely, making gaps in the history hard to see.
This change fills the list with every day in the 30-day history window (matching the HealthKit fetch range). Days without data now appear with:
Empty days are not expandable since there are no sessions to show.
Changes
Constants.sleepHistoryDays(30) shared by HealthKit fetch and the recent sleep listRecentSleepSessionsCardgenerates a complete day range instead of iterating only over days with sessionsSleepDayGrouphandles empty session arrays with appropriate empty-state UI