@kingstinct/react-native-healthkit 4.4.1 → 4.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.ios.js +0 -2
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/native-types.js +8 -14
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.ios.js +1 -3
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/native-types.js +7 -11
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/native-types.d.ts +17 -235
- package/lib/typescript/src/types.d.ts +9 -11
- package/package.json +1 -2
- package/src/index.ios.tsx +10 -13
- package/src/native-types.ts +34 -24
- package/src/types.ts +13 -16
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NativeEventEmitter } from 'react-native';
|
|
2
2
|
import type { EmitterSubscription } from 'react-native';
|
|
3
|
-
import type { ValueOf } from 'type-fest';
|
|
4
3
|
export declare const HKWorkoutTypeIdentifier: "HKWorkoutTypeIdentifier";
|
|
5
4
|
export declare const HKAudiogramTypeIdentifier: "HKAudiogramTypeIdentifier";
|
|
6
5
|
export declare const HKWorkoutRouteTypeIdentifier: "HKWorkoutRouteTypeIdentifier";
|
|
@@ -124,117 +123,9 @@ export declare enum HKCategoryTypeIdentifier {
|
|
|
124
123
|
audioExposureEvent = "HKCategoryTypeIdentifierAudioExposureEvent",
|
|
125
124
|
toothbrushingEvent = "HKCategoryTypeIdentifierToothbrushingEvent"
|
|
126
125
|
}
|
|
127
|
-
export declare
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
workoutRoute: "HKWorkoutRouteTypeIdentifier";
|
|
131
|
-
workoute: "HKWorkoutTypeIdentifier";
|
|
132
|
-
bodyMassIndex: HKQuantityTypeIdentifier.bodyMassIndex;
|
|
133
|
-
bodyFatPercentage: HKQuantityTypeIdentifier.bodyFatPercentage;
|
|
134
|
-
height: HKQuantityTypeIdentifier.height;
|
|
135
|
-
bodyMass: HKQuantityTypeIdentifier.bodyMass;
|
|
136
|
-
leanBodyMass: HKQuantityTypeIdentifier.leanBodyMass;
|
|
137
|
-
waistCircumference: HKQuantityTypeIdentifier.waistCircumference;
|
|
138
|
-
stepCount: HKQuantityTypeIdentifier.stepCount;
|
|
139
|
-
distanceWalkingRunning: HKQuantityTypeIdentifier.distanceWalkingRunning;
|
|
140
|
-
distanceCycling: HKQuantityTypeIdentifier.distanceCycling;
|
|
141
|
-
distanceWheelchair: HKQuantityTypeIdentifier.distanceWheelchair;
|
|
142
|
-
basalEnergyBurned: HKQuantityTypeIdentifier.basalEnergyBurned;
|
|
143
|
-
activeEnergyBurned: HKQuantityTypeIdentifier.activeEnergyBurned;
|
|
144
|
-
flightsClimbed: HKQuantityTypeIdentifier.flightsClimbed;
|
|
145
|
-
nikeFuel: HKQuantityTypeIdentifier.nikeFuel;
|
|
146
|
-
appleExerciseTime: HKQuantityTypeIdentifier.appleExerciseTime;
|
|
147
|
-
pushCount: HKQuantityTypeIdentifier.pushCount;
|
|
148
|
-
distanceSwimming: HKQuantityTypeIdentifier.distanceSwimming;
|
|
149
|
-
swimmingStrokeCount: HKQuantityTypeIdentifier.swimmingStrokeCount;
|
|
150
|
-
vo2Max: HKQuantityTypeIdentifier.vo2Max;
|
|
151
|
-
distanceDownhillSnowSports: HKQuantityTypeIdentifier.distanceDownhillSnowSports;
|
|
152
|
-
appleStandTime: HKQuantityTypeIdentifier.appleStandTime;
|
|
153
|
-
heartRate: HKQuantityTypeIdentifier.heartRate;
|
|
154
|
-
bodyTemperature: HKQuantityTypeIdentifier.bodyTemperature;
|
|
155
|
-
basalBodyTemperature: HKQuantityTypeIdentifier.basalBodyTemperature;
|
|
156
|
-
bloodPressureSystolic: HKQuantityTypeIdentifier.bloodPressureSystolic;
|
|
157
|
-
bloodPressureDiastolic: HKQuantityTypeIdentifier.bloodPressureDiastolic;
|
|
158
|
-
respiratoryRate: HKQuantityTypeIdentifier.respiratoryRate;
|
|
159
|
-
restingHeartRate: HKQuantityTypeIdentifier.restingHeartRate;
|
|
160
|
-
walkingHeartRateAverage: HKQuantityTypeIdentifier.walkingHeartRateAverage;
|
|
161
|
-
heartRateVariabilitySDNN: HKQuantityTypeIdentifier.heartRateVariabilitySDNN;
|
|
162
|
-
oxygenSaturation: HKQuantityTypeIdentifier.oxygenSaturation;
|
|
163
|
-
peripheralPerfusionIndex: HKQuantityTypeIdentifier.peripheralPerfusionIndex;
|
|
164
|
-
bloodGlucose: HKQuantityTypeIdentifier.bloodGlucose;
|
|
165
|
-
numberOfTimesFallen: HKQuantityTypeIdentifier.numberOfTimesFallen;
|
|
166
|
-
electrodermalActivity: HKQuantityTypeIdentifier.electrodermalActivity;
|
|
167
|
-
inhalerUsage: HKQuantityTypeIdentifier.inhalerUsage;
|
|
168
|
-
insulinDelivery: HKQuantityTypeIdentifier.insulinDelivery;
|
|
169
|
-
bloodAlcoholContent: HKQuantityTypeIdentifier.bloodAlcoholContent;
|
|
170
|
-
forcedVitalCapacity: HKQuantityTypeIdentifier.forcedVitalCapacity;
|
|
171
|
-
forcedExpiratoryVolume1: HKQuantityTypeIdentifier.forcedExpiratoryVolume1;
|
|
172
|
-
peakExpiratoryFlowRate: HKQuantityTypeIdentifier.peakExpiratoryFlowRate;
|
|
173
|
-
environmentalAudioExposure: HKQuantityTypeIdentifier.environmentalAudioExposure;
|
|
174
|
-
headphoneAudioExposure: HKQuantityTypeIdentifier.headphoneAudioExposure;
|
|
175
|
-
dietaryFatTotal: HKQuantityTypeIdentifier.dietaryFatTotal;
|
|
176
|
-
dietaryFatPolyunsaturated: HKQuantityTypeIdentifier.dietaryFatPolyunsaturated;
|
|
177
|
-
dietaryFatMonounsaturated: HKQuantityTypeIdentifier.dietaryFatMonounsaturated;
|
|
178
|
-
dietaryFatSaturated: HKQuantityTypeIdentifier.dietaryFatSaturated;
|
|
179
|
-
dietaryCholesterol: HKQuantityTypeIdentifier.dietaryCholesterol;
|
|
180
|
-
dietarySodium: HKQuantityTypeIdentifier.dietarySodium;
|
|
181
|
-
dietaryCarbohydrates: HKQuantityTypeIdentifier.dietaryCarbohydrates;
|
|
182
|
-
dietaryFiber: HKQuantityTypeIdentifier.dietaryFiber;
|
|
183
|
-
dietarySugar: HKQuantityTypeIdentifier.dietarySugar;
|
|
184
|
-
dietaryEnergyConsumed: HKQuantityTypeIdentifier.dietaryEnergyConsumed;
|
|
185
|
-
dietaryProtein: HKQuantityTypeIdentifier.dietaryProtein;
|
|
186
|
-
dietaryVitaminA: HKQuantityTypeIdentifier.dietaryVitaminA;
|
|
187
|
-
dietaryVitaminB6: HKQuantityTypeIdentifier.dietaryVitaminB6;
|
|
188
|
-
dietaryVitaminB12: HKQuantityTypeIdentifier.dietaryVitaminB12;
|
|
189
|
-
dietaryVitaminC: HKQuantityTypeIdentifier.dietaryVitaminC;
|
|
190
|
-
dietaryVitaminD: HKQuantityTypeIdentifier.dietaryVitaminD;
|
|
191
|
-
dietaryVitaminE: HKQuantityTypeIdentifier.dietaryVitaminE;
|
|
192
|
-
dietaryVitaminK: HKQuantityTypeIdentifier.dietaryVitaminK;
|
|
193
|
-
dietaryCalcium: HKQuantityTypeIdentifier.dietaryCalcium;
|
|
194
|
-
dietaryIron: HKQuantityTypeIdentifier.dietaryIron;
|
|
195
|
-
dietaryThiamin: HKQuantityTypeIdentifier.dietaryThiamin;
|
|
196
|
-
dietaryRiboflavin: HKQuantityTypeIdentifier.dietaryRiboflavin;
|
|
197
|
-
dietaryNiacin: HKQuantityTypeIdentifier.dietaryNiacin;
|
|
198
|
-
dietaryFolate: HKQuantityTypeIdentifier.dietaryFolate;
|
|
199
|
-
dietaryBiotin: HKQuantityTypeIdentifier.dietaryBiotin;
|
|
200
|
-
dietaryPantothenicAcid: HKQuantityTypeIdentifier.dietaryPantothenicAcid;
|
|
201
|
-
dietaryPhosphorus: HKQuantityTypeIdentifier.dietaryPhosphorus;
|
|
202
|
-
dietaryIodine: HKQuantityTypeIdentifier.dietaryIodine;
|
|
203
|
-
dietaryMagnesium: HKQuantityTypeIdentifier.dietaryMagnesium;
|
|
204
|
-
dietaryZinc: HKQuantityTypeIdentifier.dietaryZinc;
|
|
205
|
-
dietarySelenium: HKQuantityTypeIdentifier.dietarySelenium;
|
|
206
|
-
dietaryCopper: HKQuantityTypeIdentifier.dietaryCopper;
|
|
207
|
-
dietaryManganese: HKQuantityTypeIdentifier.dietaryManganese;
|
|
208
|
-
dietaryChromium: HKQuantityTypeIdentifier.dietaryChromium;
|
|
209
|
-
dietaryMolybdenum: HKQuantityTypeIdentifier.dietaryMolybdenum;
|
|
210
|
-
dietaryChloride: HKQuantityTypeIdentifier.dietaryChloride;
|
|
211
|
-
dietaryPotassium: HKQuantityTypeIdentifier.dietaryPotassium;
|
|
212
|
-
dietaryCaffeine: HKQuantityTypeIdentifier.dietaryCaffeine;
|
|
213
|
-
dietaryWater: HKQuantityTypeIdentifier.dietaryWater;
|
|
214
|
-
sixMinuteWalkTestDistance: HKQuantityTypeIdentifier.sixMinuteWalkTestDistance;
|
|
215
|
-
walkingSpeed: HKQuantityTypeIdentifier.walkingSpeed;
|
|
216
|
-
walkingStepLength: HKQuantityTypeIdentifier.walkingStepLength;
|
|
217
|
-
walkingAsymmetryPercentage: HKQuantityTypeIdentifier.walkingAsymmetryPercentage;
|
|
218
|
-
walkingDoubleSupportPercentage: HKQuantityTypeIdentifier.walkingDoubleSupportPercentage;
|
|
219
|
-
stairAscentSpeed: HKQuantityTypeIdentifier.stairAscentSpeed;
|
|
220
|
-
stairDescentSpeed: HKQuantityTypeIdentifier.stairDescentSpeed;
|
|
221
|
-
uvExposure: HKQuantityTypeIdentifier.uvExposure;
|
|
222
|
-
bloodPressure: HKCorrelationTypeIdentifier.bloodPressure;
|
|
223
|
-
food: HKCorrelationTypeIdentifier.food;
|
|
224
|
-
sleepAnalysis: HKCategoryTypeIdentifier.sleepAnalysis;
|
|
225
|
-
appleStandHour: HKCategoryTypeIdentifier.appleStandHour;
|
|
226
|
-
cervicalMucusQuality: HKCategoryTypeIdentifier.cervicalMucusQuality;
|
|
227
|
-
ovulationTestResult: HKCategoryTypeIdentifier.ovulationTestResult;
|
|
228
|
-
menstrualFlow: HKCategoryTypeIdentifier.menstrualFlow;
|
|
229
|
-
intermenstrualBleeding: HKCategoryTypeIdentifier.intermenstrualBleeding;
|
|
230
|
-
sexualActivity: HKCategoryTypeIdentifier.sexualActivity;
|
|
231
|
-
mindfulSession: HKCategoryTypeIdentifier.mindfulSession;
|
|
232
|
-
highHeartRateEvent: HKCategoryTypeIdentifier.highHeartRateEvent;
|
|
233
|
-
lowHeartRateEvent: HKCategoryTypeIdentifier.lowHeartRateEvent;
|
|
234
|
-
irregularHeartRhythmEvent: HKCategoryTypeIdentifier.irregularHeartRhythmEvent;
|
|
235
|
-
audioExposureEvent: HKCategoryTypeIdentifier.audioExposureEvent;
|
|
236
|
-
toothbrushingEvent: HKCategoryTypeIdentifier.toothbrushingEvent;
|
|
237
|
-
};
|
|
126
|
+
export declare type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
|
|
127
|
+
export declare type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`;
|
|
128
|
+
export declare type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
|
|
238
129
|
export declare enum HKCategoryValueAppleStandHour {
|
|
239
130
|
stood = 0,
|
|
240
131
|
idle = 1
|
|
@@ -365,9 +256,16 @@ export declare enum HKWeatherCondition {
|
|
|
365
256
|
hurricane = 26,
|
|
366
257
|
tornado = 27
|
|
367
258
|
}
|
|
259
|
+
declare enum HKIndoorWorkout {
|
|
260
|
+
false = 0,
|
|
261
|
+
true = 1
|
|
262
|
+
}
|
|
368
263
|
export interface HKWorkoutMetadata extends HKGenericMetadata {
|
|
369
264
|
readonly HKWeatherCondition?: HKWeatherCondition;
|
|
370
265
|
readonly HKWeatherHumidity?: HKQuantity<HKUnit.Percent>;
|
|
266
|
+
readonly HKAverageMETs?: HKQuantity<HKUnit>;
|
|
267
|
+
readonly HKElevationAscended?: HKQuantity<HKUnit.Meters>;
|
|
268
|
+
readonly HKIndoorWorkout?: HKIndoorWorkout;
|
|
371
269
|
}
|
|
372
270
|
export declare enum HKAuthorizationRequestStatus {
|
|
373
271
|
unknown = 0,
|
|
@@ -570,9 +468,9 @@ export declare enum HKUnit {
|
|
|
570
468
|
}
|
|
571
469
|
export declare type HKDevice = {
|
|
572
470
|
readonly name: string;
|
|
573
|
-
readonly firmwareVersion: string;
|
|
471
|
+
readonly firmwareVersion: string | null;
|
|
574
472
|
readonly hardwareVersion: string;
|
|
575
|
-
readonly localIdentifier: string;
|
|
473
|
+
readonly localIdentifier: string | null;
|
|
576
474
|
readonly manufacturer: string;
|
|
577
475
|
readonly model: string;
|
|
578
476
|
readonly softwareVersion: string;
|
|
@@ -664,122 +562,6 @@ export declare type WorkoutRoute = {
|
|
|
664
562
|
readonly HKMetadataKeySyncIdentifier?: string;
|
|
665
563
|
readonly HKMetadataKeySyncVersion?: number;
|
|
666
564
|
};
|
|
667
|
-
export declare const HealthkitAuthorization: {
|
|
668
|
-
audiogram: "HKAudiogramTypeIdentifier";
|
|
669
|
-
heartbeatSeries: "HKDataTypeIdentifierHeartbeatSeries";
|
|
670
|
-
workoutRoute: "HKWorkoutRouteTypeIdentifier";
|
|
671
|
-
workoute: "HKWorkoutTypeIdentifier";
|
|
672
|
-
bodyMassIndex: HKQuantityTypeIdentifier.bodyMassIndex;
|
|
673
|
-
bodyFatPercentage: HKQuantityTypeIdentifier.bodyFatPercentage;
|
|
674
|
-
height: HKQuantityTypeIdentifier.height;
|
|
675
|
-
bodyMass: HKQuantityTypeIdentifier.bodyMass;
|
|
676
|
-
leanBodyMass: HKQuantityTypeIdentifier.leanBodyMass;
|
|
677
|
-
waistCircumference: HKQuantityTypeIdentifier.waistCircumference;
|
|
678
|
-
stepCount: HKQuantityTypeIdentifier.stepCount;
|
|
679
|
-
distanceWalkingRunning: HKQuantityTypeIdentifier.distanceWalkingRunning;
|
|
680
|
-
distanceCycling: HKQuantityTypeIdentifier.distanceCycling;
|
|
681
|
-
distanceWheelchair: HKQuantityTypeIdentifier.distanceWheelchair;
|
|
682
|
-
basalEnergyBurned: HKQuantityTypeIdentifier.basalEnergyBurned;
|
|
683
|
-
activeEnergyBurned: HKQuantityTypeIdentifier.activeEnergyBurned;
|
|
684
|
-
flightsClimbed: HKQuantityTypeIdentifier.flightsClimbed;
|
|
685
|
-
nikeFuel: HKQuantityTypeIdentifier.nikeFuel;
|
|
686
|
-
appleExerciseTime: HKQuantityTypeIdentifier.appleExerciseTime;
|
|
687
|
-
pushCount: HKQuantityTypeIdentifier.pushCount;
|
|
688
|
-
distanceSwimming: HKQuantityTypeIdentifier.distanceSwimming;
|
|
689
|
-
swimmingStrokeCount: HKQuantityTypeIdentifier.swimmingStrokeCount;
|
|
690
|
-
vo2Max: HKQuantityTypeIdentifier.vo2Max;
|
|
691
|
-
distanceDownhillSnowSports: HKQuantityTypeIdentifier.distanceDownhillSnowSports;
|
|
692
|
-
appleStandTime: HKQuantityTypeIdentifier.appleStandTime;
|
|
693
|
-
heartRate: HKQuantityTypeIdentifier.heartRate;
|
|
694
|
-
bodyTemperature: HKQuantityTypeIdentifier.bodyTemperature;
|
|
695
|
-
basalBodyTemperature: HKQuantityTypeIdentifier.basalBodyTemperature;
|
|
696
|
-
bloodPressureSystolic: HKQuantityTypeIdentifier.bloodPressureSystolic;
|
|
697
|
-
bloodPressureDiastolic: HKQuantityTypeIdentifier.bloodPressureDiastolic;
|
|
698
|
-
respiratoryRate: HKQuantityTypeIdentifier.respiratoryRate;
|
|
699
|
-
restingHeartRate: HKQuantityTypeIdentifier.restingHeartRate;
|
|
700
|
-
walkingHeartRateAverage: HKQuantityTypeIdentifier.walkingHeartRateAverage;
|
|
701
|
-
heartRateVariabilitySDNN: HKQuantityTypeIdentifier.heartRateVariabilitySDNN;
|
|
702
|
-
oxygenSaturation: HKQuantityTypeIdentifier.oxygenSaturation;
|
|
703
|
-
peripheralPerfusionIndex: HKQuantityTypeIdentifier.peripheralPerfusionIndex;
|
|
704
|
-
bloodGlucose: HKQuantityTypeIdentifier.bloodGlucose;
|
|
705
|
-
numberOfTimesFallen: HKQuantityTypeIdentifier.numberOfTimesFallen;
|
|
706
|
-
electrodermalActivity: HKQuantityTypeIdentifier.electrodermalActivity;
|
|
707
|
-
inhalerUsage: HKQuantityTypeIdentifier.inhalerUsage;
|
|
708
|
-
insulinDelivery: HKQuantityTypeIdentifier.insulinDelivery;
|
|
709
|
-
bloodAlcoholContent: HKQuantityTypeIdentifier.bloodAlcoholContent;
|
|
710
|
-
forcedVitalCapacity: HKQuantityTypeIdentifier.forcedVitalCapacity;
|
|
711
|
-
forcedExpiratoryVolume1: HKQuantityTypeIdentifier.forcedExpiratoryVolume1;
|
|
712
|
-
peakExpiratoryFlowRate: HKQuantityTypeIdentifier.peakExpiratoryFlowRate;
|
|
713
|
-
environmentalAudioExposure: HKQuantityTypeIdentifier.environmentalAudioExposure;
|
|
714
|
-
headphoneAudioExposure: HKQuantityTypeIdentifier.headphoneAudioExposure;
|
|
715
|
-
dietaryFatTotal: HKQuantityTypeIdentifier.dietaryFatTotal;
|
|
716
|
-
dietaryFatPolyunsaturated: HKQuantityTypeIdentifier.dietaryFatPolyunsaturated;
|
|
717
|
-
dietaryFatMonounsaturated: HKQuantityTypeIdentifier.dietaryFatMonounsaturated;
|
|
718
|
-
dietaryFatSaturated: HKQuantityTypeIdentifier.dietaryFatSaturated;
|
|
719
|
-
dietaryCholesterol: HKQuantityTypeIdentifier.dietaryCholesterol;
|
|
720
|
-
dietarySodium: HKQuantityTypeIdentifier.dietarySodium;
|
|
721
|
-
dietaryCarbohydrates: HKQuantityTypeIdentifier.dietaryCarbohydrates;
|
|
722
|
-
dietaryFiber: HKQuantityTypeIdentifier.dietaryFiber;
|
|
723
|
-
dietarySugar: HKQuantityTypeIdentifier.dietarySugar;
|
|
724
|
-
dietaryEnergyConsumed: HKQuantityTypeIdentifier.dietaryEnergyConsumed;
|
|
725
|
-
dietaryProtein: HKQuantityTypeIdentifier.dietaryProtein;
|
|
726
|
-
dietaryVitaminA: HKQuantityTypeIdentifier.dietaryVitaminA;
|
|
727
|
-
dietaryVitaminB6: HKQuantityTypeIdentifier.dietaryVitaminB6;
|
|
728
|
-
dietaryVitaminB12: HKQuantityTypeIdentifier.dietaryVitaminB12;
|
|
729
|
-
dietaryVitaminC: HKQuantityTypeIdentifier.dietaryVitaminC;
|
|
730
|
-
dietaryVitaminD: HKQuantityTypeIdentifier.dietaryVitaminD;
|
|
731
|
-
dietaryVitaminE: HKQuantityTypeIdentifier.dietaryVitaminE;
|
|
732
|
-
dietaryVitaminK: HKQuantityTypeIdentifier.dietaryVitaminK;
|
|
733
|
-
dietaryCalcium: HKQuantityTypeIdentifier.dietaryCalcium;
|
|
734
|
-
dietaryIron: HKQuantityTypeIdentifier.dietaryIron;
|
|
735
|
-
dietaryThiamin: HKQuantityTypeIdentifier.dietaryThiamin;
|
|
736
|
-
dietaryRiboflavin: HKQuantityTypeIdentifier.dietaryRiboflavin;
|
|
737
|
-
dietaryNiacin: HKQuantityTypeIdentifier.dietaryNiacin;
|
|
738
|
-
dietaryFolate: HKQuantityTypeIdentifier.dietaryFolate;
|
|
739
|
-
dietaryBiotin: HKQuantityTypeIdentifier.dietaryBiotin;
|
|
740
|
-
dietaryPantothenicAcid: HKQuantityTypeIdentifier.dietaryPantothenicAcid;
|
|
741
|
-
dietaryPhosphorus: HKQuantityTypeIdentifier.dietaryPhosphorus;
|
|
742
|
-
dietaryIodine: HKQuantityTypeIdentifier.dietaryIodine;
|
|
743
|
-
dietaryMagnesium: HKQuantityTypeIdentifier.dietaryMagnesium;
|
|
744
|
-
dietaryZinc: HKQuantityTypeIdentifier.dietaryZinc;
|
|
745
|
-
dietarySelenium: HKQuantityTypeIdentifier.dietarySelenium;
|
|
746
|
-
dietaryCopper: HKQuantityTypeIdentifier.dietaryCopper;
|
|
747
|
-
dietaryManganese: HKQuantityTypeIdentifier.dietaryManganese;
|
|
748
|
-
dietaryChromium: HKQuantityTypeIdentifier.dietaryChromium;
|
|
749
|
-
dietaryMolybdenum: HKQuantityTypeIdentifier.dietaryMolybdenum;
|
|
750
|
-
dietaryChloride: HKQuantityTypeIdentifier.dietaryChloride;
|
|
751
|
-
dietaryPotassium: HKQuantityTypeIdentifier.dietaryPotassium;
|
|
752
|
-
dietaryCaffeine: HKQuantityTypeIdentifier.dietaryCaffeine;
|
|
753
|
-
dietaryWater: HKQuantityTypeIdentifier.dietaryWater;
|
|
754
|
-
sixMinuteWalkTestDistance: HKQuantityTypeIdentifier.sixMinuteWalkTestDistance;
|
|
755
|
-
walkingSpeed: HKQuantityTypeIdentifier.walkingSpeed;
|
|
756
|
-
walkingStepLength: HKQuantityTypeIdentifier.walkingStepLength;
|
|
757
|
-
walkingAsymmetryPercentage: HKQuantityTypeIdentifier.walkingAsymmetryPercentage;
|
|
758
|
-
walkingDoubleSupportPercentage: HKQuantityTypeIdentifier.walkingDoubleSupportPercentage;
|
|
759
|
-
stairAscentSpeed: HKQuantityTypeIdentifier.stairAscentSpeed;
|
|
760
|
-
stairDescentSpeed: HKQuantityTypeIdentifier.stairDescentSpeed;
|
|
761
|
-
uvExposure: HKQuantityTypeIdentifier.uvExposure;
|
|
762
|
-
bloodPressure: HKCorrelationTypeIdentifier.bloodPressure;
|
|
763
|
-
food: HKCorrelationTypeIdentifier.food;
|
|
764
|
-
sleepAnalysis: HKCategoryTypeIdentifier.sleepAnalysis;
|
|
765
|
-
appleStandHour: HKCategoryTypeIdentifier.appleStandHour;
|
|
766
|
-
cervicalMucusQuality: HKCategoryTypeIdentifier.cervicalMucusQuality;
|
|
767
|
-
ovulationTestResult: HKCategoryTypeIdentifier.ovulationTestResult;
|
|
768
|
-
menstrualFlow: HKCategoryTypeIdentifier.menstrualFlow;
|
|
769
|
-
intermenstrualBleeding: HKCategoryTypeIdentifier.intermenstrualBleeding;
|
|
770
|
-
sexualActivity: HKCategoryTypeIdentifier.sexualActivity;
|
|
771
|
-
mindfulSession: HKCategoryTypeIdentifier.mindfulSession;
|
|
772
|
-
highHeartRateEvent: HKCategoryTypeIdentifier.highHeartRateEvent;
|
|
773
|
-
lowHeartRateEvent: HKCategoryTypeIdentifier.lowHeartRateEvent;
|
|
774
|
-
irregularHeartRhythmEvent: HKCategoryTypeIdentifier.irregularHeartRhythmEvent;
|
|
775
|
-
audioExposureEvent: HKCategoryTypeIdentifier.audioExposureEvent;
|
|
776
|
-
toothbrushingEvent: HKCategoryTypeIdentifier.toothbrushingEvent;
|
|
777
|
-
fitzpatrickSkinType: HKCharacteristicTypeIdentifier.fitzpatrickSkinType;
|
|
778
|
-
biologicalSex: HKCharacteristicTypeIdentifier.biologicalSex;
|
|
779
|
-
bloodType: HKCharacteristicTypeIdentifier.bloodType;
|
|
780
|
-
dateOfBirth: HKCharacteristicTypeIdentifier.dateOfBirth;
|
|
781
|
-
wheelchairUse: HKCharacteristicTypeIdentifier.wheelchairUse;
|
|
782
|
-
};
|
|
783
565
|
declare type ReactNativeHealthkitTypeNative = {
|
|
784
566
|
isHealthDataAvailable(): Promise<boolean>;
|
|
785
567
|
getBloodType(): Promise<HKBloodType>;
|
|
@@ -787,15 +569,15 @@ declare type ReactNativeHealthkitTypeNative = {
|
|
|
787
569
|
getBiologicalSex(): Promise<HKBiologicalSex>;
|
|
788
570
|
getFitzpatrickSkinType(): Promise<HKFitzpatrickSkinType>;
|
|
789
571
|
readonly getWheelchairUse: () => Promise<HKWheelchairUse>;
|
|
790
|
-
readonly enableBackgroundDelivery: (typeIdentifier:
|
|
791
|
-
readonly disableBackgroundDelivery: (typeIdentifier:
|
|
572
|
+
readonly enableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier, updateFrequency: HKUpdateFrequency) => Promise<boolean>;
|
|
573
|
+
readonly disableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier) => Promise<boolean>;
|
|
792
574
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
793
575
|
readonly saveCorrelationSample: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, samples: readonly Omit<HKCategorySampleRaw | HKQuantitySampleRaw, 'device' | 'endDate' | 'startDate' | 'uuid'>[], start: string, end: string, metadata: MetadataMapperForCorrelationIdentifier<TIdentifier>) => Promise<boolean>;
|
|
794
576
|
readonly saveWorkoutSample: (typeIdentifier: HKWorkoutActivityType, quantities: readonly Omit<HKQuantitySampleRaw, 'device' | 'endDate' | 'startDate' | 'uuid'>[], start: string, end: string, metadata: HKWorkoutMetadata) => Promise<boolean>;
|
|
795
577
|
readonly queryCorrelationSamples: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, from: string, to: string) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
|
|
796
|
-
subscribeToObserverQuery(identifier:
|
|
578
|
+
subscribeToObserverQuery(identifier: HKSampleTypeIdentifier): Promise<QueryId>;
|
|
797
579
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
798
|
-
authorizationStatusFor(type:
|
|
580
|
+
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<boolean>;
|
|
799
581
|
getRequestStatusForAuthorization(write: WritePermissions, read: ReadPermissions): Promise<HKAuthorizationRequestStatus>;
|
|
800
582
|
requestAuthorization(write: WritePermissions, read: ReadPermissions): Promise<boolean>;
|
|
801
583
|
readonly saveQuantitySample: (identifier: HKQuantityTypeIdentifier, unit: HKUnit, value: number, start: string, end: string, metadata: unknown) => Promise<boolean>;
|
|
@@ -809,7 +591,7 @@ declare type ReactNativeHealthkitTypeNative = {
|
|
|
809
591
|
};
|
|
810
592
|
declare const Native: ReactNativeHealthkitTypeNative;
|
|
811
593
|
declare type OnChangeCallback = ({ typeIdentifier, }: {
|
|
812
|
-
readonly typeIdentifier:
|
|
594
|
+
readonly typeIdentifier: HKSampleTypeIdentifier;
|
|
813
595
|
}) => void;
|
|
814
596
|
interface HealthkitEventEmitter extends NativeEventEmitter {
|
|
815
597
|
readonly addListener: (eventType: 'onChange', callback: OnChangeCallback) => EmitterSubscription;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { HKAuthorizationRequestStatus, HKBiologicalSex, HKBloodType, HKCategorySampleRaw, HKCategoryTypeIdentifier, HKCategoryValueForIdentifier,
|
|
2
|
-
import type { ValueOf } from 'type-fest';
|
|
1
|
+
import type { HealthkitReadAuthorization, HealthkitWriteAuthorization, HKAuthorizationRequestStatus, HKBiologicalSex, HKBloodType, HKCategorySampleRaw, HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, HKCorrelationRaw, HKCorrelationTypeIdentifier, HKFitzpatrickSkinType, HKQuantitySampleRaw, HKQuantityTypeIdentifier, HKSampleTypeIdentifier, HKStatisticsOptions, HKUnit, HKUnitSI, HKUnitSIPrefix, HKUpdateFrequency, HKWheelchairUse, HKWorkoutActivityType, HKWorkoutMetadata, HKWorkoutRaw, MetadataMapperForCategoryIdentifier, MetadataMapperForCorrelationIdentifier, MetadataMapperForQuantityIdentifier, QueryStatisticsResponseRaw, WorkoutRoute } from './native-types';
|
|
3
2
|
export interface QueryWorkoutsOptions<TEnergy extends HKUnit, TDistance extends HKUnit> extends GenericQueryOptions {
|
|
4
3
|
readonly energyUnit?: TEnergy;
|
|
5
4
|
readonly distanceUnit?: TDistance;
|
|
@@ -37,11 +36,10 @@ export declare type GetWheelchairUseFn = () => Promise<HKWheelchairUse>;
|
|
|
37
36
|
export declare type GetFitzpatrickSkinTypeFn = () => Promise<HKFitzpatrickSkinType>;
|
|
38
37
|
export declare type QueryStatisticsForQuantityFn = <TUnit extends HKUnit>(identifier: HKQuantityTypeIdentifier, options: readonly HKStatisticsOptions[], from: Date, to?: Date, unit?: TUnit) => Promise<QueryStatisticsResponse<TUnit>>;
|
|
39
38
|
export declare type QueryWorkoutsFn = <TEnergy extends HKUnit, TDistance extends HKUnit>(options: QueryWorkoutsOptions<TEnergy, TDistance>) => Promise<readonly HKWorkout<TEnergy, TDistance>[]>;
|
|
40
|
-
export declare type AuthorizationStatusForFn = (type:
|
|
39
|
+
export declare type AuthorizationStatusForFn = (type: HealthkitReadAuthorization) => Promise<boolean>;
|
|
41
40
|
export declare type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(identifier: T, options: GenericQueryOptions) => Promise<readonly HKCategorySample<T>[]>;
|
|
42
|
-
declare type
|
|
43
|
-
export declare type
|
|
44
|
-
export declare type RequestAuthorizationFn = (read: readonly (HKCharacteristicTypeIdentifier | ValueOf<typeof HKSampleTypeIdentifier>)[], write?: readonly ValueOf<typeof HKSampleTypeIdentifier>[]) => Promise<boolean>;
|
|
41
|
+
export declare type GetRequestStatusForAuthorizationFn = (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => Promise<HKAuthorizationRequestStatus>;
|
|
42
|
+
export declare type RequestAuthorizationFn = (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => Promise<boolean>;
|
|
45
43
|
export declare type SaveQuantitySampleFn = <TUnit extends HKQuantityTypeIdentifier>(identifier: TUnit, unit: HKUnit, value: number, options?: {
|
|
46
44
|
readonly start?: Date;
|
|
47
45
|
readonly end?: Date;
|
|
@@ -50,7 +48,7 @@ export declare type SaveQuantitySampleFn = <TUnit extends HKQuantityTypeIdentifi
|
|
|
50
48
|
export declare type QueryQuantitySamplesFn = <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends HKUnit = HKUnit>(identifier: TIdentifier, options: GenericQueryOptions & {
|
|
51
49
|
readonly unit?: TUnit;
|
|
52
50
|
}) => Promise<readonly HKQuantitySample<TIdentifier, TUnit>[]>;
|
|
53
|
-
export declare type SubscribeToChangesFn = (identifier:
|
|
51
|
+
export declare type SubscribeToChangesFn = (identifier: HKSampleTypeIdentifier, callback: () => void) => Promise<UnsubscribeFunction>;
|
|
54
52
|
export declare type SaveCategorySampleFn = <T extends HKCategoryTypeIdentifier>(identifier: T, value: HKCategoryValueForIdentifier<T>, options?: {
|
|
55
53
|
readonly start?: Date;
|
|
56
54
|
readonly end?: Date;
|
|
@@ -80,7 +78,7 @@ export interface HKCorrelation<TIdentifier extends HKCorrelationTypeIdentifier>
|
|
|
80
78
|
readonly endDate: Date;
|
|
81
79
|
}
|
|
82
80
|
export declare type QueryCorrelationSamplesFn = <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, options: Omit<GenericQueryOptions, 'ascending' | 'limit'>) => Promise<readonly HKCorrelation<TIdentifier>[]>;
|
|
83
|
-
export declare type SubscribeToChangesHook = <TIdentifier extends
|
|
81
|
+
export declare type SubscribeToChangesHook = <TIdentifier extends HKSampleTypeIdentifier>(identifier: TIdentifier, onChange: () => void, runInitialUpdate?: boolean) => void;
|
|
84
82
|
export declare type GetWorkoutRoutesFn = (workoutUUID: string) => Promise<readonly WorkoutRoute[]>;
|
|
85
83
|
export declare type ReactNativeHealthkit = {
|
|
86
84
|
readonly authorizationStatusFor: AuthorizationStatusForFn;
|
|
@@ -108,8 +106,8 @@ export declare type ReactNativeHealthkit = {
|
|
|
108
106
|
readonly saveQuantitySample: SaveQuantitySampleFn;
|
|
109
107
|
readonly saveCorrelationSample: SaveCorrelationSampleFn;
|
|
110
108
|
readonly saveWorkoutSample: SaveWorkoutSampleFn;
|
|
111
|
-
readonly enableBackgroundDelivery: (typeIdentifier:
|
|
112
|
-
readonly disableBackgroundDelivery: (typeIdentifier:
|
|
109
|
+
readonly enableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier, updateFrequency: HKUpdateFrequency) => Promise<boolean>;
|
|
110
|
+
readonly disableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier) => Promise<boolean>;
|
|
113
111
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
114
112
|
readonly subscribeToChanges: SubscribeToChangesFn;
|
|
115
113
|
readonly useMostRecentWorkout: MostRecentWorkoutHook;
|
|
@@ -117,6 +115,6 @@ export declare type ReactNativeHealthkit = {
|
|
|
117
115
|
readonly useMostRecentQuantitySample: MostRecentQuantitySampleHook;
|
|
118
116
|
readonly useSubscribeToChanges: SubscribeToChangesHook;
|
|
119
117
|
readonly useIsHealthDataAvailable: () => boolean | null;
|
|
120
|
-
readonly useHealthkitAuthorization: (read: readonly
|
|
118
|
+
readonly useHealthkitAuthorization: (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => readonly [authorizationStatus: HKAuthorizationRequestStatus | null, request: () => Promise<HKAuthorizationRequestStatus | null>];
|
|
121
119
|
};
|
|
122
120
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingstinct/react-native-healthkit",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.4",
|
|
4
4
|
"description": "React Native bindings for HealthKit",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -73,7 +73,6 @@
|
|
|
73
73
|
"react-native": "0.68",
|
|
74
74
|
"react-native-builder-bob": "^0.18.1",
|
|
75
75
|
"release-it": "14",
|
|
76
|
-
"type-fest": "^2.18.0",
|
|
77
76
|
"typescript": ">=4"
|
|
78
77
|
},
|
|
79
78
|
"peerDependencies": {
|
package/src/index.ios.tsx
CHANGED
|
@@ -4,14 +4,14 @@ import Native, {
|
|
|
4
4
|
EventEmitter,
|
|
5
5
|
HKQuantityTypeIdentifier,
|
|
6
6
|
HKUnit,
|
|
7
|
-
HKCategoryTypeIdentifier,
|
|
8
7
|
} from './native-types'
|
|
9
8
|
|
|
10
9
|
import type {
|
|
11
|
-
|
|
10
|
+
HealthkitReadAuthorization,
|
|
11
|
+
HealthkitWriteAuthorization,
|
|
12
|
+
HKAuthorizationRequestStatus,
|
|
12
13
|
HKCategorySampleRaw,
|
|
13
14
|
HKCategoryValueForIdentifier,
|
|
14
|
-
HKCharacteristicTypeIdentifier,
|
|
15
15
|
HKCorrelationRaw,
|
|
16
16
|
HKCorrelationTypeIdentifier,
|
|
17
17
|
HKQuantitySampleRaw,
|
|
@@ -21,8 +21,8 @@ import type {
|
|
|
21
21
|
MetadataMapperForCategoryIdentifier,
|
|
22
22
|
ReadPermissions,
|
|
23
23
|
WritePermissions,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
HKSampleTypeIdentifier,
|
|
25
|
+
HKCategoryTypeIdentifier,
|
|
26
26
|
} from './native-types'
|
|
27
27
|
import type {
|
|
28
28
|
GenericQueryOptions,
|
|
@@ -47,7 +47,6 @@ import type {
|
|
|
47
47
|
SaveWorkoutSampleFn,
|
|
48
48
|
SubscribeToChangesFn,
|
|
49
49
|
} from './types'
|
|
50
|
-
import type { ValueOf } from 'type-fest'
|
|
51
50
|
|
|
52
51
|
const getPreferredUnit: GetPreferredUnitFn = async (type) => {
|
|
53
52
|
const [unit] = await getPreferredUnits([type])
|
|
@@ -237,7 +236,7 @@ const getMostRecentCategorySample: GetMostRecentCategorySampleFn = async (
|
|
|
237
236
|
return samples[0]
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
function useSubscribeToChanges<TIdentifier extends
|
|
239
|
+
function useSubscribeToChanges<TIdentifier extends HKSampleTypeIdentifier>(
|
|
241
240
|
identifier: TIdentifier,
|
|
242
241
|
onChange: () => void,
|
|
243
242
|
): void {
|
|
@@ -255,8 +254,6 @@ function useSubscribeToChanges<TIdentifier extends ValueOf<typeof HKSampleTypeId
|
|
|
255
254
|
}, [identifier, onChange])
|
|
256
255
|
}
|
|
257
256
|
|
|
258
|
-
useSubscribeToChanges(HKCategoryTypeIdentifier.appleStandHour, () => {})
|
|
259
|
-
|
|
260
257
|
function useMostRecentCategorySample<
|
|
261
258
|
TCategory extends HKCategoryTypeIdentifier
|
|
262
259
|
>(identifier: TCategory) {
|
|
@@ -355,8 +352,8 @@ const queryStatisticsForQuantity: QueryStatisticsForQuantityFn = async (
|
|
|
355
352
|
}
|
|
356
353
|
|
|
357
354
|
const requestAuthorization = async (
|
|
358
|
-
read: readonly
|
|
359
|
-
write: readonly
|
|
355
|
+
read: readonly HealthkitReadAuthorization[],
|
|
356
|
+
write: readonly HealthkitWriteAuthorization[] = [],
|
|
360
357
|
): Promise<boolean> => {
|
|
361
358
|
const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)
|
|
362
359
|
|
|
@@ -371,8 +368,8 @@ const getDateOfBirth = async () => {
|
|
|
371
368
|
}
|
|
372
369
|
|
|
373
370
|
const getRequestStatusForAuthorization = async (
|
|
374
|
-
read: readonly
|
|
375
|
-
write: readonly
|
|
371
|
+
read: readonly HealthkitReadAuthorization[],
|
|
372
|
+
write: readonly HealthkitWriteAuthorization[] = [],
|
|
376
373
|
) => {
|
|
377
374
|
const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)
|
|
378
375
|
|
package/src/native-types.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
} from 'react-native'
|
|
5
5
|
|
|
6
6
|
import type { EmitterSubscription } from 'react-native'
|
|
7
|
-
import type { ValueOf } from 'type-fest'
|
|
8
7
|
|
|
9
8
|
export const HKWorkoutTypeIdentifier = 'HKWorkoutTypeIdentifier' as const
|
|
10
9
|
export const HKAudiogramTypeIdentifier = 'HKAudiogramTypeIdentifier' as const
|
|
@@ -151,15 +150,20 @@ export enum HKCategoryTypeIdentifier {
|
|
|
151
150
|
toothbrushingEvent = 'HKCategoryTypeIdentifierToothbrushingEvent',
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
export
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
153
|
+
export type HKSampleTypeIdentifier =
|
|
154
|
+
HKCategoryTypeIdentifier
|
|
155
|
+
| HKCorrelationTypeIdentifier
|
|
156
|
+
| HKQuantityTypeIdentifier
|
|
157
|
+
| typeof HKAudiogramTypeIdentifier
|
|
158
|
+
| typeof HKDataTypeIdentifierHeartbeatSeries
|
|
159
|
+
| typeof HKWorkoutRouteTypeIdentifier
|
|
160
|
+
| typeof HKWorkoutTypeIdentifier
|
|
161
|
+
| `${HKCategoryTypeIdentifier}`
|
|
162
|
+
| `${HKCorrelationTypeIdentifier}`
|
|
163
|
+
| `${HKQuantityTypeIdentifier}`
|
|
164
|
+
|
|
165
|
+
export type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`
|
|
166
|
+
export type HealthkitWriteAuthorization = HKSampleTypeIdentifier
|
|
163
167
|
|
|
164
168
|
export enum HKCategoryValueAppleStandHour {
|
|
165
169
|
stood = 0,
|
|
@@ -296,11 +300,19 @@ export enum HKWeatherCondition {
|
|
|
296
300
|
tornado = 27,
|
|
297
301
|
}
|
|
298
302
|
|
|
303
|
+
enum HKIndoorWorkout {
|
|
304
|
+
false = 0,
|
|
305
|
+
true = 1,
|
|
306
|
+
}
|
|
307
|
+
|
|
299
308
|
export interface HKWorkoutMetadata
|
|
300
309
|
extends HKGenericMetadata /* <TTemperatureUnit extends HKUnit> */ {
|
|
301
310
|
readonly HKWeatherCondition?: HKWeatherCondition;
|
|
302
311
|
readonly HKWeatherHumidity?: HKQuantity<HKUnit.Percent>;
|
|
303
312
|
// HKWeatherTemperature: HKQuantity<TTemperatureUnit>
|
|
313
|
+
readonly HKAverageMETs?: HKQuantity<HKUnit>,
|
|
314
|
+
readonly HKElevationAscended?: HKQuantity<HKUnit.Meters>,
|
|
315
|
+
readonly HKIndoorWorkout?: HKIndoorWorkout,
|
|
304
316
|
}
|
|
305
317
|
|
|
306
318
|
export enum HKAuthorizationRequestStatus {
|
|
@@ -576,13 +588,13 @@ export enum HKUnit {
|
|
|
576
588
|
}
|
|
577
589
|
|
|
578
590
|
export type HKDevice = {
|
|
579
|
-
readonly name: string;
|
|
580
|
-
readonly firmwareVersion: string;
|
|
581
|
-
readonly hardwareVersion: string;
|
|
582
|
-
readonly localIdentifier: string;
|
|
583
|
-
readonly manufacturer: string;
|
|
584
|
-
readonly model: string;
|
|
585
|
-
readonly softwareVersion: string;
|
|
591
|
+
readonly name: string; // ex: "Apple Watch"
|
|
592
|
+
readonly firmwareVersion: string | null;
|
|
593
|
+
readonly hardwareVersion: string; // ex: "Watch6,2",
|
|
594
|
+
readonly localIdentifier: string | null;
|
|
595
|
+
readonly manufacturer: string; // ex: "Apple Inc."
|
|
596
|
+
readonly model: string; // ex: "Watch"
|
|
597
|
+
readonly softwareVersion: string; // ex: "9.0"
|
|
586
598
|
};
|
|
587
599
|
|
|
588
600
|
export type HKSource = {
|
|
@@ -692,8 +704,6 @@ export type WorkoutRoute = {
|
|
|
692
704
|
readonly HKMetadataKeySyncVersion?: number;
|
|
693
705
|
};
|
|
694
706
|
|
|
695
|
-
export const HealthkitAuthorization = { ...HKCharacteristicTypeIdentifier, ...HKSampleTypeIdentifier }
|
|
696
|
-
|
|
697
707
|
type ReactNativeHealthkitTypeNative = {
|
|
698
708
|
isHealthDataAvailable(): Promise<boolean>;
|
|
699
709
|
getBloodType(): Promise<HKBloodType>;
|
|
@@ -703,11 +713,11 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
703
713
|
readonly getWheelchairUse: () => Promise<HKWheelchairUse>;
|
|
704
714
|
|
|
705
715
|
readonly enableBackgroundDelivery: (
|
|
706
|
-
typeIdentifier:
|
|
716
|
+
typeIdentifier: HKSampleTypeIdentifier,
|
|
707
717
|
updateFrequency: HKUpdateFrequency
|
|
708
718
|
) => Promise<boolean>;
|
|
709
719
|
readonly disableBackgroundDelivery: (
|
|
710
|
-
typeIdentifier:
|
|
720
|
+
typeIdentifier: HKSampleTypeIdentifier,
|
|
711
721
|
) => Promise<boolean>;
|
|
712
722
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
713
723
|
|
|
@@ -740,11 +750,11 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
740
750
|
) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
|
|
741
751
|
|
|
742
752
|
subscribeToObserverQuery(
|
|
743
|
-
identifier:
|
|
753
|
+
identifier: HKSampleTypeIdentifier
|
|
744
754
|
): Promise<QueryId>;
|
|
745
755
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
746
756
|
authorizationStatusFor(
|
|
747
|
-
type:
|
|
757
|
+
type: HealthkitReadAuthorization
|
|
748
758
|
): Promise<boolean>;
|
|
749
759
|
getRequestStatusForAuthorization(
|
|
750
760
|
write: WritePermissions,
|
|
@@ -813,7 +823,7 @@ const Native = NativeModules.ReactNativeHealthkit as ReactNativeHealthkitTypeNat
|
|
|
813
823
|
type OnChangeCallback = ({
|
|
814
824
|
typeIdentifier,
|
|
815
825
|
}: {
|
|
816
|
-
readonly typeIdentifier:
|
|
826
|
+
readonly typeIdentifier: HKSampleTypeIdentifier;
|
|
817
827
|
}) => void;
|
|
818
828
|
|
|
819
829
|
interface HealthkitEventEmitter extends NativeEventEmitter {
|