@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
package/src/types.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
HealthkitReadAuthorization,
|
|
3
|
+
HealthkitWriteAuthorization,
|
|
2
4
|
HKAuthorizationRequestStatus,
|
|
3
5
|
HKBiologicalSex,
|
|
4
6
|
HKBloodType,
|
|
5
7
|
HKCategorySampleRaw,
|
|
6
8
|
HKCategoryTypeIdentifier,
|
|
7
9
|
HKCategoryValueForIdentifier,
|
|
8
|
-
HKCharacteristicTypeIdentifier,
|
|
9
10
|
HKCorrelationRaw,
|
|
10
11
|
HKCorrelationTypeIdentifier,
|
|
11
12
|
HKFitzpatrickSkinType,
|
|
@@ -26,9 +27,7 @@ import type {
|
|
|
26
27
|
MetadataMapperForQuantityIdentifier,
|
|
27
28
|
QueryStatisticsResponseRaw,
|
|
28
29
|
WorkoutRoute,
|
|
29
|
-
HealthkitAuthorization,
|
|
30
30
|
} from './native-types'
|
|
31
|
-
import type { ValueOf } from 'type-fest'
|
|
32
31
|
|
|
33
32
|
export interface QueryWorkoutsOptions<
|
|
34
33
|
TEnergy extends HKUnit,
|
|
@@ -106,7 +105,7 @@ export type QueryWorkoutsFn = <
|
|
|
106
105
|
) => Promise<readonly HKWorkout<TEnergy, TDistance>[]>;
|
|
107
106
|
|
|
108
107
|
export type AuthorizationStatusForFn = (
|
|
109
|
-
type:
|
|
108
|
+
type: HealthkitReadAuthorization
|
|
110
109
|
) => Promise<boolean>;
|
|
111
110
|
|
|
112
111
|
export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(
|
|
@@ -114,16 +113,14 @@ export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(
|
|
|
114
113
|
options: GenericQueryOptions
|
|
115
114
|
) => Promise<readonly HKCategorySample<T>[]>;
|
|
116
115
|
|
|
117
|
-
type ReadPermission = HKCharacteristicTypeIdentifier | ValueOf<typeof HKSampleTypeIdentifier>
|
|
118
|
-
|
|
119
116
|
export type GetRequestStatusForAuthorizationFn = (
|
|
120
|
-
read: readonly
|
|
121
|
-
write?: readonly
|
|
117
|
+
read: readonly HealthkitReadAuthorization[],
|
|
118
|
+
write?: readonly HealthkitWriteAuthorization[]
|
|
122
119
|
) => Promise<HKAuthorizationRequestStatus>;
|
|
123
120
|
|
|
124
121
|
export type RequestAuthorizationFn = (
|
|
125
|
-
read: readonly
|
|
126
|
-
write?: readonly
|
|
122
|
+
read: readonly HealthkitReadAuthorization[],
|
|
123
|
+
write?: readonly HealthkitWriteAuthorization[]
|
|
127
124
|
) => Promise<boolean>;
|
|
128
125
|
|
|
129
126
|
export type SaveQuantitySampleFn = <TUnit extends HKQuantityTypeIdentifier>(
|
|
@@ -146,7 +143,7 @@ export type QueryQuantitySamplesFn = <
|
|
|
146
143
|
) => Promise<readonly HKQuantitySample<TIdentifier, TUnit>[]>;
|
|
147
144
|
|
|
148
145
|
export type SubscribeToChangesFn = (
|
|
149
|
-
identifier:
|
|
146
|
+
identifier: HKSampleTypeIdentifier,
|
|
150
147
|
callback: () => void
|
|
151
148
|
) => Promise<UnsubscribeFunction>;
|
|
152
149
|
|
|
@@ -266,7 +263,7 @@ export type QueryCorrelationSamplesFn = <
|
|
|
266
263
|
) => Promise<readonly HKCorrelation<TIdentifier>[]>;
|
|
267
264
|
|
|
268
265
|
export type SubscribeToChangesHook = <
|
|
269
|
-
TIdentifier extends
|
|
266
|
+
TIdentifier extends HKSampleTypeIdentifier
|
|
270
267
|
>(
|
|
271
268
|
identifier: TIdentifier,
|
|
272
269
|
onChange: () => void,
|
|
@@ -310,11 +307,11 @@ export type ReactNativeHealthkit = {
|
|
|
310
307
|
readonly saveCorrelationSample: SaveCorrelationSampleFn;
|
|
311
308
|
readonly saveWorkoutSample: SaveWorkoutSampleFn;
|
|
312
309
|
readonly enableBackgroundDelivery: (
|
|
313
|
-
typeIdentifier:
|
|
310
|
+
typeIdentifier: HKSampleTypeIdentifier,
|
|
314
311
|
updateFrequency: HKUpdateFrequency
|
|
315
312
|
) => Promise<boolean>;
|
|
316
313
|
readonly disableBackgroundDelivery: (
|
|
317
|
-
typeIdentifier:
|
|
314
|
+
typeIdentifier: HKSampleTypeIdentifier
|
|
318
315
|
) => Promise<boolean>;
|
|
319
316
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
320
317
|
|
|
@@ -327,7 +324,7 @@ export type ReactNativeHealthkit = {
|
|
|
327
324
|
readonly useSubscribeToChanges: SubscribeToChangesHook;
|
|
328
325
|
readonly useIsHealthDataAvailable: () => boolean | null;
|
|
329
326
|
readonly useHealthkitAuthorization: (
|
|
330
|
-
read: readonly
|
|
331
|
-
write?: readonly
|
|
327
|
+
read: readonly HealthkitReadAuthorization[],
|
|
328
|
+
write?: readonly HealthkitWriteAuthorization[],
|
|
332
329
|
) => readonly [authorizationStatus: HKAuthorizationRequestStatus | null, request: () => Promise<HKAuthorizationRequestStatus | null>];
|
|
333
330
|
};
|