@kingstinct/react-native-healthkit 7.0.0 → 7.0.2
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/README.md +9 -3
- package/app.plugin.js +23 -4
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/native-types.js +87 -2
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/utils/queryCategorySamples.js +2 -1
- package/lib/commonjs/utils/queryCategorySamples.js.map +1 -1
- package/lib/commonjs/utils/queryQuantitySamples.js +2 -1
- package/lib/commonjs/utils/queryQuantitySamples.js.map +1 -1
- package/lib/commonjs/utils/requestAuthorization.js +1 -0
- package/lib/commonjs/utils/requestAuthorization.js.map +1 -1
- package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/module/native-types.js +107 -2
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/utils/queryCategorySamples.js +2 -1
- package/lib/module/utils/queryCategorySamples.js.map +1 -1
- package/lib/module/utils/queryQuantitySamples.js +2 -1
- package/lib/module/utils/queryQuantitySamples.js.map +1 -1
- package/lib/module/utils/requestAuthorization.js +1 -0
- package/lib/module/utils/requestAuthorization.js.map +1 -1
- package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +3 -2
- package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +3 -2
- package/lib/typescript/src/native-types.d.ts +96 -1
- package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +1 -1
- package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +1 -1
- package/lib/typescript/src/utils/queryCategorySamples.d.ts +3 -3
- package/lib/typescript/src/utils/queryQuantitySamples.d.ts +3 -3
- package/lib/typescript/src/utils/requestAuthorization.d.ts +1 -0
- package/package.json +1 -1
- package/src/hooks/useMostRecentCategorySample.ts +3 -2
- package/src/hooks/useMostRecentQuantitySample.ts +3 -2
- package/src/native-types.ts +102 -1
- package/src/utils/queryCategorySamples.ts +5 -4
- package/src/utils/queryQuantitySamples.ts +5 -4
- package/src/utils/requestAuthorization.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareOptions","Native","queryCategorySamples","identifier","options","opts","raw","from","to","limit","ascending"],"sources":["queryCategorySamples.ts"],"sourcesContent":["import prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier
|
|
1
|
+
{"version":3,"names":["deserializeCategorySample","prepareOptions","Native","queryCategorySamples","identifier","options","opts","raw","from","to","limit","ascending","map"],"sources":["queryCategorySamples.ts"],"sourcesContent":["import deserializeCategorySample from './deserializeCategorySample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { GenericQueryOptions, HKCategorySample } from '../types'\n\nexport type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: Omit<GenericQueryOptions, 'anchor'>\n) => Promise<readonly HKCategorySample<T>[]>;\n\nconst queryCategorySamples: QueryCategorySamplesFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamples(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return raw.map(deserializeCategorySample)\n}\n\nexport default queryCategorySamples\n"],"mappings":"AAAA,OAAOA,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAUpC,MAAMC,oBAA4C,GAAG,MAAAA,CACnDC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAGL,cAAc,CAACI,OAAO,CAAC;EACpC,MAAME,GAAG,GAAG,MAAML,MAAM,CAACC,oBAAoB,CAC3CC,UAAU,EACVE,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,SACP,CAAC;EAED,OAAOJ,GAAG,CAACK,GAAG,CAACZ,yBAAyB,CAAC;AAC3C,CAAC;AAED,eAAeG,oBAAoB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import deserializeQuantitySample from './deserializeSample';
|
|
1
2
|
import ensureUnit from './ensureUnit';
|
|
2
3
|
import prepareOptions from './prepareOptions';
|
|
3
4
|
import Native from '../native-types';
|
|
@@ -5,7 +6,7 @@ const queryQuantitySamples = async (identifier, options) => {
|
|
|
5
6
|
const unit = await ensureUnit(identifier, options.unit);
|
|
6
7
|
const opts = prepareOptions(options);
|
|
7
8
|
const result = await Native.queryQuantitySamples(identifier, unit, opts.from, opts.to, opts.limit, opts.ascending);
|
|
8
|
-
return result;
|
|
9
|
+
return result.map(deserializeQuantitySample);
|
|
9
10
|
};
|
|
10
11
|
export default queryQuantitySamples;
|
|
11
12
|
//# sourceMappingURL=queryQuantitySamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ensureUnit","prepareOptions","Native","queryQuantitySamples","identifier","options","unit","opts","result","from","to","limit","ascending"],"sources":["queryQuantitySamples.ts"],"sourcesContent":["import ensureUnit from './ensureUnit'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type {\n HKQuantityTypeIdentifier, UnitForIdentifier
|
|
1
|
+
{"version":3,"names":["deserializeQuantitySample","ensureUnit","prepareOptions","Native","queryQuantitySamples","identifier","options","unit","opts","result","from","to","limit","ascending","map"],"sources":["queryQuantitySamples.ts"],"sourcesContent":["import deserializeQuantitySample from './deserializeSample'\nimport ensureUnit from './ensureUnit'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type {\n HKQuantityTypeIdentifier, UnitForIdentifier,\n} from '../native-types'\nimport type { GenericQueryOptions, HKQuantitySample } from '../types'\n\nexport type QueryQuantitySamplesFn = <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'anchor'> & { readonly unit?: TUnit }\n) => Promise<readonly HKQuantitySample<TIdentifier>[]>;\n\nconst queryQuantitySamples: QueryQuantitySamplesFn = async (\n identifier,\n options,\n) => {\n const unit = await ensureUnit(identifier, options.unit)\n const opts = prepareOptions(options)\n\n const result = await Native.queryQuantitySamples(\n identifier,\n unit,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return result.map(deserializeQuantitySample)\n}\n\nexport default queryQuantitySamples\n"],"mappings":"AAAA,OAAOA,yBAAyB,MAAM,qBAAqB;AAC3D,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAepC,MAAMC,oBAA4C,GAAG,MAAAA,CACnDC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,MAAMN,UAAU,CAACI,UAAU,EAAEC,OAAO,CAACC,IAAI,CAAC;EACvD,MAAMC,IAAI,GAAGN,cAAc,CAACI,OAAO,CAAC;EAEpC,MAAMG,MAAM,GAAG,MAAMN,MAAM,CAACC,oBAAoB,CAC9CC,UAAU,EACVE,IAAI,EACJC,IAAI,CAACE,IAAI,EACTF,IAAI,CAACG,EAAE,EACPH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,SACP,CAAC;EAED,OAAOJ,MAAM,CAACK,GAAG,CAACd,yBAAyB,CAAC;AAC9C,CAAC;AAED,eAAeI,oBAAoB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization */
|
|
2
3
|
const requestAuthorization = async function (read) {
|
|
3
4
|
let write = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4
5
|
const readPermissions = read.reduce((obj, cur) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","requestAuthorization","read","write","arguments","length","undefined","readPermissions","reduce","obj","cur","writePermissions"],"sources":["requestAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst requestAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n): Promise<boolean> => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.requestAuthorization(writePermissions, readPermissions)\n}\n\nexport default requestAuthorization\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAMpC,MAAMC,oBAAoB,GAAG,eAAAA,CAC3BC,IAA2C,EAEtB;EAAA,IADrBC,KAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAElD,MAAMG,eAAe,GAAGL,IAAI,CAACM,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGR,KAAK,CAACK,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOV,MAAM,CAACC,oBAAoB,CAACU,gBAAgB,EAAEJ,eAAe,CAAC;AACvE,CAAC;AAED,eAAeN,oBAAoB"}
|
|
1
|
+
{"version":3,"names":["Native","requestAuthorization","read","write","arguments","length","undefined","readPermissions","reduce","obj","cur","writePermissions"],"sources":["requestAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\n/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization */\nconst requestAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n): Promise<boolean> => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.requestAuthorization(writePermissions, readPermissions)\n}\n\nexport default requestAuthorization\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAMpC;AACA,MAAMC,oBAAoB,GAAG,eAAAA,CAC3BC,IAA2C,EAEtB;EAAA,IADrBC,KAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAElD,MAAMG,eAAe,GAAGL,IAAI,CAACM,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGR,KAAK,CAACK,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,MAAM;IAAE,GAAGD,GAAG;IAAE,CAACC,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOV,MAAM,CAACC,oBAAoB,CAACU,gBAAgB,EAAEJ,eAAe,CAAC;AACvE,CAAC;AAED,eAAeN,oBAAoB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
+
import type { HKCategorySample } from '../types';
|
|
3
|
+
declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySample<TCategory> | null;
|
|
3
4
|
export default useMostRecentCategorySample;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
+
import type { HKQuantitySample } from '../types';
|
|
3
|
+
declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySample<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
|
|
3
4
|
export default useMostRecentQuantitySample;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { NativeEventEmitter } from 'react-native';
|
|
2
2
|
import type { EmitterSubscription } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* See https://developer.apple.com/documentation/healthkit/hkworkouttypeidentifier
|
|
5
|
+
*/
|
|
3
6
|
export declare const HKWorkoutTypeIdentifier: "HKWorkoutTypeIdentifier";
|
|
4
7
|
export declare const HKAudiogramTypeIdentifier: "HKAudiogramTypeIdentifier";
|
|
8
|
+
/**
|
|
9
|
+
* See https://developer.apple.com/documentation/healthkit/hkworkoutroutetypeidentifier
|
|
10
|
+
*/
|
|
5
11
|
export declare const HKWorkoutRouteTypeIdentifier: "HKWorkoutRouteTypeIdentifier";
|
|
6
12
|
export declare const HKDataTypeIdentifierHeartbeatSeries: "HKDataTypeIdentifierHeartbeatSeries";
|
|
13
|
+
/**
|
|
14
|
+
* See https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier
|
|
15
|
+
*/
|
|
7
16
|
export declare enum HKQuantityTypeIdentifier {
|
|
8
17
|
bodyMassIndex = "HKQuantityTypeIdentifierBodyMassIndex",
|
|
9
18
|
bodyFatPercentage = "HKQuantityTypeIdentifierBodyFatPercentage",
|
|
@@ -101,7 +110,13 @@ export declare enum HKQuantityTypeIdentifier {
|
|
|
101
110
|
atrialFibrillationBurden = "HKQuantityTypeIdentifierAtrialFibrillationBurden",
|
|
102
111
|
underwaterDepth = "HKQuantityTypeIdentifierUnderwaterDepth",
|
|
103
112
|
waterTemperature = "HKQuantityTypeIdentifierWaterTemperature",
|
|
104
|
-
appleSleepingWristTemperature = "HKQuantityTypeIdentifierAppleSleepingWristTemperature"
|
|
113
|
+
appleSleepingWristTemperature = "HKQuantityTypeIdentifierAppleSleepingWristTemperature",
|
|
114
|
+
timeInDaylight = "HKQuantityTypeIdentifierTimeInDaylight",
|
|
115
|
+
physicalEffort = "HKQuantityTypeIdentifierPhysicalEffort",
|
|
116
|
+
cyclingSpeed = "HKQuantityTypeIdentifierCyclingSpeed",
|
|
117
|
+
cyclingPower = "HKQuantityTypeIdentifierCyclingPower",
|
|
118
|
+
cyclingFunctionalThresholdPower = "HKQuantityTypeIdentifierCyclingFunctionalThresholdPower",
|
|
119
|
+
cyclingCadence = "HKQuantityTypeIdentifierCyclingCadence"
|
|
105
120
|
}
|
|
106
121
|
export type TypeToUnitMapping = {
|
|
107
122
|
readonly [key in HKQuantityTypeIdentifier]: HKUnit;
|
|
@@ -114,10 +129,16 @@ export declare enum HKHeartRateMotionContext {
|
|
|
114
129
|
notSet = 0,
|
|
115
130
|
sedentary = 1
|
|
116
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* See https://developer.apple.com/documentation/healthkit/hkcorrelationtypeidentifier
|
|
134
|
+
*/
|
|
117
135
|
export declare enum HKCorrelationTypeIdentifier {
|
|
118
136
|
bloodPressure = "HKCorrelationTypeIdentifierBloodPressure",
|
|
119
137
|
food = "HKCorrelationTypeIdentifierFood"
|
|
120
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier
|
|
141
|
+
*/
|
|
121
142
|
export declare enum HKCategoryTypeIdentifier {
|
|
122
143
|
sleepAnalysis = "HKCategoryTypeIdentifierSleepAnalysis",
|
|
123
144
|
appleStandHour = "HKCategoryTypeIdentifierAppleStandHour",
|
|
@@ -130,6 +151,9 @@ export declare enum HKCategoryTypeIdentifier {
|
|
|
130
151
|
highHeartRateEvent = "HKCategoryTypeIdentifierHighHeartRateEvent",
|
|
131
152
|
lowHeartRateEvent = "HKCategoryTypeIdentifierLowHeartRateEvent",
|
|
132
153
|
irregularHeartRhythmEvent = "HKCategoryTypeIdentifierIrregularHeartRhythmEvent",
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated Use environmentalAudioExposureEvent instead.
|
|
156
|
+
*/
|
|
133
157
|
audioExposureEvent = "HKCategoryTypeIdentifierAudioExposureEvent",
|
|
134
158
|
toothbrushingEvent = "HKCategoryTypeIdentifierToothbrushingEvent",
|
|
135
159
|
lowCardioFitnessEvent = "HKCategoryTypeIdentifierLowCardioFitnessEvent",
|
|
@@ -326,11 +350,17 @@ export interface HKWorkoutMetadata extends HKGenericMetadata {
|
|
|
326
350
|
readonly HKElevationAscended?: HKQuantity<HKQuantityTypeIdentifier, LengthUnit>;
|
|
327
351
|
readonly HKIndoorWorkout?: HKIndoorWorkout;
|
|
328
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* See https://developer.apple.com/documentation/healthkit/hkauthorizationrequeststatus
|
|
355
|
+
*/
|
|
329
356
|
export declare enum HKAuthorizationRequestStatus {
|
|
330
357
|
unknown = 0,
|
|
331
358
|
shouldRequest = 1,
|
|
332
359
|
unnecessary = 2
|
|
333
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* See https://developer.apple.com/documentation/healthkit/hkauthorizationstatus
|
|
363
|
+
*/
|
|
334
364
|
export declare enum HKAuthorizationStatus {
|
|
335
365
|
notDetermined = 0,
|
|
336
366
|
sharingDenied = 1,
|
|
@@ -340,6 +370,9 @@ export type HKQuantity<TIdentifier extends HKQuantityTypeIdentifier = HKQuantity
|
|
|
340
370
|
readonly unit: TUnit;
|
|
341
371
|
readonly quantity: number;
|
|
342
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* See https://developer.apple.com/documentation/healthkit/hkbloodtype
|
|
375
|
+
*/
|
|
343
376
|
export declare enum HKBloodType {
|
|
344
377
|
notSet = 0,
|
|
345
378
|
aPositive = 1,
|
|
@@ -351,12 +384,18 @@ export declare enum HKBloodType {
|
|
|
351
384
|
oPositive = 7,
|
|
352
385
|
oNegative = 8
|
|
353
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* See https://developer.apple.com/documentation/healthkit/hkbiologicalsex
|
|
389
|
+
*/
|
|
354
390
|
export declare enum HKBiologicalSex {
|
|
355
391
|
notSet = 0,
|
|
356
392
|
female = 1,
|
|
357
393
|
male = 2,
|
|
358
394
|
other = 3
|
|
359
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* See https://developer.apple.com/documentation/healthkit/hkfitzpatrickskintype
|
|
398
|
+
*/
|
|
360
399
|
export declare enum HKFitzpatrickSkinType {
|
|
361
400
|
notSet = 0,
|
|
362
401
|
I = 1,
|
|
@@ -366,6 +405,9 @@ export declare enum HKFitzpatrickSkinType {
|
|
|
366
405
|
V = 5,
|
|
367
406
|
VI = 6
|
|
368
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* See https://developer.apple.com/documentation/healthkit/hkstatisticsoptions
|
|
410
|
+
*/
|
|
369
411
|
export declare enum HKStatisticsOptions {
|
|
370
412
|
cumulativeSum = "cumulativeSum",
|
|
371
413
|
discreteAverage = "discreteAverage",
|
|
@@ -388,6 +430,9 @@ export type QueryStatisticsResponseRaw<TIdentifier extends HKQuantityTypeIdentif
|
|
|
388
430
|
};
|
|
389
431
|
readonly duration?: HKQuantity<HKQuantityTypeIdentifier, TimeUnit>;
|
|
390
432
|
};
|
|
433
|
+
/**
|
|
434
|
+
* https://developer.apple.com/documentation/healthkit/hkcategoryvaluecervicalmucusquality
|
|
435
|
+
*/
|
|
391
436
|
export declare enum HKCategoryValueCervicalMucusQuality {
|
|
392
437
|
dry = 1,
|
|
393
438
|
sticky = 2,
|
|
@@ -395,6 +440,9 @@ export declare enum HKCategoryValueCervicalMucusQuality {
|
|
|
395
440
|
watery = 4,
|
|
396
441
|
eggWhite = 5
|
|
397
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvaluemenstrualflow
|
|
445
|
+
*/
|
|
398
446
|
export declare enum HKCategoryValueMenstrualFlow {
|
|
399
447
|
unspecified = 1,
|
|
400
448
|
none = 5,
|
|
@@ -402,12 +450,18 @@ export declare enum HKCategoryValueMenstrualFlow {
|
|
|
402
450
|
medium = 3,
|
|
403
451
|
heavy = 4
|
|
404
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvalueovulationtestresult
|
|
455
|
+
*/
|
|
405
456
|
export declare enum HKCategoryValueOvulationTestResult {
|
|
406
457
|
negative = 1,
|
|
407
458
|
luteinizingHormoneSurge = 2,
|
|
408
459
|
indeterminate = 3,
|
|
409
460
|
estrogenSurge = 4
|
|
410
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvaluesleepanalysis
|
|
464
|
+
*/
|
|
411
465
|
export declare enum HKCategoryValueSleepAnalysis {
|
|
412
466
|
inBed = 0,
|
|
413
467
|
asleepUnspecified = 1,
|
|
@@ -416,16 +470,25 @@ export declare enum HKCategoryValueSleepAnalysis {
|
|
|
416
470
|
asleepDeep = 4,
|
|
417
471
|
asleepREM = 5
|
|
418
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges
|
|
475
|
+
*/
|
|
419
476
|
export declare enum HKCategoryValueAppetiteChanges {
|
|
420
477
|
decreased = 2,
|
|
421
478
|
increased = 3,
|
|
422
479
|
noChange = 1,
|
|
423
480
|
unspecified = 0
|
|
424
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence
|
|
484
|
+
*/
|
|
425
485
|
export declare enum HKCategoryValuePresence {
|
|
426
486
|
notPresent = 1,
|
|
427
487
|
present = 0
|
|
428
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvalueseverity
|
|
491
|
+
*/
|
|
429
492
|
export declare enum HKCategoryValueSeverity {
|
|
430
493
|
notPresent = 1,
|
|
431
494
|
mild = 2,
|
|
@@ -433,10 +496,19 @@ export declare enum HKCategoryValueSeverity {
|
|
|
433
496
|
severe = 4,
|
|
434
497
|
unspecified = 0
|
|
435
498
|
}
|
|
499
|
+
/**
|
|
500
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvalue/notapplicable
|
|
501
|
+
*/
|
|
436
502
|
export declare enum HKCategoryValueNotApplicable {
|
|
437
503
|
notApplicable = 0
|
|
438
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvalue
|
|
507
|
+
*/
|
|
439
508
|
export type HKCategoryValue = HKCategoryValueAppetiteChanges | HKCategoryValueCervicalMucusQuality | HKCategoryValueLowCardioFitnessEvent | HKCategoryValueMenstrualFlow | HKCategoryValueOvulationTestResult | HKCategoryValuePresence | HKCategoryValueSeverity | HKCategoryValueSleepAnalysis | number;
|
|
509
|
+
/**
|
|
510
|
+
* See https://developer.apple.com/documentation/healthkit/hkinsulindeliveryreason
|
|
511
|
+
*/
|
|
440
512
|
export declare enum HKInsulinDeliveryReason {
|
|
441
513
|
basal = 1,
|
|
442
514
|
bolus = 2
|
|
@@ -453,6 +525,9 @@ export type MetadataMapperForCorrelationIdentifier<TCorrelationTypeIdentifier =
|
|
|
453
525
|
} : HKGenericMetadata;
|
|
454
526
|
export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> = T extends HKQuantityTypeIdentifier.bloodGlucose ? BloodGlucoseUnit : T extends HKQuantityTypeIdentifier.appleExerciseTime | HKQuantityTypeIdentifier.appleMoveTime | HKQuantityTypeIdentifier.appleStandTime ? TimeUnit : T extends HKQuantityTypeIdentifier.activeEnergyBurned | HKQuantityTypeIdentifier.basalEnergyBurned | HKQuantityTypeIdentifier.dietaryEnergyConsumed ? EnergyUnit : T extends HKQuantityTypeIdentifier.distanceCycling | HKQuantityTypeIdentifier.distanceDownhillSnowSports | HKQuantityTypeIdentifier.distanceSwimming | HKQuantityTypeIdentifier.distanceWalkingRunning | HKQuantityTypeIdentifier.distanceWheelchair | HKQuantityTypeIdentifier.sixMinuteWalkTestDistance | HKQuantityTypeIdentifier.waistCircumference ? LengthUnit : T extends HKQuantityTypeIdentifier.bodyFatPercentage | HKQuantityTypeIdentifier.oxygenSaturation | HKQuantityTypeIdentifier.walkingAsymmetryPercentage | HKQuantityTypeIdentifier.walkingDoubleSupportPercentage ? HKUnits.Percent : T extends HKQuantityTypeIdentifier.basalBodyTemperature | HKQuantityTypeIdentifier.basalBodyTemperature ? TemperatureUnit : T extends HKQuantityTypeIdentifier.stairAscentSpeed | HKQuantityTypeIdentifier.stairDescentSpeed | HKQuantityTypeIdentifier.walkingSpeed | HKQuantityTypeIdentifier.walkingSpeed ? SpeedUnit<LengthUnit, TimeUnit> : T extends HKQuantityTypeIdentifier.flightsClimbed | HKQuantityTypeIdentifier.numberOfAlcoholicBeverages | HKQuantityTypeIdentifier.numberOfTimesFallen | HKQuantityTypeIdentifier.pushCount | HKQuantityTypeIdentifier.stepCount | HKQuantityTypeIdentifier.swimmingStrokeCount ? HKUnits.Count : T extends HKQuantityTypeIdentifier.dietaryBiotin | HKQuantityTypeIdentifier.dietaryCaffeine | HKQuantityTypeIdentifier.dietaryCalcium | HKQuantityTypeIdentifier.dietaryCarbohydrates | HKQuantityTypeIdentifier.dietaryChloride | HKQuantityTypeIdentifier.dietaryCholesterol | HKQuantityTypeIdentifier.dietaryChromium | HKQuantityTypeIdentifier.dietaryCopper | HKQuantityTypeIdentifier.dietaryFatMonounsaturated | HKQuantityTypeIdentifier.dietaryFatPolyunsaturated | HKQuantityTypeIdentifier.dietaryFatSaturated | HKQuantityTypeIdentifier.dietaryFatTotal | HKQuantityTypeIdentifier.dietaryFiber | HKQuantityTypeIdentifier.dietaryFolate | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIron | HKQuantityTypeIdentifier.dietaryMagnesium | HKQuantityTypeIdentifier.dietaryManganese | HKQuantityTypeIdentifier.dietaryMolybdenum | HKQuantityTypeIdentifier.dietaryNiacin | HKQuantityTypeIdentifier.dietaryPantothenicAcid | HKQuantityTypeIdentifier.dietaryPhosphorus | HKQuantityTypeIdentifier.dietaryPotassium | HKQuantityTypeIdentifier.dietaryProtein | HKQuantityTypeIdentifier.dietaryRiboflavin | HKQuantityTypeIdentifier.dietarySelenium | HKQuantityTypeIdentifier.dietarySodium | HKQuantityTypeIdentifier.dietarySugar | HKQuantityTypeIdentifier.dietaryThiamin | HKQuantityTypeIdentifier.dietaryVitaminA | HKQuantityTypeIdentifier.dietaryVitaminB6 | HKQuantityTypeIdentifier.dietaryVitaminB12 | HKQuantityTypeIdentifier.dietaryVitaminC | HKQuantityTypeIdentifier.dietaryVitaminD | HKQuantityTypeIdentifier.dietaryVitaminE | HKQuantityTypeIdentifier.dietaryVitaminK | HKQuantityTypeIdentifier.dietaryZinc ? MassUnit : T extends HKQuantityTypeIdentifier.dietaryWater ? VolumeUnit : T extends HKQuantityTypeIdentifier.insulinDelivery ? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}` : T extends HKQuantityTypeIdentifier.heartRate | HKQuantityTypeIdentifier.restingHeartRate | HKQuantityTypeIdentifier.walkingHeartRateAverage ? CountPerTime<TimeUnit> : HKUnit;
|
|
455
527
|
export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.cervicalMucusQuality ? HKCategoryValueCervicalMucusQuality : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKCategoryValueMenstrualFlow : T extends HKCategoryTypeIdentifier.ovulationTestResult ? HKCategoryValueOvulationTestResult : T extends HKCategoryTypeIdentifier.sleepAnalysis ? HKCategoryValueSleepAnalysis : T extends HKCategoryTypeIdentifier.highHeartRateEvent | HKCategoryTypeIdentifier.intermenstrualBleeding | HKCategoryTypeIdentifier.mindfulSession | HKCategoryTypeIdentifier.sexualActivity ? HKCategoryValueNotApplicable : T extends HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.acne | HKCategoryTypeIdentifier.bladderIncontinence | HKCategoryTypeIdentifier.bloating | HKCategoryTypeIdentifier.breastPain | HKCategoryTypeIdentifier.chestTightnessOrPain | HKCategoryTypeIdentifier.chills | HKCategoryTypeIdentifier.constipation | HKCategoryTypeIdentifier.coughing | HKCategoryTypeIdentifier.diarrhea | HKCategoryTypeIdentifier.dizziness | HKCategoryTypeIdentifier.drySkin | HKCategoryTypeIdentifier.fainting | HKCategoryTypeIdentifier.fatigue | HKCategoryTypeIdentifier.fever | HKCategoryTypeIdentifier.generalizedBodyAche | HKCategoryTypeIdentifier.hairLoss | HKCategoryTypeIdentifier.headache | HKCategoryTypeIdentifier.heartburn | HKCategoryTypeIdentifier.hotFlashes | HKCategoryTypeIdentifier.lossOfSmell | HKCategoryTypeIdentifier.lossOfTaste | HKCategoryTypeIdentifier.lowerBackPain | HKCategoryTypeIdentifier.memoryLapse | HKCategoryTypeIdentifier.moodChanges | HKCategoryTypeIdentifier.nausea | HKCategoryTypeIdentifier.nightSweats | HKCategoryTypeIdentifier.pelvicPain | HKCategoryTypeIdentifier.rapidPoundingOrFlutteringHeartbeat | HKCategoryTypeIdentifier.runnyNose | HKCategoryTypeIdentifier.shortnessOfBreath | HKCategoryTypeIdentifier.sinusCongestion | HKCategoryTypeIdentifier.skippedHeartbeat | HKCategoryTypeIdentifier.soreThroat | HKCategoryTypeIdentifier.vaginalDryness | HKCategoryTypeIdentifier.vomiting | HKCategoryTypeIdentifier.wheezing ? HKCategoryValueSeverity : T extends HKCategoryTypeIdentifier.appetiteChanges | HKCategoryTypeIdentifier.sleepChanges ? HKCategoryValuePresence : T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent ? HKCategoryValueLowCardioFitnessEvent : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.appleStandHour ? HKCategoryValueAppleStandHour : number;
|
|
528
|
+
/**
|
|
529
|
+
* See https://developer.apple.com/documentation/healthkit/hkcategoryvaluepregnancytestresult
|
|
530
|
+
*/
|
|
456
531
|
declare enum HKCategoryValuePregnancyTestResult {
|
|
457
532
|
positive = 2,
|
|
458
533
|
negative = 1,
|
|
@@ -638,6 +713,9 @@ export declare enum BloodGlucoseUnit {
|
|
|
638
713
|
export type SpeedUnit<TLength extends LengthUnit, TTime extends TimeUnit> = `${TLength}/${TTime}`;
|
|
639
714
|
export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`;
|
|
640
715
|
export type HKUnit = BloodGlucoseUnit | CountPerTime<TimeUnit> | EnergyUnit | FrequencyUnit | HKUnits | LengthUnit | MassUnit | PressureUnit | SpeedUnit<LengthUnit, TimeUnit> | TemperatureUnit | TimeUnit | VolumeUnit | `${BloodGlucoseUnit}` | `${EnergyUnit}` | `${FrequencyUnit}` | `${HKUnits}` | `${LengthUnit}` | `${MassUnit}` | `${PressureUnit}` | `${TemperatureUnit}` | `${TimeUnit}` | `${VolumeUnit}`;
|
|
716
|
+
/**
|
|
717
|
+
* See https://developer.apple.com/documentation/healthkit/hkdevice
|
|
718
|
+
*/
|
|
641
719
|
export type HKDevice = {
|
|
642
720
|
readonly name: string;
|
|
643
721
|
readonly firmwareVersion: string | null;
|
|
@@ -648,16 +726,25 @@ export type HKDevice = {
|
|
|
648
726
|
readonly softwareVersion: string;
|
|
649
727
|
readonly udiDeviceIdentifier: string | null;
|
|
650
728
|
};
|
|
729
|
+
/**
|
|
730
|
+
* See https://developer.apple.com/documentation/healthkit/hkobject/1615781-source
|
|
731
|
+
*/
|
|
651
732
|
export type HKSource = {
|
|
652
733
|
readonly name: string;
|
|
653
734
|
readonly bundleIdentifier: string;
|
|
654
735
|
};
|
|
736
|
+
/**
|
|
737
|
+
* See https://developer.apple.com/documentation/healthkit/hkobject/1615483-sourcerevision
|
|
738
|
+
*/
|
|
655
739
|
export type HKSourceRevision = {
|
|
656
740
|
readonly source: HKSource;
|
|
657
741
|
readonly version: string;
|
|
658
742
|
readonly operatingSystemVersion?: string;
|
|
659
743
|
readonly productType?: string;
|
|
660
744
|
};
|
|
745
|
+
/**
|
|
746
|
+
* See https://developer.apple.com/documentation/healthkit/hkquantitysample
|
|
747
|
+
*/
|
|
661
748
|
export type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = {
|
|
662
749
|
readonly uuid: string;
|
|
663
750
|
readonly device?: HKDevice;
|
|
@@ -757,6 +844,7 @@ export type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> =
|
|
|
757
844
|
readonly endDate: string;
|
|
758
845
|
};
|
|
759
846
|
type QueryId = string;
|
|
847
|
+
/** See https://developer.apple.com/documentation/healthkit/hkupdatefrequency */
|
|
760
848
|
export declare enum HKUpdateFrequency {
|
|
761
849
|
immediate = 1,
|
|
762
850
|
hourly = 2,
|
|
@@ -780,6 +868,7 @@ export type WorkoutRoute = {
|
|
|
780
868
|
readonly HKMetadataKeySyncVersion?: number;
|
|
781
869
|
};
|
|
782
870
|
type ReactNativeHealthkitTypeNative = {
|
|
871
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable */
|
|
783
872
|
isHealthDataAvailable(): Promise<boolean>;
|
|
784
873
|
canAccessProtectedData(): Promise<boolean>;
|
|
785
874
|
getBloodType(): Promise<HKBloodType>;
|
|
@@ -787,16 +876,22 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
787
876
|
getBiologicalSex(): Promise<HKBiologicalSex>;
|
|
788
877
|
getFitzpatrickSkinType(): Promise<HKFitzpatrickSkinType>;
|
|
789
878
|
readonly getWheelchairUse: () => Promise<HKWheelchairUse>;
|
|
879
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery */
|
|
790
880
|
readonly enableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier, updateFrequency: HKUpdateFrequency) => Promise<boolean>;
|
|
881
|
+
/** https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery */
|
|
791
882
|
readonly disableBackgroundDelivery: (typeIdentifier: HKSampleTypeIdentifier) => Promise<boolean>;
|
|
883
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery */
|
|
792
884
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
793
885
|
readonly saveCorrelationSample: <TIdentifier extends HKCorrelationTypeIdentifier, TSamples extends readonly (HKCategorySampleRawForSaving | HKQuantitySampleRawForSaving)[]>(typeIdentifier: TIdentifier, samples: TSamples, start: string, end: string, metadata: MetadataMapperForCorrelationIdentifier<TIdentifier>) => Promise<boolean>;
|
|
794
886
|
readonly saveWorkoutSample: (typeIdentifier: HKWorkoutActivityType, quantities: readonly HKQuantitySampleRawForSaving[], start: string, end: string, metadata: HKWorkoutMetadata) => Promise<boolean>;
|
|
795
887
|
readonly queryCorrelationSamples: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, from: string, to: string) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
|
|
796
888
|
subscribeToObserverQuery(identifier: HKSampleTypeIdentifier): Promise<QueryId>;
|
|
797
889
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
890
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus */
|
|
798
891
|
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<HKAuthorizationStatus>;
|
|
892
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/2994346-getrequeststatusforauthorization */
|
|
799
893
|
getRequestStatusForAuthorization(write: WritePermissions, read: ReadPermissions): Promise<HKAuthorizationRequestStatus>;
|
|
894
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization */
|
|
800
895
|
requestAuthorization(write: WritePermissions, read: ReadPermissions): Promise<boolean>;
|
|
801
896
|
readonly saveQuantitySample: <TType extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TType> = UnitForIdentifier<TType>>(identifier: TType, unit: TUnit, value: number, start: string, end: string, metadata: unknown) => Promise<boolean>;
|
|
802
897
|
readonly deleteQuantitySample: <TIdentifier extends HKQuantityTypeIdentifier>(typeIdentifier: TIdentifier, uuid: string) => Promise<boolean>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
-
declare function getMostRecentCategorySample<T extends HKCategoryTypeIdentifier>(identifier: T): Promise<import("
|
|
2
|
+
declare function getMostRecentCategorySample<T extends HKCategoryTypeIdentifier>(identifier: T): Promise<import("..").HKCategorySample<T> | null>;
|
|
3
3
|
export default getMostRecentCategorySample;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
-
declare function getMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit): Promise<import("
|
|
2
|
+
declare function getMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit): Promise<import("..").HKQuantitySample<TIdentifier, UnitForIdentifier<TIdentifier>> | null>;
|
|
3
3
|
export default getMostRecentQuantitySample;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HKCategoryTypeIdentifier
|
|
2
|
-
import type { GenericQueryOptions } from '../types';
|
|
3
|
-
export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(identifier: T, options: Omit<GenericQueryOptions, 'anchor'>) => Promise<readonly
|
|
1
|
+
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
+
import type { GenericQueryOptions, HKCategorySample } from '../types';
|
|
3
|
+
export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(identifier: T, options: Omit<GenericQueryOptions, 'anchor'>) => Promise<readonly HKCategorySample<T>[]>;
|
|
4
4
|
declare const queryCategorySamples: QueryCategorySamplesFn;
|
|
5
5
|
export default queryCategorySamples;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HKQuantityTypeIdentifier, UnitForIdentifier
|
|
2
|
-
import type { GenericQueryOptions } from '../types';
|
|
1
|
+
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
+
import type { GenericQueryOptions, HKQuantitySample } from '../types';
|
|
3
3
|
export type QueryQuantitySamplesFn = <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, options: Omit<GenericQueryOptions, 'anchor'> & {
|
|
4
4
|
readonly unit?: TUnit;
|
|
5
|
-
}) => Promise<readonly
|
|
5
|
+
}) => Promise<readonly HKQuantitySample<TIdentifier>[]>;
|
|
6
6
|
declare const queryQuantitySamples: QueryQuantitySamplesFn;
|
|
7
7
|
export default queryQuantitySamples;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { HealthkitReadAuthorization, HealthkitWriteAuthorization } from '../native-types';
|
|
2
|
+
/** See https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization */
|
|
2
3
|
declare const requestAuthorization: (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => Promise<boolean>;
|
|
3
4
|
export default requestAuthorization;
|
package/package.json
CHANGED
|
@@ -3,12 +3,13 @@ import { useCallback, useState } from 'react'
|
|
|
3
3
|
import useSubscribeToChanges from './useSubscribeToChanges'
|
|
4
4
|
import getMostRecentCategorySample from '../utils/getMostRecentCategorySample'
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { HKCategoryTypeIdentifier } from '../native-types'
|
|
7
|
+
import type { HKCategorySample } from '../types'
|
|
7
8
|
|
|
8
9
|
function useMostRecentCategorySample<
|
|
9
10
|
TCategory extends HKCategoryTypeIdentifier
|
|
10
11
|
>(identifier: TCategory) {
|
|
11
|
-
const [category, setCategory] = useState<
|
|
12
|
+
const [category, setCategory] = useState<HKCategorySample<TCategory> | null>(
|
|
12
13
|
null,
|
|
13
14
|
)
|
|
14
15
|
const updater = useCallback(() => {
|
|
@@ -4,13 +4,14 @@ import ensureUnit from '../utils/ensureUnit'
|
|
|
4
4
|
import getMostRecentQuantitySample from '../utils/getMostRecentQuantitySample'
|
|
5
5
|
import subscribeToChanges from '../utils/subscribeToChanges'
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'
|
|
8
|
+
import type { HKQuantitySample } from '../types'
|
|
8
9
|
|
|
9
10
|
function useMostRecentQuantitySample<
|
|
10
11
|
TIdentifier extends HKQuantityTypeIdentifier,
|
|
11
12
|
TUnit extends UnitForIdentifier<TIdentifier>
|
|
12
13
|
>(identifier: TIdentifier, unit?: TUnit) {
|
|
13
|
-
const [lastSample, setLastSample] = useState<
|
|
14
|
+
const [lastSample, setLastSample] = useState<HKQuantitySample<
|
|
14
15
|
TIdentifier
|
|
15
16
|
> | null>(null)
|
|
16
17
|
|