@kingstinct/react-native-healthkit 7.3.0 → 7.3.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/ios/ReactNativeHealthkit.swift +34 -31
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +5 -0
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +3 -0
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +3 -0
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/commonjs/hooks/useMostRecentWorkout.js +3 -0
- package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/commonjs/index.ios.js +284 -3
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +7 -87
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +251 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/index.web.js +24 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/utils/saveCategorySample.js +4 -0
- package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.js +5 -0
- package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/module/hooks/useMostRecentCategorySample.js +3 -0
- package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js +3 -0
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
- package/lib/module/hooks/useMostRecentWorkout.js +3 -0
- package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
- package/lib/module/index.ios.js +7 -1
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +2 -83
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +136 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/index.web.js +4 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/utils/saveCategorySample.js +4 -0
- package/lib/module/utils/saveCategorySample.js.map +1 -1
- package/lib/typescript/src/hooks/useHealthkitAuthorization.d.ts +5 -0
- package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +3 -0
- package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +3 -0
- package/lib/typescript/src/hooks/useMostRecentWorkout.d.ts +3 -0
- package/lib/typescript/src/index.d.ts +3 -53
- package/lib/typescript/src/index.ios.d.ts +37 -0
- package/lib/typescript/src/index.native.d.ts +29 -0
- package/lib/typescript/src/index.web.d.ts +3 -0
- package/lib/typescript/src/utils/saveCategorySample.d.ts +4 -0
- package/package.json +1 -1
- package/src/hooks/useHealthkitAuthorization.ts +5 -0
- package/src/hooks/useMostRecentCategorySample.ts +3 -0
- package/src/hooks/useMostRecentQuantitySample.ts +3 -0
- package/src/hooks/useMostRecentWorkout.ts +3 -0
- package/src/index.ios.tsx +57 -0
- package/src/index.native.tsx +201 -0
- package/src/index.tsx +3 -97
- package/src/index.web.tsx +5 -0
- package/src/utils/saveCategorySample.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","useHealthkitAuthorization","useIsHealthDataAvailable","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","Native","HKQuantityTypeIdentifier","deleteQuantitySample","deleteSamples","getDateOfBirth","getMostRecentCategorySample","getMostRecentQuantitySample","getMostRecentWorkout","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","getWorkoutPlanById","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","querySources","queryStatisticsForQuantity","queryWorkouts","requestAuthorization","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutRoute","saveWorkoutSample","subscribeToChanges","currentMajorVersionIOS","OS","parseInt","Version","allQuantityTypesList","Object","values","availableQuantityTypes","majorVersionIOS","arguments","length","undefined","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","bind","isHealthDataAvailable","canAccessProtectedData","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","isProtectedDataAvailable"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkouts from './utils/queryWorkouts'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\n// Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)\nconst canAccessProtectedData = Native.canAccessProtectedData.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable: canAccessProtectedData,\n\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @deprecated Use {@link isProtectedDataAvailable} instead. Will be removed in next major version.\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n canAccessProtectedData,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n}\n\nexport * from './types'\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAOC,yBAAyB,MAAM,mCAAmC;AACzE,OAAOC,wBAAwB,MAAM,kCAAkC;AACvE,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,oBAAoB,MAAM,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ClBE,iBAAiB;EACjBD,gBAAgB;EAEhB;EACAE,kBAAkB;EAElB;AACF;AACA;EACEhC,2BAA2B;EAC3B;AACF;AACA;EACEC,2BAA2B;EAC3B;AACF;AACA;EACEC,oBAAoB;EACpBC,qBAAqB;EACrB;AACF;AACA;AACA;AACA;EACEJ,wBAAwB;EACxB;AACF;AACA;AACA;AACA;EACED;AACF,CAAC;AAED,cAAc,SAAS"}
|
|
1
|
+
{"version":3,"names":["Platform","useHealthkitAuthorization","useIsHealthDataAvailable","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSources","useStatisticsForQuantity","useSubscribeToChanges","Native","HKQuantityTypeIdentifier","deleteQuantitySample","deleteSamples","getDateOfBirth","getMostRecentCategorySample","getMostRecentQuantitySample","getMostRecentWorkout","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","getWorkoutPlanById","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","querySources","queryStatisticsForQuantity","queryWorkouts","requestAuthorization","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutRoute","saveWorkoutSample","subscribeToChanges","currentMajorVersionIOS","OS","parseInt","Version","allQuantityTypesList","Object","values","availableQuantityTypes","majorVersionIOS","arguments","length","undefined","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","bind","isHealthDataAvailable","canAccessProtectedData","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","isProtectedDataAvailable"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSources from './hooks/useSources'\nimport useStatisticsForQuantity from './hooks/useStatisticsForQuantity'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkouts from './utils/queryWorkouts'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\n// Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)\nconst canAccessProtectedData = Native.canAccessProtectedData.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable: canAccessProtectedData,\n\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @deprecated Use {@link isProtectedDataAvailable} instead. Will be removed in next major version.\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n canAccessProtectedData,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n useSources,\n useStatisticsForQuantity,\n}\n\nconst isProtectedDataAvailable = canAccessProtectedData\n\nexport {\n authorizationStatusFor,\n availableQuantityTypes,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n useSources,\n useStatisticsForQuantity,\n canAccessProtectedData,\n isProtectedDataAvailable,\n}\n\nexport * from './types'\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAOC,yBAAyB,MAAM,mCAAmC;AACzE,OAAOC,wBAAwB,MAAM,kCAAkC;AACvE,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,wBAAwB,MAAM,kCAAkC;AACvE,OAAOC,qBAAqB,MAAM,+BAA+B;AACjE,OAAOC,MAAM,IAAIC,wBAAwB,QAAQ,gBAAgB;AACjE,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,cAAc,MAAM,wBAAwB;AACnD,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,gBAAgB,MAAM,0BAA0B;AACvD,OAAOC,iBAAiB,MAAM,2BAA2B;AACzD,OAAOC,gCAAgC,MAAM,0CAA0C;AACvF,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,8BAA8B,MAAM,wCAAwC;AACnF,OAAOC,uBAAuB,MAAM,iCAAiC;AACrE,OAAOC,2BAA2B,MAAM,qCAAqC;AAC7E,OAAOC,qCAAqC,MAAM,+CAA+C;AACjG,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,8BAA8B,MAAM,wCAAwC;AACnF,OAAOC,YAAY,MAAM,sBAAsB;A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,EACZG,oBAAoB,EACpBpB,oBAAoB,EACpBC,aAAa,EACbQ,kBAAkB,EAClBY,kBAAkB,EAClBC,qBAAqB,EACrBC,kBAAkB,EAClBE,iBAAiB,EACjBD,gBAAgB,EAChBE,kBAAkB,EAClBlC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,oBAAoB,EACpBG,qBAAqB,EACrBP,yBAAyB,EACzBC,wBAAwB,EACxBI,UAAU,EACVC,wBAAwB,EACxBuD,sBAAsB,EACtBS,wBAAwB;AAG1B,cAAc,SAAS"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,85 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const notAvailableError = `[@kingstinct/react-native-healthkit] Platform "${Platform.OS}" not supported`;
|
|
4
|
-
let hasWarned = false;
|
|
5
|
-
function UnavailableFn(retVal) {
|
|
6
|
-
return () => {
|
|
7
|
-
if (!hasWarned) {
|
|
8
|
-
// eslint-disable-next-line no-console
|
|
9
|
-
console.warn(notAvailableError);
|
|
10
|
-
hasWarned = true;
|
|
11
|
-
}
|
|
12
|
-
return retVal;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const Healthkit = {
|
|
16
|
-
authorizationStatusFor: UnavailableFn(Promise.resolve(HKAuthorizationStatus.notDetermined)),
|
|
17
|
-
availableQuantityTypes: UnavailableFn([]),
|
|
18
|
-
disableAllBackgroundDelivery: UnavailableFn(Promise.resolve(false)),
|
|
19
|
-
disableBackgroundDelivery: UnavailableFn(Promise.resolve(false)),
|
|
20
|
-
enableBackgroundDelivery: UnavailableFn(Promise.resolve(false)),
|
|
21
|
-
getBiologicalSex: UnavailableFn(Promise.resolve(HKBiologicalSex.notSet)),
|
|
22
|
-
getBloodType: UnavailableFn(Promise.resolve(HKBloodType.notSet)),
|
|
23
|
-
getDateOfBirth: UnavailableFn(Promise.resolve(new Date(0))),
|
|
24
|
-
getFitzpatrickSkinType: UnavailableFn(Promise.resolve(HKFitzpatrickSkinType.notSet)),
|
|
25
|
-
getMostRecentCategorySample: UnavailableFn(Promise.resolve(null)),
|
|
26
|
-
getMostRecentQuantitySample: UnavailableFn(Promise.resolve(null)),
|
|
27
|
-
getMostRecentWorkout: UnavailableFn(Promise.resolve(null)),
|
|
28
|
-
getPreferredUnit: UnavailableFn(Promise.resolve(HKUnits.Count)),
|
|
29
|
-
getPreferredUnits: UnavailableFn(Promise.resolve([])),
|
|
30
|
-
getRequestStatusForAuthorization: UnavailableFn(Promise.resolve(HKAuthorizationRequestStatus.unknown)),
|
|
31
|
-
getWheelchairUse: UnavailableFn(Promise.resolve(HKWheelchairUse.notSet)),
|
|
32
|
-
getWorkoutRoutes: UnavailableFn(Promise.resolve([])),
|
|
33
|
-
isHealthDataAvailable: async () => Promise.resolve(false),
|
|
34
|
-
queryCategorySamples: UnavailableFn(Promise.resolve([])),
|
|
35
|
-
queryCategorySamplesWithAnchor: UnavailableFn(Promise.resolve({
|
|
36
|
-
samples: [],
|
|
37
|
-
deletedSamples: [],
|
|
38
|
-
newAnchor: ''
|
|
39
|
-
})),
|
|
40
|
-
queryCorrelationSamples: UnavailableFn(Promise.resolve([])),
|
|
41
|
-
queryHeartbeatSeriesSamples: UnavailableFn(Promise.resolve([])),
|
|
42
|
-
queryHeartbeatSeriesSamplesWithAnchor: UnavailableFn(Promise.resolve({
|
|
43
|
-
samples: [],
|
|
44
|
-
deletedSamples: [],
|
|
45
|
-
newAnchor: ''
|
|
46
|
-
})),
|
|
47
|
-
queryQuantitySamples: UnavailableFn(Promise.resolve([])),
|
|
48
|
-
queryQuantitySamplesWithAnchor: UnavailableFn(Promise.resolve({
|
|
49
|
-
samples: [],
|
|
50
|
-
deletedSamples: [],
|
|
51
|
-
newAnchor: ''
|
|
52
|
-
})),
|
|
53
|
-
queryStatisticsForQuantity: UnavailableFn(Promise.resolve({
|
|
54
|
-
averageQuantity: undefined,
|
|
55
|
-
maximumQuantity: undefined,
|
|
56
|
-
minimumQuantity: undefined,
|
|
57
|
-
sumQuantity: undefined,
|
|
58
|
-
mostRecentQuantity: undefined,
|
|
59
|
-
mostRecentQuantityDateInterval: undefined,
|
|
60
|
-
duration: undefined
|
|
61
|
-
})),
|
|
62
|
-
queryWorkouts: UnavailableFn(Promise.resolve([])),
|
|
63
|
-
querySources: UnavailableFn(Promise.resolve([])),
|
|
64
|
-
requestAuthorization: UnavailableFn(Promise.resolve(false)),
|
|
65
|
-
deleteQuantitySample: UnavailableFn(Promise.resolve(false)),
|
|
66
|
-
deleteSamples: UnavailableFn(Promise.resolve(false)),
|
|
67
|
-
getWorkoutPlanById: UnavailableFn(Promise.resolve(null)),
|
|
68
|
-
saveCategorySample: UnavailableFn(Promise.resolve(false)),
|
|
69
|
-
saveCorrelationSample: UnavailableFn(Promise.resolve(false)),
|
|
70
|
-
saveQuantitySample: UnavailableFn(Promise.resolve(false)),
|
|
71
|
-
saveWorkoutSample: UnavailableFn(Promise.resolve(null)),
|
|
72
|
-
saveWorkoutRoute: UnavailableFn(Promise.resolve(false)),
|
|
73
|
-
subscribeToChanges: UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),
|
|
74
|
-
useMostRecentCategorySample: UnavailableFn(null),
|
|
75
|
-
useMostRecentQuantitySample: UnavailableFn(null),
|
|
76
|
-
useMostRecentWorkout: UnavailableFn(null),
|
|
77
|
-
useSubscribeToChanges: UnavailableFn([null, () => null]),
|
|
78
|
-
useHealthkitAuthorization: UnavailableFn([null, async () => Promise.resolve(HKAuthorizationRequestStatus.unknown)]),
|
|
79
|
-
useIsHealthDataAvailable: () => false,
|
|
80
|
-
canAccessProtectedData: async () => Promise.resolve(false),
|
|
81
|
-
isProtectedDataAvailable: async () => Promise.resolve(false)
|
|
82
|
-
};
|
|
83
|
-
export * from './types';
|
|
1
|
+
import Healthkit from './index.ios';
|
|
2
|
+
export * from './index.ios';
|
|
84
3
|
export default Healthkit;
|
|
85
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","HKAuthorizationRequestStatus","HKAuthorizationStatus","HKBiologicalSex","HKBloodType","HKFitzpatrickSkinType","HKUnits","HKWheelchairUse","notAvailableError","OS","hasWarned","UnavailableFn","retVal","console","warn","Healthkit","authorizationStatusFor","Promise","resolve","notDetermined","availableQuantityTypes","disableAllBackgroundDelivery","disableBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","notSet","getBloodType","getDateOfBirth","Date","getFitzpatrickSkinType","getMostRecentCategorySample","getMostRecentQuantitySample","getMostRecentWorkout","getPreferredUnit","Count","getPreferredUnits","getRequestStatusForAuthorization","unknown","getWheelchairUse","getWorkoutRoutes","isHealthDataAvailable","queryCategorySamples","queryCategorySamplesWithAnchor","samples","deletedSamples","newAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","averageQuantity","undefined","maximumQuantity","minimumQuantity","sumQuantity","mostRecentQuantity","mostRecentQuantityDateInterval","duration","queryWorkouts","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","getWorkoutPlanById","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useHealthkitAuthorization","useIsHealthDataAvailable","canAccessProtectedData","isProtectedDataAvailable"],"sources":["index.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport {\n HKAuthorizationRequestStatus, HKAuthorizationStatus, HKBiologicalSex, HKBloodType, HKFitzpatrickSkinType, HKUnits, HKWheelchairUse,\n} from './native-types'\n\nimport type ReactNativeHealthkit from './index.ios'\nimport type { QueryCategorySamplesFn } from './utils/queryCategorySamples'\nimport type { QueryQuantitySamplesFn } from './utils/queryQuantitySamples'\n\nconst notAvailableError = `[@kingstinct/react-native-healthkit] Platform \"${\n Platform.OS\n}\" not supported`\n\nlet hasWarned = false\n\nfunction UnavailableFn<T = unknown>(retVal: T) {\n return () => {\n if (!hasWarned) {\n // eslint-disable-next-line no-console\n console.warn(notAvailableError)\n hasWarned = true\n }\n return retVal\n }\n}\n\nconst Healthkit = {\n authorizationStatusFor: UnavailableFn(Promise.resolve(HKAuthorizationStatus.notDetermined)),\n availableQuantityTypes: UnavailableFn([]),\n disableAllBackgroundDelivery: UnavailableFn(Promise.resolve(false)),\n disableBackgroundDelivery: UnavailableFn(Promise.resolve(false)),\n enableBackgroundDelivery: UnavailableFn(Promise.resolve(false)),\n getBiologicalSex: UnavailableFn(Promise.resolve(HKBiologicalSex.notSet)),\n getBloodType: UnavailableFn(Promise.resolve(HKBloodType.notSet)),\n getDateOfBirth: UnavailableFn(Promise.resolve(new Date(0))),\n getFitzpatrickSkinType: UnavailableFn(Promise.resolve(HKFitzpatrickSkinType.notSet)),\n getMostRecentCategorySample: UnavailableFn(Promise.resolve(null)),\n getMostRecentQuantitySample: UnavailableFn(Promise.resolve(null)),\n getMostRecentWorkout: UnavailableFn(Promise.resolve(null)),\n getPreferredUnit: UnavailableFn(Promise.resolve(HKUnits.Count)),\n getPreferredUnits: UnavailableFn(Promise.resolve([])),\n getRequestStatusForAuthorization: UnavailableFn(Promise.resolve(HKAuthorizationRequestStatus.unknown)),\n getWheelchairUse: UnavailableFn(Promise.resolve(HKWheelchairUse.notSet)),\n getWorkoutRoutes: UnavailableFn(Promise.resolve([])),\n isHealthDataAvailable: async () => Promise.resolve(false),\n queryCategorySamples: UnavailableFn(Promise.resolve([])) as unknown as QueryCategorySamplesFn,\n queryCategorySamplesWithAnchor: UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryCorrelationSamples: UnavailableFn(Promise.resolve([])),\n queryHeartbeatSeriesSamples: UnavailableFn(Promise.resolve([])),\n queryHeartbeatSeriesSamplesWithAnchor: UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryQuantitySamples: UnavailableFn(Promise.resolve([])) as unknown as QueryQuantitySamplesFn,\n queryQuantitySamplesWithAnchor: UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryStatisticsForQuantity: UnavailableFn(Promise.resolve({\n averageQuantity: undefined,\n maximumQuantity: undefined,\n minimumQuantity: undefined,\n sumQuantity: undefined,\n mostRecentQuantity: undefined,\n mostRecentQuantityDateInterval: undefined,\n duration: undefined,\n })),\n queryWorkouts: UnavailableFn(Promise.resolve([])),\n querySources: UnavailableFn(Promise.resolve([])),\n requestAuthorization: UnavailableFn(Promise.resolve(false)),\n deleteQuantitySample: UnavailableFn(Promise.resolve(false)),\n deleteSamples: UnavailableFn(Promise.resolve(false)),\n getWorkoutPlanById: UnavailableFn(Promise.resolve(null)),\n saveCategorySample: UnavailableFn(Promise.resolve(false)),\n saveCorrelationSample: UnavailableFn(Promise.resolve(false)),\n saveQuantitySample: UnavailableFn(Promise.resolve(false)),\n saveWorkoutSample: UnavailableFn(Promise.resolve(null)),\n saveWorkoutRoute: UnavailableFn(Promise.resolve(false)),\n subscribeToChanges: UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),\n useMostRecentCategorySample: UnavailableFn(null),\n useMostRecentQuantitySample: UnavailableFn(null),\n useMostRecentWorkout: UnavailableFn(null),\n useSubscribeToChanges: UnavailableFn([null, () => null]),\n useHealthkitAuthorization: UnavailableFn([null, async () => Promise.resolve(HKAuthorizationRequestStatus.unknown)] as const),\n useIsHealthDataAvailable: () => false,\n canAccessProtectedData: async () => Promise.resolve(false),\n isProtectedDataAvailable: async () => Promise.resolve(false),\n} as typeof ReactNativeHealthkit\n\nexport * from './types'\n\nexport default Healthkit as typeof ReactNativeHealthkit\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SACEC,4BAA4B,EAAEC,qBAAqB,EAAEC,eAAe,EAAEC,WAAW,EAAEC,qBAAqB,EAAEC,OAAO,EAAEC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BAAgB,EAAE3D,aAAa,CAACM,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAC;EACvDqD,kBAAkB,EAAE5D,aAAa,CAACM,OAAO,CAACC,OAAO,CAAC,YAAYD,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;EACtFsD,2BAA2B,EAAE7D,aAAa,CAAC,IAAI,CAAC;EAChD8D,2BAA2B,EAAE9D,aAAa,CAAC,IAAI,CAAC;EAChD+D,oBAAoB,EAAE/D,aAAa,CAAC,IAAI,CAAC;EACzCgE,qBAAqB,EAAEhE,aAAa,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC;EACxDiE,yBAAyB,EAAEjE,aAAa,CAAC,CAAC,IAAI,EAAE,YAAYM,OAAO,CAACC,OAAO,CAACjB,4BAA4B,CAACoC,OAAO,CAAC,CAAU,CAAC;EAC5HwC,wBAAwB,EAAEA,CAAA,KAAM,KAAK;EACrCC,sBAAsB,EAAE,MAAAA,CAAA,KAAY7D,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;EAC1D6D,wBAAwB,EAAE,MAAAA,CAAA,KAAY9D,OAAO,CAACC,OAAO,CAAC,KAAK;AAC7D,CAAgC;AAEhC,cAAc,SAAS;AAEvB,eAAeH,SAAS"}
|
|
1
|
+
{"version":3,"names":["Healthkit"],"sources":["index.tsx"],"sourcesContent":["import Healthkit from './index.ios'\n\nexport * from './index.ios'\n\nexport default Healthkit\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,cAAc,aAAa;AAE3B,eAAeA,SAAS"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { HKAuthorizationRequestStatus, HKAuthorizationStatus, HKBiologicalSex, HKBloodType, HKFitzpatrickSkinType, HKUnits, HKWheelchairUse } from './native-types';
|
|
3
|
+
const notAvailableError = `[@kingstinct/react-native-healthkit] Platform "${Platform.OS}" not supported`;
|
|
4
|
+
let hasWarned = false;
|
|
5
|
+
function UnavailableFn(retVal) {
|
|
6
|
+
return () => {
|
|
7
|
+
if (!hasWarned) {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.warn(notAvailableError);
|
|
10
|
+
hasWarned = true;
|
|
11
|
+
}
|
|
12
|
+
return retVal;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const authorizationStatusFor = UnavailableFn(Promise.resolve(HKAuthorizationStatus.notDetermined)),
|
|
16
|
+
availableQuantityTypes = UnavailableFn([]),
|
|
17
|
+
disableAllBackgroundDelivery = UnavailableFn(Promise.resolve(false)),
|
|
18
|
+
disableBackgroundDelivery = UnavailableFn(Promise.resolve(false)),
|
|
19
|
+
enableBackgroundDelivery = UnavailableFn(Promise.resolve(false)),
|
|
20
|
+
getBiologicalSex = UnavailableFn(Promise.resolve(HKBiologicalSex.notSet)),
|
|
21
|
+
getBloodType = UnavailableFn(Promise.resolve(HKBloodType.notSet)),
|
|
22
|
+
getDateOfBirth = UnavailableFn(Promise.resolve(new Date(0))),
|
|
23
|
+
getFitzpatrickSkinType = UnavailableFn(Promise.resolve(HKFitzpatrickSkinType.notSet)),
|
|
24
|
+
getMostRecentCategorySample = UnavailableFn(Promise.resolve(null)),
|
|
25
|
+
getMostRecentQuantitySample = UnavailableFn(Promise.resolve(null)),
|
|
26
|
+
getMostRecentWorkout = UnavailableFn(Promise.resolve(null)),
|
|
27
|
+
getPreferredUnit = UnavailableFn(Promise.resolve(HKUnits.Count)),
|
|
28
|
+
getPreferredUnits = UnavailableFn(Promise.resolve([])),
|
|
29
|
+
getRequestStatusForAuthorization = UnavailableFn(Promise.resolve(HKAuthorizationRequestStatus.unknown)),
|
|
30
|
+
getWheelchairUse = UnavailableFn(Promise.resolve(HKWheelchairUse.notSet)),
|
|
31
|
+
getWorkoutRoutes = UnavailableFn(Promise.resolve([])),
|
|
32
|
+
isHealthDataAvailable = async () => Promise.resolve(false),
|
|
33
|
+
useSources = UnavailableFn(null),
|
|
34
|
+
useStatisticsForQuantity = UnavailableFn(null),
|
|
35
|
+
queryCategorySamples = UnavailableFn(Promise.resolve([])),
|
|
36
|
+
queryCategorySamplesWithAnchor = UnavailableFn(Promise.resolve({
|
|
37
|
+
samples: [],
|
|
38
|
+
deletedSamples: [],
|
|
39
|
+
newAnchor: ''
|
|
40
|
+
})),
|
|
41
|
+
queryCorrelationSamples = UnavailableFn(Promise.resolve([])),
|
|
42
|
+
queryHeartbeatSeriesSamples = UnavailableFn(Promise.resolve([])),
|
|
43
|
+
queryHeartbeatSeriesSamplesWithAnchor = UnavailableFn(Promise.resolve({
|
|
44
|
+
samples: [],
|
|
45
|
+
deletedSamples: [],
|
|
46
|
+
newAnchor: ''
|
|
47
|
+
})),
|
|
48
|
+
queryQuantitySamples = UnavailableFn(Promise.resolve([])),
|
|
49
|
+
queryQuantitySamplesWithAnchor = UnavailableFn(Promise.resolve({
|
|
50
|
+
samples: [],
|
|
51
|
+
deletedSamples: [],
|
|
52
|
+
newAnchor: ''
|
|
53
|
+
})),
|
|
54
|
+
queryStatisticsForQuantity = UnavailableFn(Promise.resolve({
|
|
55
|
+
averageQuantity: undefined,
|
|
56
|
+
maximumQuantity: undefined,
|
|
57
|
+
minimumQuantity: undefined,
|
|
58
|
+
sumQuantity: undefined,
|
|
59
|
+
mostRecentQuantity: undefined,
|
|
60
|
+
mostRecentQuantityDateInterval: undefined,
|
|
61
|
+
duration: undefined
|
|
62
|
+
})),
|
|
63
|
+
queryWorkouts = UnavailableFn(Promise.resolve([])),
|
|
64
|
+
querySources = UnavailableFn(Promise.resolve([])),
|
|
65
|
+
requestAuthorization = UnavailableFn(Promise.resolve(false)),
|
|
66
|
+
deleteQuantitySample = UnavailableFn(Promise.resolve(false)),
|
|
67
|
+
deleteSamples = UnavailableFn(Promise.resolve(false)),
|
|
68
|
+
getWorkoutPlanById = UnavailableFn(Promise.resolve(null)),
|
|
69
|
+
saveCategorySample = UnavailableFn(Promise.resolve(false)),
|
|
70
|
+
saveCorrelationSample = UnavailableFn(Promise.resolve(false)),
|
|
71
|
+
saveQuantitySample = UnavailableFn(Promise.resolve(false)),
|
|
72
|
+
saveWorkoutSample = UnavailableFn(Promise.resolve(null)),
|
|
73
|
+
saveWorkoutRoute = UnavailableFn(Promise.resolve(false)),
|
|
74
|
+
subscribeToChanges = UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),
|
|
75
|
+
useMostRecentCategorySample = UnavailableFn(null),
|
|
76
|
+
useMostRecentQuantitySample = UnavailableFn(null),
|
|
77
|
+
useMostRecentWorkout = UnavailableFn(null),
|
|
78
|
+
useSubscribeToChanges = UnavailableFn([null, () => null]),
|
|
79
|
+
useHealthkitAuthorization = UnavailableFn([null, async () => Promise.resolve(HKAuthorizationRequestStatus.unknown)]),
|
|
80
|
+
useIsHealthDataAvailable = () => false,
|
|
81
|
+
canAccessProtectedData = async () => Promise.resolve(false),
|
|
82
|
+
isProtectedDataAvailable = async () => Promise.resolve(false);
|
|
83
|
+
const Healthkit = {
|
|
84
|
+
authorizationStatusFor,
|
|
85
|
+
availableQuantityTypes,
|
|
86
|
+
useSources,
|
|
87
|
+
useStatisticsForQuantity,
|
|
88
|
+
disableAllBackgroundDelivery,
|
|
89
|
+
disableBackgroundDelivery,
|
|
90
|
+
enableBackgroundDelivery,
|
|
91
|
+
getBiologicalSex,
|
|
92
|
+
getBloodType,
|
|
93
|
+
getDateOfBirth,
|
|
94
|
+
getFitzpatrickSkinType,
|
|
95
|
+
getMostRecentCategorySample,
|
|
96
|
+
getMostRecentQuantitySample,
|
|
97
|
+
getMostRecentWorkout,
|
|
98
|
+
getPreferredUnit,
|
|
99
|
+
getPreferredUnits,
|
|
100
|
+
getRequestStatusForAuthorization,
|
|
101
|
+
getWheelchairUse,
|
|
102
|
+
getWorkoutRoutes,
|
|
103
|
+
isHealthDataAvailable,
|
|
104
|
+
queryCategorySamples,
|
|
105
|
+
queryCategorySamplesWithAnchor,
|
|
106
|
+
queryCorrelationSamples,
|
|
107
|
+
queryHeartbeatSeriesSamples,
|
|
108
|
+
queryHeartbeatSeriesSamplesWithAnchor,
|
|
109
|
+
queryQuantitySamples,
|
|
110
|
+
queryQuantitySamplesWithAnchor,
|
|
111
|
+
queryStatisticsForQuantity,
|
|
112
|
+
queryWorkouts,
|
|
113
|
+
querySources,
|
|
114
|
+
requestAuthorization,
|
|
115
|
+
deleteQuantitySample,
|
|
116
|
+
deleteSamples,
|
|
117
|
+
getWorkoutPlanById,
|
|
118
|
+
saveCategorySample,
|
|
119
|
+
saveCorrelationSample,
|
|
120
|
+
saveQuantitySample,
|
|
121
|
+
saveWorkoutSample,
|
|
122
|
+
saveWorkoutRoute,
|
|
123
|
+
subscribeToChanges,
|
|
124
|
+
useMostRecentCategorySample,
|
|
125
|
+
useMostRecentQuantitySample,
|
|
126
|
+
useMostRecentWorkout,
|
|
127
|
+
useSubscribeToChanges,
|
|
128
|
+
useHealthkitAuthorization,
|
|
129
|
+
useIsHealthDataAvailable,
|
|
130
|
+
canAccessProtectedData,
|
|
131
|
+
isProtectedDataAvailable
|
|
132
|
+
};
|
|
133
|
+
export { authorizationStatusFor, availableQuantityTypes, disableAllBackgroundDelivery, disableBackgroundDelivery, enableBackgroundDelivery, useSources, useStatisticsForQuantity, getBiologicalSex, getBloodType, getDateOfBirth, getFitzpatrickSkinType, getMostRecentCategorySample, getMostRecentQuantitySample, getMostRecentWorkout, getPreferredUnit, getPreferredUnits, getRequestStatusForAuthorization, getWheelchairUse, getWorkoutRoutes, isHealthDataAvailable, queryCategorySamples, queryCategorySamplesWithAnchor, queryCorrelationSamples, queryHeartbeatSeriesSamples, queryHeartbeatSeriesSamplesWithAnchor, queryQuantitySamples, queryQuantitySamplesWithAnchor, queryStatisticsForQuantity, queryWorkouts, querySources, requestAuthorization, deleteQuantitySample, deleteSamples, getWorkoutPlanById, saveCategorySample, saveCorrelationSample, saveQuantitySample, saveWorkoutSample, saveWorkoutRoute, subscribeToChanges, useMostRecentCategorySample, useMostRecentQuantitySample, useMostRecentWorkout, useSubscribeToChanges, useHealthkitAuthorization, useIsHealthDataAvailable, canAccessProtectedData, isProtectedDataAvailable };
|
|
134
|
+
export * from './types';
|
|
135
|
+
export default Healthkit;
|
|
136
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","HKAuthorizationRequestStatus","HKAuthorizationStatus","HKBiologicalSex","HKBloodType","HKFitzpatrickSkinType","HKUnits","HKWheelchairUse","notAvailableError","OS","hasWarned","UnavailableFn","retVal","console","warn","authorizationStatusFor","Promise","resolve","notDetermined","availableQuantityTypes","disableAllBackgroundDelivery","disableBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","notSet","getBloodType","getDateOfBirth","Date","getFitzpatrickSkinType","getMostRecentCategorySample","getMostRecentQuantitySample","getMostRecentWorkout","getPreferredUnit","Count","getPreferredUnits","getRequestStatusForAuthorization","unknown","getWheelchairUse","getWorkoutRoutes","isHealthDataAvailable","useSources","useStatisticsForQuantity","queryCategorySamples","queryCategorySamplesWithAnchor","samples","deletedSamples","newAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","averageQuantity","undefined","maximumQuantity","minimumQuantity","sumQuantity","mostRecentQuantity","mostRecentQuantityDateInterval","duration","queryWorkouts","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","getWorkoutPlanById","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useHealthkitAuthorization","useIsHealthDataAvailable","canAccessProtectedData","isProtectedDataAvailable","Healthkit"],"sources":["index.native.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport {\n HKAuthorizationRequestStatus, HKAuthorizationStatus, HKBiologicalSex, HKBloodType, HKFitzpatrickSkinType, HKUnits, HKWheelchairUse,\n} from './native-types'\n\nimport type ReactNativeHealthkit from './index.ios'\nimport type { QueryCategorySamplesFn } from './utils/queryCategorySamples'\nimport type { QueryQuantitySamplesFn } from './utils/queryQuantitySamples'\n\nconst notAvailableError = `[@kingstinct/react-native-healthkit] Platform \"${\n Platform.OS\n}\" not supported`\n\nlet hasWarned = false\n\nfunction UnavailableFn<T = unknown>(retVal: T) {\n return () => {\n if (!hasWarned) {\n // eslint-disable-next-line no-console\n console.warn(notAvailableError)\n hasWarned = true\n }\n return retVal\n }\n}\n\nconst authorizationStatusFor = UnavailableFn(Promise.resolve(HKAuthorizationStatus.notDetermined)),\n availableQuantityTypes = UnavailableFn([]),\n disableAllBackgroundDelivery = UnavailableFn(Promise.resolve(false)),\n disableBackgroundDelivery = UnavailableFn(Promise.resolve(false)),\n enableBackgroundDelivery = UnavailableFn(Promise.resolve(false)),\n getBiologicalSex = UnavailableFn(Promise.resolve(HKBiologicalSex.notSet)),\n getBloodType = UnavailableFn(Promise.resolve(HKBloodType.notSet)),\n getDateOfBirth = UnavailableFn(Promise.resolve(new Date(0))),\n getFitzpatrickSkinType = UnavailableFn(Promise.resolve(HKFitzpatrickSkinType.notSet)),\n getMostRecentCategorySample = UnavailableFn(Promise.resolve(null)),\n getMostRecentQuantitySample = UnavailableFn(Promise.resolve(null)),\n getMostRecentWorkout = UnavailableFn(Promise.resolve(null)),\n getPreferredUnit = UnavailableFn(Promise.resolve(HKUnits.Count)),\n getPreferredUnits = UnavailableFn(Promise.resolve([])),\n getRequestStatusForAuthorization = UnavailableFn(Promise.resolve(HKAuthorizationRequestStatus.unknown)),\n getWheelchairUse = UnavailableFn(Promise.resolve(HKWheelchairUse.notSet)),\n getWorkoutRoutes = UnavailableFn(Promise.resolve([])),\n isHealthDataAvailable = async () => Promise.resolve(false),\n useSources = UnavailableFn(null),\n useStatisticsForQuantity = UnavailableFn(null),\n queryCategorySamples = UnavailableFn(Promise.resolve([])) as unknown as QueryCategorySamplesFn,\n queryCategorySamplesWithAnchor = UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryCorrelationSamples = UnavailableFn(Promise.resolve([])),\n queryHeartbeatSeriesSamples = UnavailableFn(Promise.resolve([])),\n queryHeartbeatSeriesSamplesWithAnchor = UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryQuantitySamples = UnavailableFn(Promise.resolve([])) as unknown as QueryQuantitySamplesFn,\n queryQuantitySamplesWithAnchor = UnavailableFn(Promise.resolve({\n samples: [],\n deletedSamples: [],\n newAnchor: '',\n })),\n queryStatisticsForQuantity = UnavailableFn(Promise.resolve({\n averageQuantity: undefined,\n maximumQuantity: undefined,\n minimumQuantity: undefined,\n sumQuantity: undefined,\n mostRecentQuantity: undefined,\n mostRecentQuantityDateInterval: undefined,\n duration: undefined,\n })),\n queryWorkouts = UnavailableFn(Promise.resolve([])),\n querySources = UnavailableFn(Promise.resolve([])),\n requestAuthorization = UnavailableFn(Promise.resolve(false)),\n deleteQuantitySample = UnavailableFn(Promise.resolve(false)),\n deleteSamples = UnavailableFn(Promise.resolve(false)),\n getWorkoutPlanById = UnavailableFn(Promise.resolve(null)),\n saveCategorySample = UnavailableFn(Promise.resolve(false)),\n saveCorrelationSample = UnavailableFn(Promise.resolve(false)),\n saveQuantitySample = UnavailableFn(Promise.resolve(false)),\n saveWorkoutSample = UnavailableFn(Promise.resolve(null)),\n saveWorkoutRoute = UnavailableFn(Promise.resolve(false)),\n subscribeToChanges = UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),\n useMostRecentCategorySample = UnavailableFn(null),\n useMostRecentQuantitySample = UnavailableFn(null),\n useMostRecentWorkout = UnavailableFn(null),\n useSubscribeToChanges = UnavailableFn([null, () => null]),\n useHealthkitAuthorization = UnavailableFn([null, async () => Promise.resolve(HKAuthorizationRequestStatus.unknown)] as const),\n useIsHealthDataAvailable = () => false,\n canAccessProtectedData = async () => Promise.resolve(false),\n isProtectedDataAvailable = async () => Promise.resolve(false)\n\nconst Healthkit: typeof ReactNativeHealthkit = {\n authorizationStatusFor,\n availableQuantityTypes,\n useSources,\n useStatisticsForQuantity,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n canAccessProtectedData,\n isProtectedDataAvailable,\n}\n\nexport {\n authorizationStatusFor,\n availableQuantityTypes,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n useSources,\n useStatisticsForQuantity,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n canAccessProtectedData,\n isProtectedDataAvailable,\n}\n\nexport * from './types'\n\nexport default Healthkit\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SACEC,4BAA4B,EAAEC,qBAAqB,EAAEC,eAAe,EAAEC,WAAW,EAAEC,qBAAqB,EAAEC,OAAO,EAAEC,eAAe,QAC7H,gBAAgB;AAMvB,MAAMC,iBAAiB,GAAI,kDACzBR,QAAQ,CAACS,EACV,iBAAgB;AAEjB,IAAIC,SAAS,GAAG,KAAK;AAErB,SAASC,aAAaA,CAAcC,MAAS,EAAE;EAC7C,OAAO,MAAM;IACX,IAAI,CAACF,SAAS,EAAE;MACd;MACAG,OAAO,CAACC,IAAI,CAACN,iBAAiB,CAAC;MAC/BE,SAAS,GAAG,IAAI;IAClB;IACA,OAAOE,MAAM;EACf,CAAC;AACH;AAEA,MAAMG,sBAAsB,GAAGJ,aAAa,CAACK,OAAO,CAACC,OAAO,CAACf,qBAAqB,CAACgB,aAAa,CAAC,CAAC;EAC5FC,sBAAsB,GAAGR,aAAa,CAAC,EAAE,CAAC;EAC1CS,4BAA4B,GAAGT,aAAa,CAACK,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAC;EACpEI,yBAAyB,GAAGV,aAAa,CAACK,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAC;EACjEK,wBAAwB,GAAGX,aAAa,CAACK,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAC;EAChEM,gB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pBC,8BAA8B,EAC9BI,uBAAuB,EACvBC,2BAA2B,EAC3BC,qCAAqC,EACrCC,oBAAoB,EACpBC,8BAA8B,EAC9BC,0BAA0B,EAC1BS,aAAa,EACbC,YAAY,EACZC,oBAAoB,EACpBC,oBAAoB,EACpBC,aAAa,EACbC,kBAAkB,EAClBC,kBAAkB,EAClBC,qBAAqB,EACrBC,kBAAkB,EAClBC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,oBAAoB,EACpBC,qBAAqB,EACrBC,yBAAyB,EACzBC,wBAAwB,EACxBC,sBAAsB,EACtBC,wBAAwB;AAG1B,cAAc,SAAS;AAEvB,eAAeC,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Healthkit"],"sources":["index.web.tsx"],"sourcesContent":["import Healthkit from './index.native'\n\nexport * from './index.native'\n\nexport default Healthkit\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,cAAc,gBAAgB;AAE9B,eAAeA,SAAS"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import Native from '../native-types';
|
|
2
|
+
/**
|
|
3
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}
|
|
4
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}
|
|
5
|
+
*/
|
|
2
6
|
async function saveCategorySample(identifier, value, options) {
|
|
3
7
|
const start = (options === null || options === void 0 ? void 0 : options.start) || (options === null || options === void 0 ? void 0 : options.end) || new Date();
|
|
4
8
|
const end = (options === null || options === void 0 ? void 0 : options.end) || (options === null || options === void 0 ? void 0 : options.start) || new Date();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,kBAAkBA,CAC/BC,UAAa,EACbC,KAAsC,EACtCC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOR,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QAAQ,IAAI,CAAC,CACf,CAAC;AACH;AAEA,eAAeP,kBAAkB"}
|
|
1
|
+
{"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC;AACA;AACA;AACA;AACA,eAAeC,kBAAkBA,CAC/BC,UAAa,EACbC,KAAsC,EACtCC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOR,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QAAQ,IAAI,CAAC,CACf,CAAC;AACH;AAEA,eAAeP,kBAAkB"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { HealthkitReadAuthorization, HealthkitWriteAuthorization, HKAuthorizationRequestStatus } from '../native-types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.
|
|
4
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}
|
|
5
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
|
|
6
|
+
*/
|
|
2
7
|
declare const useHealthkitAuthorization: (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => readonly [HKAuthorizationRequestStatus | null, () => Promise<HKAuthorizationRequestStatus>];
|
|
3
8
|
export default useHealthkitAuthorization;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
2
|
import type { HKCategorySample } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @returns the most recent sample for the given category type.
|
|
5
|
+
*/
|
|
3
6
|
declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySample<TCategory> | null;
|
|
4
7
|
export default useMostRecentCategorySample;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
2
|
import type { HKQuantitySample } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @returns the most recent sample for the given quantity type.
|
|
5
|
+
*/
|
|
3
6
|
declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySample<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
|
|
4
7
|
export default useMostRecentQuantitySample;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { EnergyUnit, LengthUnit } from '../native-types';
|
|
2
2
|
import type { HKWorkout } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @returns the most recent workout sample.
|
|
5
|
+
*/
|
|
3
6
|
declare function useMostRecentWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(options?: {
|
|
4
7
|
readonly energyUnit?: TEnergy;
|
|
5
8
|
readonly distanceUnit?: TDistance;
|
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from './types';
|
|
5
|
-
declare const _default: {
|
|
6
|
-
authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<HKAuthorizationStatus>;
|
|
7
|
-
availableQuantityTypes: (majorVersionIOS?: number) => import("./native-types").HKQuantityTypeIdentifier[];
|
|
8
|
-
isHealthDataAvailable: () => Promise<boolean>;
|
|
9
|
-
isProtectedDataAvailable: () => Promise<boolean>;
|
|
10
|
-
canAccessProtectedData: () => Promise<boolean>;
|
|
11
|
-
disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
12
|
-
disableBackgroundDelivery: (typeIdentifier: import("./native-types").HKSampleTypeIdentifier) => Promise<boolean>;
|
|
13
|
-
enableBackgroundDelivery: (typeIdentifier: import("./native-types").HKSampleTypeIdentifier, updateFrequency: import("./native-types").HKUpdateFrequency) => Promise<boolean>;
|
|
14
|
-
getBiologicalSex: () => Promise<HKBiologicalSex>;
|
|
15
|
-
getFitzpatrickSkinType: () => Promise<HKFitzpatrickSkinType>;
|
|
16
|
-
getWheelchairUse: () => Promise<HKWheelchairUse>;
|
|
17
|
-
getBloodType: () => Promise<HKBloodType>;
|
|
18
|
-
getDateOfBirth: () => Promise<Date>;
|
|
19
|
-
getMostRecentQuantitySample: typeof import("./utils/getMostRecentQuantitySample").default;
|
|
20
|
-
getMostRecentCategorySample: typeof import("./utils/getMostRecentCategorySample").default;
|
|
21
|
-
getMostRecentWorkout: import("./utils/getMostRecentWorkout").GetMostRecentWorkoutFn;
|
|
22
|
-
getWorkoutRoutes: (workoutUUID: string) => Promise<readonly import("./native-types").WorkoutRoute[]>;
|
|
23
|
-
getWorkoutPlanById: typeof import("./utils/getWorkoutPlanById").default;
|
|
24
|
-
getPreferredUnit: import("./utils/getPreferredUnit").GetPreferredUnitFn;
|
|
25
|
-
getPreferredUnits: import("./utils/getPreferredUnits").GetPreferredUnitsFn;
|
|
26
|
-
getRequestStatusForAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<HKAuthorizationRequestStatus>;
|
|
27
|
-
queryCategorySamples: QueryCategorySamplesFn;
|
|
28
|
-
queryCategorySamplesWithAnchor: import("./utils/queryCategorySamplesWithAnchor").QueryCategorySamplesWithAnchorFn;
|
|
29
|
-
queryCorrelationSamples: import("./utils/queryCorrelationSamples").QueryCorrelationSamplesFn;
|
|
30
|
-
queryHeartbeatSeriesSamples: import("./utils/queryHeartbeatSeriesSamples").QueryHeartbeatSeriesSamplesFn;
|
|
31
|
-
queryHeartbeatSeriesSamplesWithAnchor: import("./utils/queryHeartbeatSeriesSamplesWithAnchor").QueryHeartbeatSeriesSamplesFn;
|
|
32
|
-
queryQuantitySamples: QueryQuantitySamplesFn;
|
|
33
|
-
queryQuantitySamplesWithAnchor: import("./utils/queryQuantitySamplesWithAnchor").QueryQuantitySamplesWithAnchorFn;
|
|
34
|
-
queryStatisticsForQuantity: typeof import("./utils/queryStatisticsForQuantity").default;
|
|
35
|
-
queryWorkouts: typeof import("./utils/queryWorkouts").default;
|
|
36
|
-
querySources: import("./utils/querySources").QuerySourcesFn;
|
|
37
|
-
requestAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<boolean>;
|
|
38
|
-
deleteQuantitySample: import("./utils/deleteQuantitySample").DeleteQuantitySampleFn;
|
|
39
|
-
deleteSamples: import("./utils/deleteSamples").DeleteSamplesFn;
|
|
40
|
-
saveCategorySample: typeof import("./utils/saveCategorySample").default;
|
|
41
|
-
saveCorrelationSample: typeof import("./utils/saveCorrelationSample").default;
|
|
42
|
-
saveQuantitySample: typeof import("./utils/saveQuantitySample").default;
|
|
43
|
-
saveWorkoutSample: typeof import("./utils/saveWorkoutSample").default;
|
|
44
|
-
saveWorkoutRoute: typeof import("./utils/saveWorkoutRoute").default;
|
|
45
|
-
subscribeToChanges: (identifier: import("./native-types").HKSampleTypeIdentifier, callback: () => void) => Promise<() => Promise<boolean>>;
|
|
46
|
-
useMostRecentCategorySample: typeof import("./hooks/useMostRecentCategorySample").default;
|
|
47
|
-
useMostRecentQuantitySample: typeof import("./hooks/useMostRecentQuantitySample").default;
|
|
48
|
-
useMostRecentWorkout: typeof import("./hooks/useMostRecentWorkout").default;
|
|
49
|
-
useSubscribeToChanges: typeof import("./hooks/useSubscribeToChanges").default;
|
|
50
|
-
useIsHealthDataAvailable: () => boolean | null;
|
|
51
|
-
useHealthkitAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[] | undefined) => readonly [HKAuthorizationRequestStatus | null, () => Promise<HKAuthorizationRequestStatus>];
|
|
52
|
-
};
|
|
53
|
-
export default _default;
|
|
1
|
+
import Healthkit from './index.ios';
|
|
2
|
+
export * from './index.ios';
|
|
3
|
+
export default Healthkit;
|
|
@@ -1,18 +1,51 @@
|
|
|
1
|
+
import useHealthkitAuthorization from './hooks/useHealthkitAuthorization';
|
|
2
|
+
import useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable';
|
|
1
3
|
import useMostRecentCategorySample from './hooks/useMostRecentCategorySample';
|
|
2
4
|
import useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample';
|
|
3
5
|
import useMostRecentWorkout from './hooks/useMostRecentWorkout';
|
|
6
|
+
import useSources from './hooks/useSources';
|
|
7
|
+
import useStatisticsForQuantity from './hooks/useStatisticsForQuantity';
|
|
4
8
|
import useSubscribeToChanges from './hooks/useSubscribeToChanges';
|
|
5
9
|
import { HKQuantityTypeIdentifier } from './native-types';
|
|
10
|
+
import deleteQuantitySample from './utils/deleteQuantitySample';
|
|
11
|
+
import deleteSamples from './utils/deleteSamples';
|
|
12
|
+
import getDateOfBirth from './utils/getDateOfBirth';
|
|
6
13
|
import getMostRecentCategorySample from './utils/getMostRecentCategorySample';
|
|
7
14
|
import getMostRecentQuantitySample from './utils/getMostRecentQuantitySample';
|
|
15
|
+
import getMostRecentWorkout from './utils/getMostRecentWorkout';
|
|
16
|
+
import getPreferredUnit from './utils/getPreferredUnit';
|
|
17
|
+
import getPreferredUnits from './utils/getPreferredUnits';
|
|
18
|
+
import getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization';
|
|
8
19
|
import getWorkoutPlanById from './utils/getWorkoutPlanById';
|
|
20
|
+
import queryCategorySamples from './utils/queryCategorySamples';
|
|
21
|
+
import queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor';
|
|
22
|
+
import queryCorrelationSamples from './utils/queryCorrelationSamples';
|
|
23
|
+
import queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples';
|
|
24
|
+
import queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor';
|
|
25
|
+
import queryQuantitySamples from './utils/queryQuantitySamples';
|
|
26
|
+
import queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor';
|
|
27
|
+
import querySources from './utils/querySources';
|
|
9
28
|
import queryStatisticsForQuantity from './utils/queryStatisticsForQuantity';
|
|
10
29
|
import queryWorkouts from './utils/queryWorkouts';
|
|
30
|
+
import requestAuthorization from './utils/requestAuthorization';
|
|
11
31
|
import saveCategorySample from './utils/saveCategorySample';
|
|
12
32
|
import saveCorrelationSample from './utils/saveCorrelationSample';
|
|
13
33
|
import saveQuantitySample from './utils/saveQuantitySample';
|
|
14
34
|
import saveWorkoutRoute from './utils/saveWorkoutRoute';
|
|
15
35
|
import saveWorkoutSample from './utils/saveWorkoutSample';
|
|
36
|
+
import subscribeToChanges from './utils/subscribeToChanges';
|
|
37
|
+
declare const availableQuantityTypes: (majorVersionIOS?: number) => HKQuantityTypeIdentifier[];
|
|
38
|
+
declare const authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<import("./native-types").HKAuthorizationStatus>;
|
|
39
|
+
declare const isHealthDataAvailable: () => Promise<boolean>;
|
|
40
|
+
declare const canAccessProtectedData: () => Promise<boolean>;
|
|
41
|
+
declare const disableBackgroundDelivery: (typeIdentifier: import("./native-types").HKSampleTypeIdentifier) => Promise<boolean>;
|
|
42
|
+
declare const disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
43
|
+
declare const enableBackgroundDelivery: (typeIdentifier: import("./native-types").HKSampleTypeIdentifier, updateFrequency: import("./native-types").HKUpdateFrequency) => Promise<boolean>;
|
|
44
|
+
declare const getBiologicalSex: () => Promise<import("./native-types").HKBiologicalSex>;
|
|
45
|
+
declare const getFitzpatrickSkinType: () => Promise<import("./native-types").HKFitzpatrickSkinType>;
|
|
46
|
+
declare const getWheelchairUse: () => Promise<import("./native-types").HKWheelchairUse>;
|
|
47
|
+
declare const getBloodType: () => Promise<import("./native-types").HKBloodType>;
|
|
48
|
+
declare const getWorkoutRoutes: (workoutUUID: string) => Promise<readonly import("./native-types").WorkoutRoute[]>;
|
|
16
49
|
/**
|
|
17
50
|
* @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}
|
|
18
51
|
*/
|
|
@@ -138,6 +171,10 @@ declare const _default: {
|
|
|
138
171
|
* @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
|
|
139
172
|
*/
|
|
140
173
|
useHealthkitAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[] | undefined) => readonly [import("./native-types").HKAuthorizationRequestStatus | null, () => Promise<import("./native-types").HKAuthorizationRequestStatus>];
|
|
174
|
+
useSources: typeof useSources;
|
|
175
|
+
useStatisticsForQuantity: typeof useStatisticsForQuantity;
|
|
141
176
|
};
|
|
142
177
|
export default _default;
|
|
178
|
+
declare const isProtectedDataAvailable: () => Promise<boolean>;
|
|
179
|
+
export { authorizationStatusFor, availableQuantityTypes, disableAllBackgroundDelivery, disableBackgroundDelivery, enableBackgroundDelivery, getBiologicalSex, getBloodType, getDateOfBirth, getFitzpatrickSkinType, getMostRecentCategorySample, getMostRecentQuantitySample, getMostRecentWorkout, getPreferredUnit, getPreferredUnits, getRequestStatusForAuthorization, getWheelchairUse, getWorkoutRoutes, isHealthDataAvailable, queryCategorySamples, queryCategorySamplesWithAnchor, queryCorrelationSamples, queryHeartbeatSeriesSamples, queryHeartbeatSeriesSamplesWithAnchor, queryQuantitySamples, queryQuantitySamplesWithAnchor, queryStatisticsForQuantity, queryWorkouts, querySources, requestAuthorization, deleteQuantitySample, deleteSamples, getWorkoutPlanById, saveCategorySample, saveCorrelationSample, saveQuantitySample, saveWorkoutSample, saveWorkoutRoute, subscribeToChanges, useMostRecentCategorySample, useMostRecentQuantitySample, useMostRecentWorkout, useSubscribeToChanges, useHealthkitAuthorization, useIsHealthDataAvailable, useSources, useStatisticsForQuantity, canAccessProtectedData, isProtectedDataAvailable, };
|
|
143
180
|
export * from './types';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HKAuthorizationRequestStatus, HKAuthorizationStatus, HKBiologicalSex, HKBloodType, HKFitzpatrickSkinType, HKUnits, HKWheelchairUse } from './native-types';
|
|
2
|
+
import type ReactNativeHealthkit from './index.ios';
|
|
3
|
+
import type { QueryCategorySamplesFn } from './utils/queryCategorySamples';
|
|
4
|
+
import type { QueryQuantitySamplesFn } from './utils/queryQuantitySamples';
|
|
5
|
+
declare const authorizationStatusFor: () => Promise<HKAuthorizationStatus>, availableQuantityTypes: () => never[], disableAllBackgroundDelivery: () => Promise<boolean>, disableBackgroundDelivery: () => Promise<boolean>, enableBackgroundDelivery: () => Promise<boolean>, getBiologicalSex: () => Promise<HKBiologicalSex>, getBloodType: () => Promise<HKBloodType>, getDateOfBirth: () => Promise<Date>, getFitzpatrickSkinType: () => Promise<HKFitzpatrickSkinType>, getMostRecentCategorySample: () => Promise<null>, getMostRecentQuantitySample: () => Promise<null>, getMostRecentWorkout: () => Promise<null>, getPreferredUnit: () => Promise<HKUnits>, getPreferredUnits: () => Promise<never[]>, getRequestStatusForAuthorization: () => Promise<HKAuthorizationRequestStatus>, getWheelchairUse: () => Promise<HKWheelchairUse>, getWorkoutRoutes: () => Promise<never[]>, isHealthDataAvailable: () => Promise<boolean>, useSources: () => null, useStatisticsForQuantity: () => null, queryCategorySamples: QueryCategorySamplesFn, queryCategorySamplesWithAnchor: () => Promise<{
|
|
6
|
+
samples: never[];
|
|
7
|
+
deletedSamples: never[];
|
|
8
|
+
newAnchor: string;
|
|
9
|
+
}>, queryCorrelationSamples: () => Promise<never[]>, queryHeartbeatSeriesSamples: () => Promise<never[]>, queryHeartbeatSeriesSamplesWithAnchor: () => Promise<{
|
|
10
|
+
samples: never[];
|
|
11
|
+
deletedSamples: never[];
|
|
12
|
+
newAnchor: string;
|
|
13
|
+
}>, queryQuantitySamples: QueryQuantitySamplesFn, queryQuantitySamplesWithAnchor: () => Promise<{
|
|
14
|
+
samples: never[];
|
|
15
|
+
deletedSamples: never[];
|
|
16
|
+
newAnchor: string;
|
|
17
|
+
}>, queryStatisticsForQuantity: () => Promise<{
|
|
18
|
+
averageQuantity: undefined;
|
|
19
|
+
maximumQuantity: undefined;
|
|
20
|
+
minimumQuantity: undefined;
|
|
21
|
+
sumQuantity: undefined;
|
|
22
|
+
mostRecentQuantity: undefined;
|
|
23
|
+
mostRecentQuantityDateInterval: undefined;
|
|
24
|
+
duration: undefined;
|
|
25
|
+
}>, queryWorkouts: () => Promise<never[]>, querySources: () => Promise<never[]>, requestAuthorization: () => Promise<boolean>, deleteQuantitySample: () => Promise<boolean>, deleteSamples: () => Promise<boolean>, getWorkoutPlanById: () => Promise<null>, saveCategorySample: () => Promise<boolean>, saveCorrelationSample: () => Promise<boolean>, saveQuantitySample: () => Promise<boolean>, saveWorkoutSample: () => Promise<null>, saveWorkoutRoute: () => Promise<boolean>, subscribeToChanges: () => Promise<() => Promise<boolean>>, useMostRecentCategorySample: () => null, useMostRecentQuantitySample: () => null, useMostRecentWorkout: () => null, useSubscribeToChanges: () => ((() => null) | null)[], useHealthkitAuthorization: () => readonly [null, () => Promise<HKAuthorizationRequestStatus>], useIsHealthDataAvailable: () => boolean, canAccessProtectedData: () => Promise<boolean>, isProtectedDataAvailable: () => Promise<boolean>;
|
|
26
|
+
declare const Healthkit: typeof ReactNativeHealthkit;
|
|
27
|
+
export { authorizationStatusFor, availableQuantityTypes, disableAllBackgroundDelivery, disableBackgroundDelivery, enableBackgroundDelivery, useSources, useStatisticsForQuantity, getBiologicalSex, getBloodType, getDateOfBirth, getFitzpatrickSkinType, getMostRecentCategorySample, getMostRecentQuantitySample, getMostRecentWorkout, getPreferredUnit, getPreferredUnits, getRequestStatusForAuthorization, getWheelchairUse, getWorkoutRoutes, isHealthDataAvailable, queryCategorySamples, queryCategorySamplesWithAnchor, queryCorrelationSamples, queryHeartbeatSeriesSamples, queryHeartbeatSeriesSamplesWithAnchor, queryQuantitySamples, queryQuantitySamplesWithAnchor, queryStatisticsForQuantity, queryWorkouts, querySources, requestAuthorization, deleteQuantitySample, deleteSamples, getWorkoutPlanById, saveCategorySample, saveCorrelationSample, saveQuantitySample, saveWorkoutSample, saveWorkoutRoute, subscribeToChanges, useMostRecentCategorySample, useMostRecentQuantitySample, useMostRecentWorkout, useSubscribeToChanges, useHealthkitAuthorization, useIsHealthDataAvailable, canAccessProtectedData, isProtectedDataAvailable, };
|
|
28
|
+
export * from './types';
|
|
29
|
+
export default Healthkit;
|