diff --git a/packages/health/README.md b/packages/health/README.md index 1e47314a3..1e3ab89ff 100644 --- a/packages/health/README.md +++ b/packages/health/README.md @@ -257,7 +257,8 @@ flutter: PlatformException(FlutterHealth, Results are null, Optional(Error Doma ``` ### Filtering by recording method -Google Health Connect and Apple HealthKit both provide ways to distinguish samples collected "automatically" and manually entered data by the user. + +Google Health Connect and Apple HealthKit both provide ways to distinguish samples collected "automatically" and manually entered data by the user. - Android provides an enum with 4 variations: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#summary - iOS has a boolean value: https://developer.apple.com/documentation/healthkit/hkmetadatakeywasuserentered @@ -275,8 +276,7 @@ List healthData = await Health().getHealthDataFromTypes( **Note that for this to work, the information needs to have been provided when writing the data to Health Connect or Apple Health**. For example, steps added manually through the Apple Health App will set `HKWasUserEntered` to true (corresponding to `RecordingMethod.manual`), however it seems that adding steps manually to Google Fit does not write the data with the `RecordingMethod.manual` in the metadata, instead it shows up as `RecordingMethod.unknown`. This is an open issue, and as such filtering manual entries when querying step count on Android with `getTotalStepsInInterval(includeManualEntries: false)` does not necessarily filter out manual steps. -**NOTE**: On iOS, you can only filter by `RecordingMethod.automatic` and `RecordingMethod`.manual` as it is stored `HKMetadataKeyWasUserEntered` is a boolean value in the metadata. - +**NOTE**: On iOS, you can only filter by `RecordingMethod.automatic` and `RecordingMethod.manual` as it is stored `HKMetadataKeyWasUserEntered` is a boolean value in the metadata. ### Filtering out duplicates @@ -301,57 +301,59 @@ points = Health().removeDuplicates(points); The plugin supports the following [`HealthDataType`](https://pub.dev/documentation/health/latest/health/HealthDataType.html). -| **Data Type** | **Unit** | **Apple Health** | **Google Health Connect** | **Comments** | -| ---------------------------- | ----------------------- | ---------------- | ------------------------- | -------------------------------------- | -| ACTIVE_ENERGY_BURNED | CALORIES | yes | yes | | -| BASAL_ENERGY_BURNED | CALORIES | yes | yes | | -| BLOOD_GLUCOSE | MILLIGRAM_PER_DECILITER | yes | yes | | -| BLOOD_OXYGEN | PERCENTAGE | yes | yes | | -| BLOOD_PRESSURE_DIASTOLIC | MILLIMETER_OF_MERCURY | yes | yes | | -| BLOOD_PRESSURE_SYSTOLIC | MILLIMETER_OF_MERCURY | yes | yes | | -| BODY_FAT_PERCENTAGE | PERCENTAGE | yes | yes | | -| BODY_MASS_INDEX | NO_UNIT | yes | yes | | -| BODY_TEMPERATURE | DEGREE_CELSIUS | yes | yes | | -| BODY_WATER_MASS | KILOGRAMS | | yes | | -| ELECTRODERMAL_ACTIVITY | SIEMENS | yes | | | -| HEART_RATE | BEATS_PER_MINUTE | yes | yes | | -| HEIGHT | METERS | yes | yes | | -| RESTING_HEART_RATE | BEATS_PER_MINUTE | yes | yes | | -| RESPIRATORY_RATE | RESPIRATIONS_PER_MINUTE | yes | yes | | -| PERIPHERAL_PERFUSION_INDEX | PERCENTAGE | yes | | | -| STEPS | COUNT | yes | yes | | -| WAIST_CIRCUMFERENCE | METERS | yes | | | -| WALKING_HEART_RATE | BEATS_PER_MINUTE | yes | | | -| WEIGHT | KILOGRAMS | yes | yes | | -| DISTANCE_WALKING_RUNNING | METERS | yes | | | -| FLIGHTS_CLIMBED | COUNT | yes | yes | | -| DISTANCE_DELTA | METERS | | yes | | -| MINDFULNESS | MINUTES | yes | | | -| SLEEP_IN_BED | MINUTES | yes | | | -| SLEEP_ASLEEP | MINUTES | yes | yes | | -| SLEEP_AWAKE | MINUTES | yes | yes | | -| SLEEP_DEEP | MINUTES | yes | yes | | -| SLEEP_LIGHT | MINUTES | | yes | | -| SLEEP_REM | MINUTES | yes | yes | | -| SLEEP_OUT_OF_BED | MINUTES | | yes | | -| SLEEP_SESSION | MINUTES | | yes | | -| WATER | LITER | yes | yes | | -| EXERCISE_TIME | MINUTES | yes | | | -| WORKOUT | NO_UNIT | yes | yes | See table below | -| HIGH_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | -| LOW_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | -| IRREGULAR_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | -| HEART_RATE_VARIABILITY_RMSSD | MILLISECONDS | | yes | | -| HEART_RATE_VARIABILITY_SDNN | MILLISECONDS | yes | | Requires Apple Watch to write the data | -| HEADACHE_NOT_PRESENT | MINUTES | yes | | | -| HEADACHE_MILD | MINUTES | yes | | | -| HEADACHE_MODERATE | MINUTES | yes | | | -| HEADACHE_SEVERE | MINUTES | yes | | | -| HEADACHE_UNSPECIFIED | MINUTES | yes | | | -| AUDIOGRAM | DECIBEL_HEARING_LEVEL | yes | | | -| ELECTROCARDIOGRAM | VOLT | yes | | Requires Apple Watch to write the data | -| NUTRITION | NO_UNIT | yes | yes | | -| INSULIN_DELIVERY | INTERNATIONAL_UNIT | yes | | | +| **Data Type** | **Unit** | **Apple Health** | **Google Health Connect** | **Comments** | +| ---------------------------- | ----------------------- | ---------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| ACTIVE_ENERGY_BURNED | CALORIES | yes | yes | | +| BASAL_ENERGY_BURNED | CALORIES | yes | yes | | +| BLOOD_GLUCOSE | MILLIGRAM_PER_DECILITER | yes | yes | | +| BLOOD_OXYGEN | PERCENTAGE | yes | yes | | +| BLOOD_PRESSURE_DIASTOLIC | MILLIMETER_OF_MERCURY | yes | yes | | +| BLOOD_PRESSURE_SYSTOLIC | MILLIMETER_OF_MERCURY | yes | yes | | +| BODY_FAT_PERCENTAGE | PERCENTAGE | yes | yes | | +| BODY_MASS_INDEX | NO_UNIT | yes | yes | | +| BODY_TEMPERATURE | DEGREE_CELSIUS | yes | yes | | +| BODY_WATER_MASS | KILOGRAMS | | yes | | +| ELECTRODERMAL_ACTIVITY | SIEMENS | yes | | | +| HEART_RATE | BEATS_PER_MINUTE | yes | yes | | +| HEIGHT | METERS | yes | yes | | +| RESTING_HEART_RATE | BEATS_PER_MINUTE | yes | yes | | +| RESPIRATORY_RATE | RESPIRATIONS_PER_MINUTE | yes | yes | | +| PERIPHERAL_PERFUSION_INDEX | PERCENTAGE | yes | | | +| STEPS | COUNT | yes | yes | | +| WAIST_CIRCUMFERENCE | METERS | yes | | | +| WALKING_HEART_RATE | BEATS_PER_MINUTE | yes | | | +| WEIGHT | KILOGRAMS | yes | yes | | +| DISTANCE_WALKING_RUNNING | METERS | yes | | | +| FLIGHTS_CLIMBED | COUNT | yes | yes | | +| DISTANCE_DELTA | METERS | | yes | | +| MINDFULNESS | MINUTES | yes | | | +| SLEEP_ASLEEP | MINUTES | yes | yes | on iOS, this refers to asleepUnspecified, and on Android this refers to STAGE_TYPE_SLEEPING (asleep but specific stage is unknown) | +| SLEEP_AWAKE | MINUTES | yes | yes | | +| SLEEP_AWAKE_IN_BED | MINUTES | | yes | | +| SLEEP_DEEP | MINUTES | yes | yes | | +| SLEEP_IN_BED | MINUTES | yes | | | +| SLEEP_LIGHT | MINUTES | yes | yes | on iOS, this refers to asleepCore | +| SLEEP_OUT_OF_BED | MINUTES | | yes | | +| SLEEP_REM | MINUTES | yes | yes | | +| SLEEP_UNKNOWN | MINUTES | | yes | | +| SLEEP_SESSION | MINUTES | | yes | | +| WATER | LITER | yes | yes | | +| EXERCISE_TIME | MINUTES | yes | | | +| WORKOUT | NO_UNIT | yes | yes | See table below | +| HIGH_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | +| LOW_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | +| IRREGULAR_HEART_RATE_EVENT | NO_UNIT | yes | | Requires Apple Watch to write the data | +| HEART_RATE_VARIABILITY_RMSSD | MILLISECONDS | | yes | | +| HEART_RATE_VARIABILITY_SDNN | MILLISECONDS | yes | | Requires Apple Watch to write the data | +| HEADACHE_NOT_PRESENT | MINUTES | yes | | | +| HEADACHE_MILD | MINUTES | yes | | | +| HEADACHE_MODERATE | MINUTES | yes | | | +| HEADACHE_SEVERE | MINUTES | yes | | | +| HEADACHE_UNSPECIFIED | MINUTES | yes | | | +| AUDIOGRAM | DECIBEL_HEARING_LEVEL | yes | | | +| ELECTROCARDIOGRAM | VOLT | yes | | Requires Apple Watch to write the data | +| NUTRITION | NO_UNIT | yes | yes | | +| INSULIN_DELIVERY | INTERNATIONAL_UNIT | yes | | | ## Workout Types diff --git a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt index 043c49f42..70690126a 100644 --- a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt +++ b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt @@ -69,12 +69,14 @@ const val MEAL_UNKNOWN = "UNKNOWN" const val NUTRITION = "NUTRITION" const val SLEEP_ASLEEP = "SLEEP_ASLEEP" const val SLEEP_AWAKE = "SLEEP_AWAKE" +const val SLEEP_AWAKE_IN_BED = "SLEEP_AWAKE_IN_BED" const val SLEEP_DEEP = "SLEEP_DEEP" const val SLEEP_IN_BED = "SLEEP_IN_BED" const val SLEEP_LIGHT = "SLEEP_LIGHT" const val SLEEP_OUT_OF_BED = "SLEEP_OUT_OF_BED" const val SLEEP_REM = "SLEEP_REM" const val SLEEP_SESSION = "SLEEP_SESSION" +const val SLEEP_UNKNOWN = "SLEEP_UNKNOWN" const val SNACK = "SNACK" const val WORKOUT = "WORKOUT" @@ -1995,6 +1997,61 @@ class HealthPlugin(private var channel: MethodChannel? = null) : ), ) + SLEEP_AWAKE_IN_BED -> + SleepSessionRecord( + startTime = + Instant.ofEpochMilli( + startTime + ), + endTime = + Instant.ofEpochMilli( + endTime + ), + startZoneOffset = null, + endZoneOffset = null, + stages = + listOf( + SleepSessionRecord + .Stage( + Instant.ofEpochMilli( + startTime + ), + Instant.ofEpochMilli( + endTime + ), + SleepSessionRecord + .STAGE_TYPE_AWAKE_IN_BED + ) + ), + ) + + SLEEP_UNKNOWN -> + SleepSessionRecord( + startTime = + Instant.ofEpochMilli( + startTime + ), + endTime = + Instant.ofEpochMilli( + endTime + ), + startZoneOffset = null, + endZoneOffset = null, + stages = + listOf( + SleepSessionRecord + .Stage( + Instant.ofEpochMilli( + startTime + ), + Instant.ofEpochMilli( + endTime + ), + SleepSessionRecord + .STAGE_TYPE_UNKNOWN + ) + ), + ) SLEEP_SESSION -> SleepSessionRecord( startTime = @@ -2304,12 +2361,14 @@ class HealthPlugin(private var channel: MethodChannel? = null) : private val mapSleepStageToType = hashMapOf( + 0 to SLEEP_UNKNOWN, 1 to SLEEP_AWAKE, 2 to SLEEP_ASLEEP, 3 to SLEEP_OUT_OF_BED, 4 to SLEEP_LIGHT, 5 to SLEEP_DEEP, 6 to SLEEP_REM, + 7 to SLEEP_AWAKE_IN_BED ) private val mapMealTypeToType = @@ -2351,11 +2410,13 @@ class HealthPlugin(private var channel: MethodChannel? = null) : WATER to HydrationRecord::class, SLEEP_ASLEEP to SleepSessionRecord::class, SLEEP_AWAKE to SleepSessionRecord::class, + SLEEP_AWAKE_IN_BED to SleepSessionRecord::class, SLEEP_LIGHT to SleepSessionRecord::class, SLEEP_DEEP to SleepSessionRecord::class, SLEEP_REM to SleepSessionRecord::class, SLEEP_OUT_OF_BED to SleepSessionRecord::class, SLEEP_SESSION to SleepSessionRecord::class, + SLEEP_UNKNOWN to SleepSessionRecord::class, WORKOUT to ExerciseSessionRecord::class, NUTRITION to NutritionRecord::class, RESTING_HEART_RATE to RestingHeartRateRecord::class, diff --git a/packages/health/example/lib/util.dart b/packages/health/example/lib/util.dart index e135a30f6..623d278ef 100644 --- a/packages/health/example/lib/util.dart +++ b/packages/health/example/lib/util.dart @@ -33,6 +33,7 @@ const List dataTypesIOS = [ HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_ASLEEP, HealthDataType.SLEEP_IN_BED, + HealthDataType.SLEEP_LIGHT, HealthDataType.SLEEP_DEEP, HealthDataType.SLEEP_REM, HealthDataType.WATER, @@ -81,11 +82,14 @@ const List dataTypesAndroid = [ HealthDataType.STEPS, HealthDataType.DISTANCE_DELTA, HealthDataType.RESPIRATORY_RATE, - HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_ASLEEP, - HealthDataType.SLEEP_LIGHT, + HealthDataType.SLEEP_AWAKE_IN_BED, + HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_DEEP, + HealthDataType.SLEEP_LIGHT, + HealthDataType.SLEEP_OUT_OF_BED, HealthDataType.SLEEP_REM, + HealthDataType.SLEEP_UNKNOWN, HealthDataType.SLEEP_SESSION, HealthDataType.WATER, HealthDataType.WORKOUT, diff --git a/packages/health/ios/Classes/SwiftHealthPlugin.swift b/packages/health/ios/Classes/SwiftHealthPlugin.swift index 654f89991..0afe80d6f 100644 --- a/packages/health/ios/Classes/SwiftHealthPlugin.swift +++ b/packages/health/ios/Classes/SwiftHealthPlugin.swift @@ -140,13 +140,11 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin { let DISTANCE_CYCLING = "DISTANCE_CYCLING" let FLIGHTS_CLIMBED = "FLIGHTS_CLIMBED" let MINDFULNESS = "MINDFULNESS" - let SLEEP_IN_BED = "SLEEP_IN_BED" let SLEEP_ASLEEP = "SLEEP_ASLEEP" - let SLEEP_ASLEEP_CORE = "SLEEP_ASLEEP_CORE" - let SLEEP_ASLEEP_DEEP = "SLEEP_ASLEEP_DEEP" - let SLEEP_ASLEEP_REM = "SLEEP_ASLEEP_REM" let SLEEP_AWAKE = "SLEEP_AWAKE" let SLEEP_DEEP = "SLEEP_DEEP" + let SLEEP_IN_BED = "SLEEP_IN_BED" + let SLEEP_LIGHT = "SLEEP_LIGHT" let SLEEP_REM = "SLEEP_REM" let EXERCISE_TIME = "EXERCISE_TIME" @@ -867,19 +865,13 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin { if dataTypeKey == self.SLEEP_IN_BED { samplesCategory = samplesCategory.filter { $0.value == 0 } } - if dataTypeKey == self.SLEEP_ASLEEP_CORE { - samplesCategory = samplesCategory.filter { $0.value == 3 } - } - if dataTypeKey == self.SLEEP_ASLEEP_DEEP { - samplesCategory = samplesCategory.filter { $0.value == 4 } - } - if dataTypeKey == self.SLEEP_ASLEEP_REM { - samplesCategory = samplesCategory.filter { $0.value == 5 } + if dataTypeKey == self.SLEEP_ASLEEP { + samplesCategory = samplesCategory.filter { $0.value == 1 } } if dataTypeKey == self.SLEEP_AWAKE { samplesCategory = samplesCategory.filter { $0.value == 2 } } - if dataTypeKey == self.SLEEP_ASLEEP { + if dataTypeKey == self.SLEEP_LIGHT { samplesCategory = samplesCategory.filter { $0.value == 3 } } if dataTypeKey == self.SLEEP_DEEP { @@ -1483,14 +1475,12 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin { dataTypesDict[DISTANCE_CYCLING] = HKSampleType.quantityType(forIdentifier: .distanceCycling)! dataTypesDict[FLIGHTS_CLIMBED] = HKSampleType.quantityType(forIdentifier: .flightsClimbed)! dataTypesDict[MINDFULNESS] = HKSampleType.categoryType(forIdentifier: .mindfulSession)! - dataTypesDict[SLEEP_IN_BED] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! - dataTypesDict[SLEEP_ASLEEP] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! - dataTypesDict[SLEEP_ASLEEP_CORE] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! - dataTypesDict[SLEEP_ASLEEP_DEEP] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! - dataTypesDict[SLEEP_ASLEEP_REM] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! dataTypesDict[SLEEP_AWAKE] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! dataTypesDict[SLEEP_DEEP] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! + dataTypesDict[SLEEP_IN_BED] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! + dataTypesDict[SLEEP_LIGHT] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! dataTypesDict[SLEEP_REM] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! + dataTypesDict[SLEEP_ASLEEP] = HKSampleType.categoryType(forIdentifier: .sleepAnalysis)! dataTypesDict[MENSTRUATION_FLOW] = HKSampleType.categoryType(forIdentifier: .menstrualFlow)! diff --git a/packages/health/lib/health.g.dart b/packages/health/lib/health.g.dart index 565741982..9be3250db 100644 --- a/packages/health/lib/health.g.dart +++ b/packages/health/lib/health.g.dart @@ -125,17 +125,16 @@ const _$HealthDataTypeEnumMap = { HealthDataType.DISTANCE_DELTA: 'DISTANCE_DELTA', HealthDataType.MINDFULNESS: 'MINDFULNESS', HealthDataType.WATER: 'WATER', - HealthDataType.SLEEP_IN_BED: 'SLEEP_IN_BED', HealthDataType.SLEEP_ASLEEP: 'SLEEP_ASLEEP', - HealthDataType.SLEEP_ASLEEP_CORE: 'SLEEP_ASLEEP_CORE', - HealthDataType.SLEEP_ASLEEP_DEEP: 'SLEEP_ASLEEP_DEEP', - HealthDataType.SLEEP_ASLEEP_REM: 'SLEEP_ASLEEP_REM', + HealthDataType.SLEEP_AWAKE_IN_BED: 'SLEEP_AWAKE_IN_BED', HealthDataType.SLEEP_AWAKE: 'SLEEP_AWAKE', - HealthDataType.SLEEP_LIGHT: 'SLEEP_LIGHT', HealthDataType.SLEEP_DEEP: 'SLEEP_DEEP', - HealthDataType.SLEEP_REM: 'SLEEP_REM', + HealthDataType.SLEEP_IN_BED: 'SLEEP_IN_BED', + HealthDataType.SLEEP_LIGHT: 'SLEEP_LIGHT', HealthDataType.SLEEP_OUT_OF_BED: 'SLEEP_OUT_OF_BED', + HealthDataType.SLEEP_REM: 'SLEEP_REM', HealthDataType.SLEEP_SESSION: 'SLEEP_SESSION', + HealthDataType.SLEEP_UNKNOWN: 'SLEEP_UNKNOWN', HealthDataType.EXERCISE_TIME: 'EXERCISE_TIME', HealthDataType.WORKOUT: 'WORKOUT', HealthDataType.HEADACHE_NOT_PRESENT: 'HEADACHE_NOT_PRESENT', diff --git a/packages/health/lib/src/health_data_point.dart b/packages/health/lib/src/health_data_point.dart index adb597061..2598a0e1b 100644 --- a/packages/health/lib/src/health_data_point.dart +++ b/packages/health/lib/src/health_data_point.dart @@ -78,12 +78,14 @@ class HealthDataPoint { type == HealthDataType.HEADACHE_MILD || type == HealthDataType.HEADACHE_MODERATE || type == HealthDataType.HEADACHE_SEVERE || - type == HealthDataType.SLEEP_IN_BED || type == HealthDataType.SLEEP_ASLEEP || type == HealthDataType.SLEEP_AWAKE || + type == HealthDataType.SLEEP_AWAKE_IN_BED || type == HealthDataType.SLEEP_DEEP || + type == HealthDataType.SLEEP_IN_BED || type == HealthDataType.SLEEP_LIGHT || type == HealthDataType.SLEEP_REM || + type == HealthDataType.SLEEP_UNKNOWN || type == HealthDataType.SLEEP_OUT_OF_BED) { value = _convertMinutes(); } diff --git a/packages/health/lib/src/health_plugin.dart b/packages/health/lib/src/health_plugin.dart index 368dd6399..54644341b 100644 --- a/packages/health/lib/src/health_plugin.dart +++ b/packages/health/lib/src/health_plugin.dart @@ -349,9 +349,7 @@ class Health { type == HealthDataType.SLEEP_IN_BED || type == HealthDataType.SLEEP_DEEP || type == HealthDataType.SLEEP_REM || - type == HealthDataType.SLEEP_ASLEEP_CORE || - type == HealthDataType.SLEEP_ASLEEP_DEEP || - type == HealthDataType.SLEEP_ASLEEP_REM || + type == HealthDataType.SLEEP_LIGHT || type == HealthDataType.HEADACHE_NOT_PRESENT || type == HealthDataType.HEADACHE_MILD || type == HealthDataType.HEADACHE_MODERATE || @@ -1054,13 +1052,11 @@ class Health { /// Assigns numbers to specific [HealthDataType]s. int _alignValue(HealthDataType type) => switch (type) { HealthDataType.SLEEP_IN_BED => 0, + HealthDataType.SLEEP_ASLEEP => 1, HealthDataType.SLEEP_AWAKE => 2, HealthDataType.SLEEP_ASLEEP => 3, HealthDataType.SLEEP_DEEP => 4, HealthDataType.SLEEP_REM => 5, - HealthDataType.SLEEP_ASLEEP_CORE => 3, - HealthDataType.SLEEP_ASLEEP_DEEP => 4, - HealthDataType.SLEEP_ASLEEP_REM => 5, HealthDataType.HEADACHE_UNSPECIFIED => 0, HealthDataType.HEADACHE_NOT_PRESENT => 1, HealthDataType.HEADACHE_MILD => 2, diff --git a/packages/health/lib/src/heath_data_types.dart b/packages/health/lib/src/heath_data_types.dart index c498de3a1..95205e1f8 100644 --- a/packages/health/lib/src/heath_data_types.dart +++ b/packages/health/lib/src/heath_data_types.dart @@ -71,17 +71,16 @@ enum HealthDataType { DISTANCE_DELTA, MINDFULNESS, WATER, - SLEEP_IN_BED, SLEEP_ASLEEP, - SLEEP_ASLEEP_CORE, - SLEEP_ASLEEP_DEEP, - SLEEP_ASLEEP_REM, + SLEEP_AWAKE_IN_BED, SLEEP_AWAKE, - SLEEP_LIGHT, SLEEP_DEEP, - SLEEP_REM, + SLEEP_IN_BED, + SLEEP_LIGHT, SLEEP_OUT_OF_BED, + SLEEP_REM, SLEEP_SESSION, + SLEEP_UNKNOWN, EXERCISE_TIME, WORKOUT, HEADACHE_NOT_PRESENT, @@ -185,14 +184,12 @@ const List dataTypeKeysIOS = [ HealthDataType.DISTANCE_SWIMMING, HealthDataType.DISTANCE_CYCLING, HealthDataType.MINDFULNESS, - HealthDataType.SLEEP_IN_BED, - HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_ASLEEP, + HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_DEEP, + HealthDataType.SLEEP_IN_BED, + HealthDataType.SLEEP_LIGHT, HealthDataType.SLEEP_REM, - HealthDataType.SLEEP_ASLEEP_CORE, - HealthDataType.SLEEP_ASLEEP_DEEP, - HealthDataType.SLEEP_ASLEEP_REM, HealthDataType.WATER, HealthDataType.EXERCISE_TIME, HealthDataType.WORKOUT, @@ -226,14 +223,15 @@ const List dataTypeKeysAndroid = [ HealthDataType.STEPS, HealthDataType.WEIGHT, HealthDataType.DISTANCE_DELTA, - HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_ASLEEP, - HealthDataType.SLEEP_IN_BED, + HealthDataType.SLEEP_AWAKE_IN_BED, + HealthDataType.SLEEP_AWAKE, HealthDataType.SLEEP_DEEP, HealthDataType.SLEEP_LIGHT, - HealthDataType.SLEEP_REM, HealthDataType.SLEEP_OUT_OF_BED, + HealthDataType.SLEEP_REM, HealthDataType.SLEEP_SESSION, + HealthDataType.SLEEP_UNKNOWN, HealthDataType.WATER, HealthDataType.WORKOUT, HealthDataType.RESTING_HEART_RATE, @@ -316,17 +314,16 @@ const Map dataTypeToUnit = { HealthDataType.DISTANCE_DELTA: HealthDataUnit.METER, HealthDataType.WATER: HealthDataUnit.LITER, - HealthDataType.SLEEP_IN_BED: HealthDataUnit.MINUTE, HealthDataType.SLEEP_ASLEEP: HealthDataUnit.MINUTE, - HealthDataType.SLEEP_ASLEEP_CORE: HealthDataUnit.MINUTE, - HealthDataType.SLEEP_ASLEEP_DEEP: HealthDataUnit.MINUTE, - HealthDataType.SLEEP_ASLEEP_REM: HealthDataUnit.MINUTE, HealthDataType.SLEEP_AWAKE: HealthDataUnit.MINUTE, + HealthDataType.SLEEP_AWAKE_IN_BED: HealthDataUnit.MINUTE, HealthDataType.SLEEP_DEEP: HealthDataUnit.MINUTE, - HealthDataType.SLEEP_REM: HealthDataUnit.MINUTE, - HealthDataType.SLEEP_OUT_OF_BED: HealthDataUnit.MINUTE, + HealthDataType.SLEEP_IN_BED: HealthDataUnit.MINUTE, HealthDataType.SLEEP_LIGHT: HealthDataUnit.MINUTE, + HealthDataType.SLEEP_OUT_OF_BED: HealthDataUnit.MINUTE, + HealthDataType.SLEEP_REM: HealthDataUnit.MINUTE, HealthDataType.SLEEP_SESSION: HealthDataUnit.MINUTE, + HealthDataType.SLEEP_UNKNOWN: HealthDataUnit.MINUTE, HealthDataType.MINDFULNESS: HealthDataUnit.MINUTE, HealthDataType.EXERCISE_TIME: HealthDataUnit.MINUTE,