@kingstinct/react-native-healthkit 5.2.0 → 5.3.0
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/ios/ReactNativeHealthkit.m +7 -0
- package/ios/ReactNativeHealthkit.swift +22 -0
- package/lib/commonjs/index.ios.js +3 -0
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jest.setup.js +1 -0
- package/lib/commonjs/jest.setup.js.map +1 -1
- package/lib/commonjs/native-types.js +10 -3
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/utils/deleteSamples.js +23 -0
- package/lib/commonjs/utils/deleteSamples.js.map +1 -0
- package/lib/module/index.ios.js +2 -0
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest.setup.js +1 -0
- package/lib/module/jest.setup.js.map +1 -1
- package/lib/module/native-types.js +10 -3
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/utils/deleteSamples.js +13 -0
- package/lib/module/utils/deleteSamples.js.map +1 -0
- package/lib/typescript/src/index.ios.d.ts +1 -0
- package/lib/typescript/src/native-types.d.ts +13 -5
- package/lib/typescript/src/utils/deleteSamples.d.ts +8 -0
- package/package.json +1 -1
- package/src/index.ios.tsx +2 -0
- package/src/index.tsx +1 -0
- package/src/jest.setup.ts +1 -0
- package/src/native-types.ts +20 -3
- package/src/utils/deleteSamples.ts +23 -0
package/src/jest.setup.ts
CHANGED
|
@@ -10,6 +10,7 @@ const mockModule: (NativeModule & typeof Native) = {
|
|
|
10
10
|
requestAuthorization: jest.fn(),
|
|
11
11
|
saveQuantitySample: jest.fn(),
|
|
12
12
|
deleteQuantitySample: jest.fn(),
|
|
13
|
+
deleteSamples: jest.fn(),
|
|
13
14
|
disableAllBackgroundDelivery: jest.fn(),
|
|
14
15
|
disableBackgroundDelivery: jest.fn(),
|
|
15
16
|
enableBackgroundDelivery: jest.fn(),
|
package/src/native-types.ts
CHANGED
|
@@ -29,7 +29,7 @@ export enum HKQuantityTypeIdentifier {
|
|
|
29
29
|
pushCount = 'HKQuantityTypeIdentifierPushCount', // Scalar(Count), Cumulative
|
|
30
30
|
distanceSwimming = 'HKQuantityTypeIdentifierDistanceSwimming', // Length, Cumulative
|
|
31
31
|
swimmingStrokeCount = 'HKQuantityTypeIdentifierSwimmingStrokeCount', // Scalar(Count), Cumulative
|
|
32
|
-
vo2Max = '
|
|
32
|
+
vo2Max = 'HKQuantityTypeIdentifierVO2Max', // ml/(kg*min) Discrete
|
|
33
33
|
distanceDownhillSnowSports = 'HKQuantityTypeIdentifierDistanceDownhillSnowSports', // Length, Cumulative
|
|
34
34
|
|
|
35
35
|
appleStandTime = 'HKQuantityTypeIdentifierAppleStandTime', // Time, Cumulative
|
|
@@ -113,12 +113,21 @@ export enum HKQuantityTypeIdentifier {
|
|
|
113
113
|
stairAscentSpeed = 'HKQuantityTypeIdentifierStairAscentSpeed',
|
|
114
114
|
stairDescentSpeed = 'HKQuantityTypeIdentifierStairDescentSpeed',
|
|
115
115
|
|
|
116
|
-
uvExposure = '
|
|
116
|
+
uvExposure = 'HKQuantityTypeIdentifierUVExposure', // Scalar (Count), Discrete
|
|
117
117
|
|
|
118
118
|
appleMoveTime = 'HKQuantityTypeIdentifierAppleMoveTime', // Time, Cumulative
|
|
119
119
|
appleWalkingSteadiness = 'HKQuantityTypeIdentifierAppleWalkingSteadiness', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
120
120
|
|
|
121
121
|
numberOfAlcoholicBeverages = 'HKQuantityTypeIdentifierNumberOfAlcoholicBeverages', // Scalar(Count), Cumulative
|
|
122
|
+
|
|
123
|
+
atrialFibrillationBurden = 'HKQuantityTypeIdentifierAtrialFibrillationBurden', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
124
|
+
|
|
125
|
+
underwaterDepth = 'HKQuantityTypeIdentifierUnderwaterDepth', // Length, Discrete
|
|
126
|
+
|
|
127
|
+
waterTemperature = 'HKQuantityTypeIdentifierWaterTemperature', // Temperature, Discrete
|
|
128
|
+
|
|
129
|
+
appleSleepingWristTemperature = 'HKQuantityTypeIdentifierAppleSleepingWristTemperature', // Temperature, Discrete
|
|
130
|
+
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
export type TypeToUnitMapping = {
|
|
@@ -483,8 +492,11 @@ export enum HKCategoryValueOvulationTestResult {
|
|
|
483
492
|
|
|
484
493
|
export enum HKCategoryValueSleepAnalysis {
|
|
485
494
|
inBed = 0,
|
|
486
|
-
|
|
495
|
+
asleepUnspecified = 1,
|
|
487
496
|
awake = 2,
|
|
497
|
+
asleepCore = 3,
|
|
498
|
+
asleepDeep = 4,
|
|
499
|
+
asleepREM = 5
|
|
488
500
|
}
|
|
489
501
|
|
|
490
502
|
export enum HKCategoryValueAppetiteChanges {
|
|
@@ -1200,6 +1212,11 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1200
1212
|
typeIdentifier: TIdentifier,
|
|
1201
1213
|
uuid: string
|
|
1202
1214
|
) => Promise<boolean>;
|
|
1215
|
+
readonly deleteSamples: <TIdentifier extends HKQuantityTypeIdentifier>(
|
|
1216
|
+
identifier: TIdentifier,
|
|
1217
|
+
start: string,
|
|
1218
|
+
end: string,
|
|
1219
|
+
) => Promise<boolean>;
|
|
1203
1220
|
readonly queryWorkoutSamples: <
|
|
1204
1221
|
TEnergy extends EnergyUnit,
|
|
1205
1222
|
TDistance extends LengthUnit
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Native from '../native-types'
|
|
2
|
+
|
|
3
|
+
import type { HKQuantityTypeIdentifier } from '../native-types'
|
|
4
|
+
|
|
5
|
+
export type DeleteSamplesFn = <
|
|
6
|
+
TIdentifier extends HKQuantityTypeIdentifier
|
|
7
|
+
>(
|
|
8
|
+
sample: {
|
|
9
|
+
readonly identifier: TIdentifier,
|
|
10
|
+
readonly startDate?: Date;
|
|
11
|
+
readonly endDate?: Date;
|
|
12
|
+
}
|
|
13
|
+
) => Promise<boolean>
|
|
14
|
+
|
|
15
|
+
const deleteSamples: DeleteSamplesFn = async (sample) => {
|
|
16
|
+
const start = sample.startDate || new Date()
|
|
17
|
+
const end = sample.endDate || new Date()
|
|
18
|
+
const { identifier } = sample
|
|
19
|
+
|
|
20
|
+
return Native.deleteSamples(identifier, start.toISOString(), end.toISOString())
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default deleteSamples
|