Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Health] improve support for sleep stages #1026

Merged
merged 25 commits into from
Aug 30, 2024
Merged

Conversation

SlimShadyIAm
Copy link
Contributor

Previously, not all the sleep stages that are supported in HealthKit and Health Connect were supported in the Health package. On the iOS side, some of the sleep stages were supported but undocumented. This PR improves support and documentation for all possible sleep stages across both platforms:

Closes #985.

Overview of the changes

Stage iOS Android Notes
SLEEP_ASLEEP on iOS this refers to asleepUnspecified
SLEEP_AWAKE
SLEEP_AWAKE_IN_BED (NEW)
SLEEP_DEEP combined
SLEEP_IN_BED
SLEEP_LIGHT combined - on iOS this refers to asleepCore
SLEEP_OUT_OF_BED
SLEEP_REM combined
SLEEP_UNKNOWN (NEW)
  • SLEEP_CORE was renamed to SLEEP_LIGHT to be consistent with Android, as HealthKit documentation states that the asleepCore stage includes "light sleep".
  • Introduce new Health Connect sleep stage that was previously unsupported: SLEEP_UNKNOWN and SLEEP_AWAKE_IN_BED.
  • Remove undocumented HealthKit sleep stages: SLEEP_ASLEEP_CORE, SLEEP_ASLEEP_DEEP, SLEEP_ASLEEP_REM and combine them into the previously existing Android stages: SLEEP_DEEP, SLEEP_REM (and as previously mentioned SLEEP_ASLEEP_CORE becomes SLEEP_LIGHT.
  • SLEEP_ASLEEP on iOS previously referred to asleepCore, which is incorrect - it should refer to when the user is asleep but the sleep stage cannot be determined, and as such it now refers to asleepUnspecified.

@SlimShadyIAm SlimShadyIAm changed the base branch from feature/remove-google-fit to master August 30, 2024 11:35
@SlimShadyIAm SlimShadyIAm marked this pull request as ready for review August 30, 2024 12:16
Copy link
Contributor

@bardram bardram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SlimShadyIAm SlimShadyIAm merged commit 2fb639d into master Aug 30, 2024
@SlimShadyIAm SlimShadyIAm deleted the feature/improve-sleep branch August 30, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants