@kingstinct/react-native-healthkit 8.7.2 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactNativeHealthkit.podspec +36 -0
- package/app.plugin.js +43 -33
- package/ios/Bridge.h +8 -0
- package/ios/CategoryTypeModule.swift +128 -0
- package/ios/CharacteristicTypeModule.swift +78 -0
- package/ios/Constants.swift +2 -0
- package/ios/CoreModule.swift +376 -0
- package/ios/CorrelationTypeModule.swift +153 -0
- package/ios/HeartbeatSeriesModule.swift +189 -0
- package/ios/Helpers.swift +529 -251
- package/ios/QuantityTypeModule.swift +461 -0
- package/ios/Serializers.swift +211 -124
- package/ios/SourceProxy.swift +35 -0
- package/ios/StateOfMindModule.swift +160 -0
- package/ios/WorkoutProxy.swift +405 -0
- package/ios/WorkoutSessionModule.swift +182 -0
- package/ios/WorkoutsModule.swift +357 -0
- package/package.json +43 -127
- package/react-native.config.js +16 -0
- package/src/hooks/useHealthkitAuthorization.test.ts +47 -29
- package/src/hooks/useHealthkitAuthorization.ts +21 -15
- package/src/hooks/useIsHealthDataAvailable.test.ts +17 -7
- package/src/hooks/useIsHealthDataAvailable.ts +7 -7
- package/src/hooks/useMostRecentCategorySample.ts +10 -12
- package/src/hooks/useMostRecentQuantitySample.ts +17 -36
- package/src/hooks/useMostRecentWorkout.ts +16 -38
- package/src/hooks/useSources.ts +8 -12
- package/src/hooks/useStatisticsForQuantity.ts +19 -14
- package/src/hooks/useSubscribeToChanges.ts +9 -13
- package/src/index.ios.ts +232 -0
- package/src/index.ts +444 -0
- package/src/modules.ts +43 -0
- package/src/specs/CategoryTypeModule.nitro.ts +64 -0
- package/src/specs/CharacteristicTypeModule.nitro.ts +22 -0
- package/src/specs/CoreModule.nitro.ts +107 -0
- package/src/specs/CorrelationTypeModule.nitro.ts +23 -0
- package/src/specs/HeartbeatSeriesModule.nitro.ts +19 -0
- package/src/specs/QuantityTypeModule.nitro.ts +60 -0
- package/src/specs/SourceProxy.nitro.ts +13 -0
- package/src/specs/StateOfMindModule.nitro.ts +23 -0
- package/src/specs/WorkoutProxy.nitro.ts +18 -0
- package/src/specs/WorkoutSessionModule.nitro.ts +71 -0
- package/src/specs/WorkoutsModule.nitro.ts +32 -0
- package/src/test-setup.ts +68 -54
- package/src/test-utils.ts +3 -2
- package/src/types/Auth.ts +17 -0
- package/src/types/Background.ts +9 -0
- package/src/types/CategoryType.ts +249 -0
- package/src/types/CategoryTypeIdentifier.ts +99 -0
- package/src/types/Characteristics.ts +53 -0
- package/src/types/Constants.ts +25 -0
- package/src/types/CorrelationType.ts +31 -0
- package/src/types/Device.ts +13 -0
- package/src/types/HeartbeatSeries.ts +29 -0
- package/src/types/InterfaceVerification.ts +164 -0
- package/src/types/InterfaceVerificationExample.ts +89 -0
- package/src/types/QuantitySample.ts +30 -0
- package/src/types/QuantityType.ts +192 -0
- package/src/types/QuantityTypeIdentifier.ts +758 -0
- package/src/types/QueryOptions.ts +69 -0
- package/src/types/README-InterfaceVerification.md +103 -0
- package/src/types/Shared.ts +79 -0
- package/src/types/Source.ts +11 -0
- package/src/types/StateOfMind.ts +110 -0
- package/src/types/Subscriptons.ts +10 -0
- package/src/types/Units.ts +190 -0
- package/src/types/WeatherCondition.ts +31 -0
- package/src/types/WorkoutKit.ts +18 -0
- package/src/types/Workouts.ts +282 -0
- package/src/utils/getMostRecentCategorySample.ts +7 -11
- package/src/utils/getMostRecentQuantitySample.ts +8 -18
- package/src/utils/getMostRecentWorkout.ts +7 -17
- package/src/utils/getPreferredUnit.ts +12 -8
- package/src/utils/subscribeToChanges.ts +9 -26
- package/LICENSE +0 -21
- package/README.md +0 -179
- package/ios/ReactNativeHealthkit-Bridging-Header.h +0 -2
- package/ios/ReactNativeHealthkit.m +0 -271
- package/ios/ReactNativeHealthkit.swift +0 -2333
- package/ios/ReactNativeHealthkit.xcodeproj/project.pbxproj +0 -279
- package/kingstinct-react-native-healthkit.podspec +0 -21
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +0 -39
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +0 -1
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +0 -72
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +0 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js +0 -27
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +0 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +0 -41
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +0 -23
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +0 -37
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentWorkout.js +0 -48
- package/lib/commonjs/hooks/useMostRecentWorkout.js.map +0 -1
- package/lib/commonjs/hooks/useSources.js +0 -22
- package/lib/commonjs/hooks/useSources.js.map +0 -1
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +0 -28
- package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +0 -1
- package/lib/commonjs/hooks/useSubscribeToChanges.js +0 -28
- package/lib/commonjs/hooks/useSubscribeToChanges.js.map +0 -1
- package/lib/commonjs/index.ios.js +0 -531
- package/lib/commonjs/index.ios.js.map +0 -1
- package/lib/commonjs/index.js +0 -22
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/index.native.js +0 -235
- package/lib/commonjs/index.native.js.map +0 -1
- package/lib/commonjs/index.web.js +0 -22
- package/lib/commonjs/index.web.js.map +0 -1
- package/lib/commonjs/native-types.js +0 -1575
- package/lib/commonjs/native-types.js.map +0 -1
- package/lib/commonjs/test-setup.js +0 -57
- package/lib/commonjs/test-setup.js.map +0 -1
- package/lib/commonjs/test-utils.js +0 -18
- package/lib/commonjs/test-utils.js.map +0 -1
- package/lib/commonjs/types.js +0 -17
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/deleteQuantitySample.js +0 -11
- package/lib/commonjs/utils/deleteQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/deleteSamples.js +0 -18
- package/lib/commonjs/utils/deleteSamples.js.map +0 -1
- package/lib/commonjs/utils/deleteWorkoutSample.js +0 -11
- package/lib/commonjs/utils/deleteWorkoutSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeCategorySample.js +0 -13
- package/lib/commonjs/utils/deserializeCategorySample.js.map +0 -1
- package/lib/commonjs/utils/deserializeCategorySample.test.js +0 -26
- package/lib/commonjs/utils/deserializeCategorySample.test.js.map +0 -1
- package/lib/commonjs/utils/deserializeCorrelation.js +0 -26
- package/lib/commonjs/utils/deserializeCorrelation.js.map +0 -1
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +0 -15
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeSample.js +0 -15
- package/lib/commonjs/utils/deserializeSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeWorkout.js +0 -15
- package/lib/commonjs/utils/deserializeWorkout.js.map +0 -1
- package/lib/commonjs/utils/ensureMetadata.js +0 -11
- package/lib/commonjs/utils/ensureMetadata.js.map +0 -1
- package/lib/commonjs/utils/ensureTotals.js +0 -11
- package/lib/commonjs/utils/ensureTotals.js.map +0 -1
- package/lib/commonjs/utils/ensureUnit.js +0 -17
- package/lib/commonjs/utils/ensureUnit.js.map +0 -1
- package/lib/commonjs/utils/getDateOfBirth.js +0 -14
- package/lib/commonjs/utils/getDateOfBirth.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentCategorySample.js +0 -17
- package/lib/commonjs/utils/getMostRecentCategorySample.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +0 -21
- package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentWorkout.js +0 -19
- package/lib/commonjs/utils/getMostRecentWorkout.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnit.js +0 -14
- package/lib/commonjs/utils/getPreferredUnit.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnits.js +0 -14
- package/lib/commonjs/utils/getPreferredUnits.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnitsTyped.js +0 -33
- package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +0 -1
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js +0 -21
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +0 -1
- package/lib/commonjs/utils/getWorkoutPlanById.js +0 -13
- package/lib/commonjs/utils/getWorkoutPlanById.js.map +0 -1
- package/lib/commonjs/utils/prepareOptions.js +0 -25
- package/lib/commonjs/utils/prepareOptions.js.map +0 -1
- package/lib/commonjs/utils/queryCategorySamples.js +0 -17
- package/lib/commonjs/utils/queryCategorySamples.js.map +0 -1
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +0 -21
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryCorrelationSamples.js +0 -17
- package/lib/commonjs/utils/queryCorrelationSamples.js.map +0 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +0 -17
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +0 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -21
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryQuantitySamples.js +0 -19
- package/lib/commonjs/utils/queryQuantitySamples.js.map +0 -1
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +0 -23
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/querySources.js +0 -14
- package/lib/commonjs/utils/querySources.js.map +0 -1
- package/lib/commonjs/utils/queryStateOfMindSamples.js +0 -22
- package/lib/commonjs/utils/queryStateOfMindSamples.js.map +0 -1
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js +0 -16
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
- package/lib/commonjs/utils/queryStatisticsForQuantity.js +0 -29
- package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +0 -1
- package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js +0 -26
- package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryWorkouts.js +0 -22
- package/lib/commonjs/utils/queryWorkouts.js.map +0 -1
- package/lib/commonjs/utils/requestAuthorization.js +0 -22
- package/lib/commonjs/utils/requestAuthorization.js.map +0 -1
- package/lib/commonjs/utils/saveCategorySample.js +0 -20
- package/lib/commonjs/utils/saveCategorySample.js.map +0 -1
- package/lib/commonjs/utils/saveCorrelationSample.js +0 -35
- package/lib/commonjs/utils/saveCorrelationSample.js.map +0 -1
- package/lib/commonjs/utils/saveQuantitySample.js +0 -16
- package/lib/commonjs/utils/saveQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/saveStateOfMindSample.js +0 -17
- package/lib/commonjs/utils/saveStateOfMindSample.js.map +0 -1
- package/lib/commonjs/utils/saveWorkoutRoute.js +0 -26
- package/lib/commonjs/utils/saveWorkoutRoute.js.map +0 -1
- package/lib/commonjs/utils/saveWorkoutSample.js +0 -36
- package/lib/commonjs/utils/saveWorkoutSample.js.map +0 -1
- package/lib/commonjs/utils/serializeDate.js +0 -9
- package/lib/commonjs/utils/serializeDate.js.map +0 -1
- package/lib/commonjs/utils/serializeDate.test.js +0 -17
- package/lib/commonjs/utils/serializeDate.test.js.map +0 -1
- package/lib/commonjs/utils/startWatchApp.js +0 -11
- package/lib/commonjs/utils/startWatchApp.js.map +0 -1
- package/lib/commonjs/utils/subscribeToChanges.js +0 -27
- package/lib/commonjs/utils/subscribeToChanges.js.map +0 -1
- package/lib/module/hooks/useHealthkitAuthorization.js +0 -32
- package/lib/module/hooks/useHealthkitAuthorization.js.map +0 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js +0 -68
- package/lib/module/hooks/useHealthkitAuthorization.test.js.map +0 -1
- package/lib/module/hooks/useIsHealthDataAvailable.js +0 -21
- package/lib/module/hooks/useIsHealthDataAvailable.js.map +0 -1
- package/lib/module/hooks/useIsHealthDataAvailable.test.js +0 -37
- package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +0 -1
- package/lib/module/hooks/useMostRecentCategorySample.js +0 -16
- package/lib/module/hooks/useMostRecentCategorySample.js.map +0 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js +0 -30
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +0 -1
- package/lib/module/hooks/useMostRecentWorkout.js +0 -41
- package/lib/module/hooks/useMostRecentWorkout.js.map +0 -1
- package/lib/module/hooks/useSources.js +0 -15
- package/lib/module/hooks/useSources.js.map +0 -1
- package/lib/module/hooks/useStatisticsForQuantity.js +0 -21
- package/lib/module/hooks/useStatisticsForQuantity.js.map +0 -1
- package/lib/module/hooks/useSubscribeToChanges.js +0 -21
- package/lib/module/hooks/useSubscribeToChanges.js.map +0 -1
- package/lib/module/index.ios.js +0 -209
- package/lib/module/index.ios.js.map +0 -1
- package/lib/module/index.js +0 -4
- package/lib/module/index.js.map +0 -1
- package/lib/module/index.native.js +0 -160
- package/lib/module/index.native.js.map +0 -1
- package/lib/module/index.web.js +0 -4
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/native-types.js +0 -1606
- package/lib/module/native-types.js.map +0 -1
- package/lib/module/test-setup.js +0 -54
- package/lib/module/test-setup.js.map +0 -1
- package/lib/module/test-utils.js +0 -11
- package/lib/module/test-utils.js.map +0 -1
- package/lib/module/types.js +0 -67
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/deleteQuantitySample.js +0 -4
- package/lib/module/utils/deleteQuantitySample.js.map +0 -1
- package/lib/module/utils/deleteSamples.js +0 -11
- package/lib/module/utils/deleteSamples.js.map +0 -1
- package/lib/module/utils/deleteWorkoutSample.js +0 -4
- package/lib/module/utils/deleteWorkoutSample.js.map +0 -1
- package/lib/module/utils/deserializeCategorySample.js +0 -7
- package/lib/module/utils/deserializeCategorySample.js.map +0 -1
- package/lib/module/utils/deserializeCategorySample.test.js +0 -22
- package/lib/module/utils/deserializeCategorySample.test.js.map +0 -1
- package/lib/module/utils/deserializeCorrelation.js +0 -19
- package/lib/module/utils/deserializeCorrelation.js.map +0 -1
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js +0 -9
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
- package/lib/module/utils/deserializeSample.js +0 -9
- package/lib/module/utils/deserializeSample.js.map +0 -1
- package/lib/module/utils/deserializeWorkout.js +0 -9
- package/lib/module/utils/deserializeWorkout.js.map +0 -1
- package/lib/module/utils/ensureMetadata.js +0 -5
- package/lib/module/utils/ensureMetadata.js.map +0 -1
- package/lib/module/utils/ensureTotals.js +0 -5
- package/lib/module/utils/ensureTotals.js.map +0 -1
- package/lib/module/utils/ensureUnit.js +0 -10
- package/lib/module/utils/ensureUnit.js.map +0 -1
- package/lib/module/utils/getDateOfBirth.js +0 -7
- package/lib/module/utils/getDateOfBirth.js.map +0 -1
- package/lib/module/utils/getMostRecentCategorySample.js +0 -10
- package/lib/module/utils/getMostRecentCategorySample.js.map +0 -1
- package/lib/module/utils/getMostRecentQuantitySample.js +0 -14
- package/lib/module/utils/getMostRecentQuantitySample.js.map +0 -1
- package/lib/module/utils/getMostRecentWorkout.js +0 -12
- package/lib/module/utils/getMostRecentWorkout.js.map +0 -1
- package/lib/module/utils/getPreferredUnit.js +0 -7
- package/lib/module/utils/getPreferredUnit.js.map +0 -1
- package/lib/module/utils/getPreferredUnits.js +0 -7
- package/lib/module/utils/getPreferredUnits.js.map +0 -1
- package/lib/module/utils/getPreferredUnitsTyped.js +0 -26
- package/lib/module/utils/getPreferredUnitsTyped.js.map +0 -1
- package/lib/module/utils/getRequestStatusForAuthorization.js +0 -14
- package/lib/module/utils/getRequestStatusForAuthorization.js.map +0 -1
- package/lib/module/utils/getWorkoutPlanById.js +0 -6
- package/lib/module/utils/getWorkoutPlanById.js.map +0 -1
- package/lib/module/utils/prepareOptions.js +0 -18
- package/lib/module/utils/prepareOptions.js.map +0 -1
- package/lib/module/utils/queryCategorySamples.js +0 -10
- package/lib/module/utils/queryCategorySamples.js.map +0 -1
- package/lib/module/utils/queryCategorySamplesWithAnchor.js +0 -14
- package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryCorrelationSamples.js +0 -10
- package/lib/module/utils/queryCorrelationSamples.js.map +0 -1
- package/lib/module/utils/queryHeartbeatSeriesSamples.js +0 -10
- package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +0 -1
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -14
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryQuantitySamples.js +0 -12
- package/lib/module/utils/queryQuantitySamples.js.map +0 -1
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js +0 -16
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/querySources.js +0 -7
- package/lib/module/utils/querySources.js.map +0 -1
- package/lib/module/utils/queryStateOfMindSamples.js +0 -14
- package/lib/module/utils/queryStateOfMindSamples.js.map +0 -1
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js +0 -9
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
- package/lib/module/utils/queryStatisticsForQuantity.js +0 -22
- package/lib/module/utils/queryStatisticsForQuantity.js.map +0 -1
- package/lib/module/utils/queryWorkoutSamplesWithAnchor.js +0 -19
- package/lib/module/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryWorkouts.js +0 -15
- package/lib/module/utils/queryWorkouts.js.map +0 -1
- package/lib/module/utils/requestAuthorization.js +0 -15
- package/lib/module/utils/requestAuthorization.js.map +0 -1
- package/lib/module/utils/saveCategorySample.js +0 -13
- package/lib/module/utils/saveCategorySample.js.map +0 -1
- package/lib/module/utils/saveCorrelationSample.js +0 -28
- package/lib/module/utils/saveCorrelationSample.js.map +0 -1
- package/lib/module/utils/saveQuantitySample.js +0 -9
- package/lib/module/utils/saveQuantitySample.js.map +0 -1
- package/lib/module/utils/saveStateOfMindSample.js +0 -10
- package/lib/module/utils/saveStateOfMindSample.js.map +0 -1
- package/lib/module/utils/saveWorkoutRoute.js +0 -19
- package/lib/module/utils/saveWorkoutRoute.js.map +0 -1
- package/lib/module/utils/saveWorkoutSample.js +0 -29
- package/lib/module/utils/saveWorkoutSample.js.map +0 -1
- package/lib/module/utils/serializeDate.js +0 -3
- package/lib/module/utils/serializeDate.js.map +0 -1
- package/lib/module/utils/serializeDate.test.js +0 -14
- package/lib/module/utils/serializeDate.test.js.map +0 -1
- package/lib/module/utils/startWatchApp.js +0 -4
- package/lib/module/utils/startWatchApp.js.map +0 -1
- package/lib/module/utils/subscribeToChanges.js +0 -20
- package/lib/module/utils/subscribeToChanges.js.map +0 -1
- package/lib/typescript/example-expo/App.d.ts +0 -2
- package/lib/typescript/src/hooks/useHealthkitAuthorization.d.ts +0 -8
- package/lib/typescript/src/hooks/useHealthkitAuthorization.test.d.ts +0 -1
- package/lib/typescript/src/hooks/useIsHealthDataAvailable.d.ts +0 -7
- package/lib/typescript/src/hooks/useIsHealthDataAvailable.test.d.ts +0 -1
- package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +0 -7
- package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +0 -7
- package/lib/typescript/src/hooks/useMostRecentWorkout.d.ts +0 -10
- package/lib/typescript/src/hooks/useSources.d.ts +0 -3
- package/lib/typescript/src/hooks/useStatisticsForQuantity.d.ts +0 -4
- package/lib/typescript/src/hooks/useSubscribeToChanges.d.ts +0 -3
- package/lib/typescript/src/index.d.ts +0 -3
- package/lib/typescript/src/index.ios.d.ts +0 -198
- package/lib/typescript/src/index.native.d.ts +0 -41
- package/lib/typescript/src/index.web.d.ts +0 -3
- package/lib/typescript/src/native-types.d.ts +0 -1764
- package/lib/typescript/src/test-setup.d.ts +0 -1
- package/lib/typescript/src/test-utils.d.ts +0 -2
- package/lib/typescript/src/types.d.ts +0 -111
- package/lib/typescript/src/utils/deleteQuantitySample.d.ts +0 -4
- package/lib/typescript/src/utils/deleteSamples.d.ts +0 -8
- package/lib/typescript/src/utils/deleteWorkoutSample.d.ts +0 -3
- package/lib/typescript/src/utils/deserializeCategorySample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeCategorySample.test.d.ts +0 -1
- package/lib/typescript/src/utils/deserializeCorrelation.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeHeartbeatSeriesSample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeSample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeWorkout.d.ts +0 -4
- package/lib/typescript/src/utils/ensureMetadata.d.ts +0 -2
- package/lib/typescript/src/utils/ensureTotals.d.ts +0 -2
- package/lib/typescript/src/utils/ensureUnit.d.ts +0 -3
- package/lib/typescript/src/utils/getDateOfBirth.d.ts +0 -2
- package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +0 -4
- package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +0 -4
- package/lib/typescript/src/utils/getMostRecentWorkout.d.ts +0 -5
- package/lib/typescript/src/utils/getPreferredUnit.d.ts +0 -4
- package/lib/typescript/src/utils/getPreferredUnits.d.ts +0 -4
- package/lib/typescript/src/utils/getPreferredUnitsTyped.d.ts +0 -9
- package/lib/typescript/src/utils/getRequestStatusForAuthorization.d.ts +0 -3
- package/lib/typescript/src/utils/getWorkoutPlanById.d.ts +0 -5
- package/lib/typescript/src/utils/prepareOptions.d.ts +0 -9
- package/lib/typescript/src/utils/queryCategorySamples.d.ts +0 -5
- package/lib/typescript/src/utils/queryCategorySamplesWithAnchor.d.ts +0 -10
- package/lib/typescript/src/utils/queryCorrelationSamples.d.ts +0 -5
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamples.d.ts +0 -10
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamplesWithAnchor.d.ts +0 -10
- package/lib/typescript/src/utils/queryQuantitySamples.d.ts +0 -7
- package/lib/typescript/src/utils/queryQuantitySamplesWithAnchor.d.ts +0 -12
- package/lib/typescript/src/utils/querySources.d.ts +0 -4
- package/lib/typescript/src/utils/queryStateOfMindSamples.d.ts +0 -7
- package/lib/typescript/src/utils/queryStatisticsCollectionForQuantity.d.ts +0 -3
- package/lib/typescript/src/utils/queryStatisticsForQuantity.d.ts +0 -14
- package/lib/typescript/src/utils/queryWorkoutSamplesWithAnchor.d.ts +0 -9
- package/lib/typescript/src/utils/queryWorkouts.d.ts +0 -4
- package/lib/typescript/src/utils/requestAuthorization.d.ts +0 -4
- package/lib/typescript/src/utils/saveCategorySample.d.ts +0 -11
- package/lib/typescript/src/utils/saveCorrelationSample.d.ts +0 -8
- package/lib/typescript/src/utils/saveQuantitySample.d.ts +0 -7
- package/lib/typescript/src/utils/saveStateOfMindSample.d.ts +0 -11
- package/lib/typescript/src/utils/saveWorkoutRoute.d.ts +0 -3
- package/lib/typescript/src/utils/saveWorkoutSample.d.ts +0 -11
- package/lib/typescript/src/utils/serializeDate.d.ts +0 -2
- package/lib/typescript/src/utils/serializeDate.test.d.ts +0 -1
- package/lib/typescript/src/utils/startWatchApp.d.ts +0 -3
- package/lib/typescript/src/utils/subscribeToChanges.d.ts +0 -3
- package/src/index.ios.tsx +0 -292
- package/src/index.native.tsx +0 -233
- package/src/index.tsx +0 -5
- package/src/index.web.tsx +0 -5
- package/src/native-types.ts +0 -2471
- package/src/types.ts +0 -156
- package/src/utils/deleteQuantitySample.ts +0 -14
- package/src/utils/deleteSamples.ts +0 -23
- package/src/utils/deleteWorkoutSample.ts +0 -7
- package/src/utils/deserializeCategorySample.test.ts +0 -24
- package/src/utils/deserializeCategorySample.ts +0 -12
- package/src/utils/deserializeCorrelation.ts +0 -28
- package/src/utils/deserializeHeartbeatSeriesSample.ts +0 -12
- package/src/utils/deserializeSample.ts +0 -17
- package/src/utils/deserializeWorkout.ts +0 -14
- package/src/utils/ensureMetadata.ts +0 -5
- package/src/utils/ensureTotals.ts +0 -5
- package/src/utils/ensureUnit.ts +0 -19
- package/src/utils/getDateOfBirth.ts +0 -8
- package/src/utils/getPreferredUnits.ts +0 -14
- package/src/utils/getPreferredUnitsTyped.ts +0 -38
- package/src/utils/getRequestStatusForAuthorization.ts +0 -21
- package/src/utils/getWorkoutPlanById.ts +0 -7
- package/src/utils/prepareOptions.ts +0 -19
- package/src/utils/queryCategorySamples.ts +0 -29
- package/src/utils/queryCategorySamplesWithAnchor.ts +0 -39
- package/src/utils/queryCorrelationSamples.ts +0 -29
- package/src/utils/queryHeartbeatSeriesSamples.ts +0 -29
- package/src/utils/queryHeartbeatSeriesSamplesWithAnchor.ts +0 -33
- package/src/utils/queryQuantitySamples.ts +0 -38
- package/src/utils/queryQuantitySamplesWithAnchor.ts +0 -46
- package/src/utils/querySources.ts +0 -21
- package/src/utils/queryStateOfMindSamples.ts +0 -14
- package/src/utils/queryStatisticsCollectionForQuantity.ts +0 -38
- package/src/utils/queryStatisticsForQuantity.ts +0 -38
- package/src/utils/queryWorkoutSamplesWithAnchor.ts +0 -46
- package/src/utils/queryWorkouts.ts +0 -28
- package/src/utils/requestAuthorization.ts +0 -19
- package/src/utils/saveCategorySample.ts +0 -31
- package/src/utils/saveCorrelationSample.ts +0 -43
- package/src/utils/saveQuantitySample.ts +0 -29
- package/src/utils/saveStateOfMindSample.ts +0 -38
- package/src/utils/saveWorkoutRoute.ts +0 -21
- package/src/utils/saveWorkoutSample.ts +0 -42
- package/src/utils/serializeDate.test.ts +0 -16
- package/src/utils/serializeDate.ts +0 -5
- package/src/utils/startWatchApp.ts +0 -7
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
// !$*UTF8*$!
|
|
2
|
-
{
|
|
3
|
-
archiveVersion = 1;
|
|
4
|
-
classes = {
|
|
5
|
-
};
|
|
6
|
-
objectVersion = 46;
|
|
7
|
-
objects = {
|
|
8
|
-
|
|
9
|
-
/* Begin PBXBuildFile section */
|
|
10
|
-
F4FF95D7245B92E800C19C63 /* ReactNativeHealthkit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* ReactNativeHealthkit.swift */; };
|
|
11
|
-
/* End PBXBuildFile section */
|
|
12
|
-
|
|
13
|
-
/* Begin PBXCopyFilesBuildPhase section */
|
|
14
|
-
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
15
|
-
isa = PBXCopyFilesBuildPhase;
|
|
16
|
-
buildActionMask = 2147483647;
|
|
17
|
-
dstPath = "include/$(PRODUCT_NAME)";
|
|
18
|
-
dstSubfolderSpec = 16;
|
|
19
|
-
files = (
|
|
20
|
-
);
|
|
21
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
22
|
-
};
|
|
23
|
-
/* End PBXCopyFilesBuildPhase section */
|
|
24
|
-
|
|
25
|
-
/* Begin PBXFileReference section */
|
|
26
|
-
134814201AA4EA6300B7C361 /* libReactNativeHealthkit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeHealthkit.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
27
|
-
B3E7B5891CC2AC0600A0062D /* ReactNativeHealthkit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNativeHealthkit.m; sourceTree = "<group>"; };
|
|
28
|
-
F4FF95D5245B92E700C19C63 /* ReactNativeHealthkit-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeHealthkit-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
29
|
-
F4FF95D6245B92E800C19C63 /* ReactNativeHealthkit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactNativeHealthkit.swift; sourceTree = "<group>"; };
|
|
30
|
-
/* End PBXFileReference section */
|
|
31
|
-
|
|
32
|
-
/* Begin PBXFrameworksBuildPhase section */
|
|
33
|
-
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
34
|
-
isa = PBXFrameworksBuildPhase;
|
|
35
|
-
buildActionMask = 2147483647;
|
|
36
|
-
files = (
|
|
37
|
-
);
|
|
38
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
39
|
-
};
|
|
40
|
-
/* End PBXFrameworksBuildPhase section */
|
|
41
|
-
|
|
42
|
-
/* Begin PBXGroup section */
|
|
43
|
-
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
44
|
-
isa = PBXGroup;
|
|
45
|
-
children = (
|
|
46
|
-
134814201AA4EA6300B7C361 /* libReactNativeHealthkit.a */,
|
|
47
|
-
);
|
|
48
|
-
name = Products;
|
|
49
|
-
sourceTree = "<group>";
|
|
50
|
-
};
|
|
51
|
-
58B511D21A9E6C8500147676 = {
|
|
52
|
-
isa = PBXGroup;
|
|
53
|
-
children = (
|
|
54
|
-
F4FF95D6245B92E800C19C63 /* ReactNativeHealthkit.swift */,
|
|
55
|
-
B3E7B5891CC2AC0600A0062D /* ReactNativeHealthkit.m */,
|
|
56
|
-
F4FF95D5245B92E700C19C63 /* ReactNativeHealthkit-Bridging-Header.h */,
|
|
57
|
-
134814211AA4EA7D00B7C361 /* Products */,
|
|
58
|
-
);
|
|
59
|
-
sourceTree = "<group>";
|
|
60
|
-
};
|
|
61
|
-
/* End PBXGroup section */
|
|
62
|
-
|
|
63
|
-
/* Begin PBXNativeTarget section */
|
|
64
|
-
58B511DA1A9E6C8500147676 /* ReactNativeHealthkit */ = {
|
|
65
|
-
isa = PBXNativeTarget;
|
|
66
|
-
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNativeHealthkit" */;
|
|
67
|
-
buildPhases = (
|
|
68
|
-
58B511D71A9E6C8500147676 /* Sources */,
|
|
69
|
-
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
70
|
-
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
71
|
-
);
|
|
72
|
-
buildRules = (
|
|
73
|
-
);
|
|
74
|
-
dependencies = (
|
|
75
|
-
);
|
|
76
|
-
name = ReactNativeHealthkit;
|
|
77
|
-
productName = RCTDataManager;
|
|
78
|
-
productReference = 134814201AA4EA6300B7C361 /* libReactNativeHealthkit.a */;
|
|
79
|
-
productType = "com.apple.product-type.library.static";
|
|
80
|
-
};
|
|
81
|
-
/* End PBXNativeTarget section */
|
|
82
|
-
|
|
83
|
-
/* Begin PBXProject section */
|
|
84
|
-
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
85
|
-
isa = PBXProject;
|
|
86
|
-
attributes = {
|
|
87
|
-
LastUpgradeCheck = 0920;
|
|
88
|
-
ORGANIZATIONNAME = Facebook;
|
|
89
|
-
TargetAttributes = {
|
|
90
|
-
58B511DA1A9E6C8500147676 = {
|
|
91
|
-
CreatedOnToolsVersion = 6.1.1;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNativeHealthkit" */;
|
|
96
|
-
compatibilityVersion = "Xcode 3.2";
|
|
97
|
-
developmentRegion = English;
|
|
98
|
-
hasScannedForEncodings = 0;
|
|
99
|
-
knownRegions = (
|
|
100
|
-
English,
|
|
101
|
-
en,
|
|
102
|
-
);
|
|
103
|
-
mainGroup = 58B511D21A9E6C8500147676;
|
|
104
|
-
productRefGroup = 58B511D21A9E6C8500147676;
|
|
105
|
-
projectDirPath = "";
|
|
106
|
-
projectRoot = "";
|
|
107
|
-
targets = (
|
|
108
|
-
58B511DA1A9E6C8500147676 /* ReactNativeHealthkit */,
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
/* End PBXProject section */
|
|
112
|
-
|
|
113
|
-
/* Begin PBXSourcesBuildPhase section */
|
|
114
|
-
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
115
|
-
isa = PBXSourcesBuildPhase;
|
|
116
|
-
buildActionMask = 2147483647;
|
|
117
|
-
files = (
|
|
118
|
-
F4FF95D7245B92E800C19C63 /* ReactNativeHealthkit.swift in Sources */,
|
|
119
|
-
);
|
|
120
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
121
|
-
};
|
|
122
|
-
/* End PBXSourcesBuildPhase section */
|
|
123
|
-
|
|
124
|
-
/* Begin XCBuildConfiguration section */
|
|
125
|
-
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
126
|
-
isa = XCBuildConfiguration;
|
|
127
|
-
buildSettings = {
|
|
128
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
129
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
130
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
131
|
-
CLANG_ENABLE_MODULES = YES;
|
|
132
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
133
|
-
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
134
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
135
|
-
CLANG_WARN_COMMA = YES;
|
|
136
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
137
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
138
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
139
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
140
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
141
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
142
|
-
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
143
|
-
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
144
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
145
|
-
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
146
|
-
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
147
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
148
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
149
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
150
|
-
COPY_PHASE_STRIP = NO;
|
|
151
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
152
|
-
ENABLE_TESTABILITY = YES;
|
|
153
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
154
|
-
GCC_DYNAMIC_NO_PIC = NO;
|
|
155
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
156
|
-
GCC_OPTIMIZATION_LEVEL = 0;
|
|
157
|
-
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
158
|
-
"DEBUG=1",
|
|
159
|
-
"$(inherited)",
|
|
160
|
-
);
|
|
161
|
-
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
162
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
163
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
164
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
165
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
166
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
167
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
168
|
-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
|
169
|
-
MTL_ENABLE_DEBUG_INFO = YES;
|
|
170
|
-
ONLY_ACTIVE_ARCH = YES;
|
|
171
|
-
SDKROOT = iphoneos;
|
|
172
|
-
};
|
|
173
|
-
name = Debug;
|
|
174
|
-
};
|
|
175
|
-
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
176
|
-
isa = XCBuildConfiguration;
|
|
177
|
-
buildSettings = {
|
|
178
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
179
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
180
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
181
|
-
CLANG_ENABLE_MODULES = YES;
|
|
182
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
183
|
-
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
184
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
185
|
-
CLANG_WARN_COMMA = YES;
|
|
186
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
187
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
188
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
189
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
190
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
191
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
192
|
-
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
193
|
-
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
194
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
195
|
-
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
196
|
-
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
197
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
198
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
199
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
200
|
-
COPY_PHASE_STRIP = YES;
|
|
201
|
-
ENABLE_NS_ASSERTIONS = NO;
|
|
202
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
203
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
204
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
205
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
206
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
207
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
208
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
209
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
210
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
211
|
-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
|
212
|
-
MTL_ENABLE_DEBUG_INFO = NO;
|
|
213
|
-
SDKROOT = iphoneos;
|
|
214
|
-
VALIDATE_PRODUCT = YES;
|
|
215
|
-
};
|
|
216
|
-
name = Release;
|
|
217
|
-
};
|
|
218
|
-
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
219
|
-
isa = XCBuildConfiguration;
|
|
220
|
-
buildSettings = {
|
|
221
|
-
HEADER_SEARCH_PATHS = (
|
|
222
|
-
"$(inherited)",
|
|
223
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
224
|
-
"$(SRCROOT)/../../../React/**",
|
|
225
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
226
|
-
);
|
|
227
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
228
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
229
|
-
PRODUCT_NAME = ReactNativeHealthkit;
|
|
230
|
-
SKIP_INSTALL = YES;
|
|
231
|
-
SWIFT_OBJC_BRIDGING_HEADER = "ReactNativeHealthkit-Bridging-Header.h";
|
|
232
|
-
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
233
|
-
SWIFT_VERSION = 5.0;
|
|
234
|
-
};
|
|
235
|
-
name = Debug;
|
|
236
|
-
};
|
|
237
|
-
58B511F11A9E6C8500147676 /* Release */ = {
|
|
238
|
-
isa = XCBuildConfiguration;
|
|
239
|
-
buildSettings = {
|
|
240
|
-
HEADER_SEARCH_PATHS = (
|
|
241
|
-
"$(inherited)",
|
|
242
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
243
|
-
"$(SRCROOT)/../../../React/**",
|
|
244
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
245
|
-
);
|
|
246
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
247
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
248
|
-
PRODUCT_NAME = ReactNativeHealthkit;
|
|
249
|
-
SKIP_INSTALL = YES;
|
|
250
|
-
SWIFT_OBJC_BRIDGING_HEADER = "ReactNativeHealthkit-Bridging-Header.h";
|
|
251
|
-
SWIFT_VERSION = 5.0;
|
|
252
|
-
};
|
|
253
|
-
name = Release;
|
|
254
|
-
};
|
|
255
|
-
/* End XCBuildConfiguration section */
|
|
256
|
-
|
|
257
|
-
/* Begin XCConfigurationList section */
|
|
258
|
-
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNativeHealthkit" */ = {
|
|
259
|
-
isa = XCConfigurationList;
|
|
260
|
-
buildConfigurations = (
|
|
261
|
-
58B511ED1A9E6C8500147676 /* Debug */,
|
|
262
|
-
58B511EE1A9E6C8500147676 /* Release */,
|
|
263
|
-
);
|
|
264
|
-
defaultConfigurationIsVisible = 0;
|
|
265
|
-
defaultConfigurationName = Release;
|
|
266
|
-
};
|
|
267
|
-
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNativeHealthkit" */ = {
|
|
268
|
-
isa = XCConfigurationList;
|
|
269
|
-
buildConfigurations = (
|
|
270
|
-
58B511F01A9E6C8500147676 /* Debug */,
|
|
271
|
-
58B511F11A9E6C8500147676 /* Release */,
|
|
272
|
-
);
|
|
273
|
-
defaultConfigurationIsVisible = 0;
|
|
274
|
-
defaultConfigurationName = Release;
|
|
275
|
-
};
|
|
276
|
-
/* End XCConfigurationList section */
|
|
277
|
-
};
|
|
278
|
-
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
279
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "kingstinct-react-native-healthkit"
|
|
7
|
-
s.version = package["version"]
|
|
8
|
-
s.summary = package["description"]
|
|
9
|
-
s.homepage = package["homepage"]
|
|
10
|
-
s.license = package["license"]
|
|
11
|
-
s.authors = package["author"]
|
|
12
|
-
|
|
13
|
-
s.platforms = { :ios => "10.0" }
|
|
14
|
-
s.source = { :git => "https://github.com/kingstinct/react-native-healthkit.git", :tag => "#{s.version}" }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
s.dependency "React"
|
|
21
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _getRequestStatusForAuthorization = _interopRequireDefault(require("../utils/getRequestStatusForAuthorization"));
|
|
9
|
-
var _requestAuthorization = _interopRequireDefault(require("../utils/requestAuthorization"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.
|
|
13
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}
|
|
14
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
|
|
15
|
-
*/
|
|
16
|
-
const useHealthkitAuthorization = (read, write) => {
|
|
17
|
-
const [status, setStatus] = (0, _react.useState)(null);
|
|
18
|
-
const readMemo = (0, _react.useRef)(read);
|
|
19
|
-
const writeMemo = (0, _react.useRef)(write);
|
|
20
|
-
(0, _react.useEffect)(() => {
|
|
21
|
-
readMemo.current = read;
|
|
22
|
-
writeMemo.current = write;
|
|
23
|
-
}, [read, write]);
|
|
24
|
-
const refreshAuthStatus = (0, _react.useCallback)(async () => {
|
|
25
|
-
const auth = await (0, _getRequestStatusForAuthorization.default)(readMemo.current, writeMemo.current);
|
|
26
|
-
setStatus(auth);
|
|
27
|
-
return auth;
|
|
28
|
-
}, []);
|
|
29
|
-
const request = (0, _react.useCallback)(async () => {
|
|
30
|
-
await (0, _requestAuthorization.default)(readMemo.current, writeMemo.current);
|
|
31
|
-
return refreshAuthStatus();
|
|
32
|
-
}, [refreshAuthStatus]);
|
|
33
|
-
(0, _react.useEffect)(() => {
|
|
34
|
-
void refreshAuthStatus();
|
|
35
|
-
}, [refreshAuthStatus]);
|
|
36
|
-
return [status, request];
|
|
37
|
-
};
|
|
38
|
-
var _default = exports.default = useHealthkitAuthorization;
|
|
39
|
-
//# sourceMappingURL=useHealthkitAuthorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_getRequestStatusForAuthorization","_interopRequireDefault","_requestAuthorization","e","__esModule","default","useHealthkitAuthorization","read","write","status","setStatus","useState","readMemo","useRef","writeMemo","useEffect","current","refreshAuthStatus","useCallback","auth","getRequestStatusForAuthorization","request","requestAuthorization","_default","exports"],"sources":["useHealthkitAuthorization.ts"],"sourcesContent":["import {\n useCallback, useEffect, useRef, useState,\n} from 'react'\n\nimport getRequestStatusForAuthorization from '../utils/getRequestStatusForAuthorization'\nimport requestAuthorization from '../utils/requestAuthorization'\n\nimport type { HealthkitReadAuthorization, HealthkitWriteAuthorization, HKAuthorizationRequestStatus } from '../native-types'\n\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 */\nconst useHealthkitAuthorization = (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => {\n const [status, setStatus] = useState<HKAuthorizationRequestStatus | null>(null)\n\n const readMemo = useRef(read)\n const writeMemo = useRef(write)\n\n useEffect(() => {\n readMemo.current = read\n writeMemo.current = write\n }, [read, write])\n\n const refreshAuthStatus = useCallback(async () => {\n const auth = await getRequestStatusForAuthorization(readMemo.current, writeMemo.current)\n\n setStatus(auth)\n return auth\n }, [])\n\n const request = useCallback(async () => {\n await requestAuthorization(readMemo.current, writeMemo.current)\n return refreshAuthStatus()\n }, [refreshAuthStatus])\n\n useEffect(() => {\n void refreshAuthStatus()\n }, [refreshAuthStatus])\n\n return [status, request] as const\n}\n\nexport default useHealthkitAuthorization\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,iCAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAgE,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIhE;AACA;AACA;AACA;AACA;AACA,MAAMG,yBAAyB,GAAGA,CAACC,IAA2C,EAAEC,KAA8C,KAAK;EACjI,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAsC,IAAI,CAAC;EAE/E,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACN,IAAI,CAAC;EAC7B,MAAMO,SAAS,GAAG,IAAAD,aAAM,EAACL,KAAK,CAAC;EAE/B,IAAAO,gBAAS,EAAC,MAAM;IACdH,QAAQ,CAACI,OAAO,GAAGT,IAAI;IACvBO,SAAS,CAACE,OAAO,GAAGR,KAAK;EAC3B,CAAC,EAAE,CAACD,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,MAAMS,iBAAiB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAChD,MAAMC,IAAI,GAAG,MAAM,IAAAC,yCAAgC,EAACR,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAExFN,SAAS,CAACS,IAAI,CAAC;IACf,OAAOA,IAAI;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,OAAO,GAAG,IAAAH,kBAAW,EAAC,YAAY;IACtC,MAAM,IAAAI,6BAAoB,EAACV,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAC/D,OAAOC,iBAAiB,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,IAAAF,gBAAS,EAAC,MAAM;IACd,KAAKE,iBAAiB,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,OAAO,CAACR,MAAM,EAAEY,OAAO,CAAC;AAC1B,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEcC,yBAAyB","ignoreList":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _reactNative = require("@testing-library/react-native");
|
|
4
|
-
var _testUtils = _interopRequireDefault(require("../test-utils"));
|
|
5
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
7
|
-
describe('useHealthkitAuthorization', () => {
|
|
8
|
-
let NativeTypes;
|
|
9
|
-
let useHealthkitAuthorization;
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
NativeTypes = await Promise.resolve().then(() => _interopRequireWildcard(require('../native-types')));
|
|
12
|
-
useHealthkitAuthorization = (await Promise.resolve().then(() => _interopRequireWildcard(require('./useHealthkitAuthorization')))).default;
|
|
13
|
-
});
|
|
14
|
-
test('should return shouldRequest', async () => {
|
|
15
|
-
const {
|
|
16
|
-
HKAuthorizationRequestStatus,
|
|
17
|
-
HKCategoryTypeIdentifier,
|
|
18
|
-
default: Native
|
|
19
|
-
} = NativeTypes;
|
|
20
|
-
jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.shouldRequest));
|
|
21
|
-
const {
|
|
22
|
-
result
|
|
23
|
-
} = (0, _reactNative.renderHook)(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]));
|
|
24
|
-
await (0, _testUtils.default)();
|
|
25
|
-
expect(result.current[0]).toBe(HKAuthorizationRequestStatus.shouldRequest);
|
|
26
|
-
});
|
|
27
|
-
test('should request permissions', async () => {
|
|
28
|
-
const {
|
|
29
|
-
HKAuthorizationRequestStatus,
|
|
30
|
-
HKCategoryTypeIdentifier,
|
|
31
|
-
default: Native
|
|
32
|
-
} = NativeTypes;
|
|
33
|
-
const spy = jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.shouldRequest));
|
|
34
|
-
jest.spyOn(Native, 'requestAuthorization').mockReturnValue(Promise.resolve(true));
|
|
35
|
-
const {
|
|
36
|
-
result
|
|
37
|
-
} = (0, _reactNative.renderHook)(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]));
|
|
38
|
-
await (0, _testUtils.default)();
|
|
39
|
-
spy.mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.unnecessary));
|
|
40
|
-
let retVal;
|
|
41
|
-
await (0, _reactNative.act)(async () => {
|
|
42
|
-
const r = await result.current[1]();
|
|
43
|
-
retVal = r;
|
|
44
|
-
});
|
|
45
|
-
expect(result.current[0]).toBe(HKAuthorizationRequestStatus.unnecessary);
|
|
46
|
-
expect(retVal).toBe(HKAuthorizationRequestStatus.unnecessary);
|
|
47
|
-
});
|
|
48
|
-
test('should return unnecessary', async () => {
|
|
49
|
-
const {
|
|
50
|
-
HKAuthorizationRequestStatus,
|
|
51
|
-
HKCategoryTypeIdentifier,
|
|
52
|
-
default: Native
|
|
53
|
-
} = NativeTypes;
|
|
54
|
-
jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.unnecessary));
|
|
55
|
-
const {
|
|
56
|
-
result
|
|
57
|
-
} = (0, _reactNative.renderHook)(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]));
|
|
58
|
-
await (0, _testUtils.default)();
|
|
59
|
-
expect(result.current[0]).toBe(HKAuthorizationRequestStatus.unnecessary);
|
|
60
|
-
});
|
|
61
|
-
test('should return null before initalizing', async () => {
|
|
62
|
-
const {
|
|
63
|
-
HKCategoryTypeIdentifier
|
|
64
|
-
} = NativeTypes;
|
|
65
|
-
const {
|
|
66
|
-
result
|
|
67
|
-
} = (0, _reactNative.renderHook)(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]));
|
|
68
|
-
expect(result.current[0]).toBe(null);
|
|
69
|
-
await (0, _testUtils.default)();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=useHealthkitAuthorization.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_testUtils","_interopRequireDefault","e","__esModule","default","_interopRequireWildcard","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","describe","NativeTypes","useHealthkitAuthorization","beforeAll","Promise","resolve","then","test","HKAuthorizationRequestStatus","HKCategoryTypeIdentifier","Native","jest","spyOn","mockReturnValue","shouldRequest","result","renderHook","abdominalCramps","waitForNextUpdate","expect","current","toBe","spy","unnecessary","retVal","act"],"sources":["useHealthkitAuthorization.test.ts"],"sourcesContent":["import { renderHook, act } from '@testing-library/react-native'\n\nimport waitForNextUpdate from '../test-utils'\n\ndescribe('useHealthkitAuthorization', () => {\n let NativeTypes: typeof import('../native-types')\n let useHealthkitAuthorization: typeof import('./useHealthkitAuthorization').default\n beforeAll(async () => {\n NativeTypes = await import('../native-types')\n useHealthkitAuthorization = (await import('./useHealthkitAuthorization')).default\n })\n\n test('should return shouldRequest', async () => {\n const { HKAuthorizationRequestStatus, HKCategoryTypeIdentifier, default: Native } = NativeTypes\n\n jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.shouldRequest))\n\n const { result } = renderHook(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]))\n\n await waitForNextUpdate()\n\n expect(result.current[0]).toBe(HKAuthorizationRequestStatus.shouldRequest)\n })\n\n test('should request permissions', async () => {\n const { HKAuthorizationRequestStatus, HKCategoryTypeIdentifier, default: Native } = NativeTypes\n\n const spy = jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.shouldRequest))\n jest.spyOn(Native, 'requestAuthorization').mockReturnValue(Promise.resolve(true))\n\n const { result } = renderHook(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]))\n\n await waitForNextUpdate()\n\n spy.mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.unnecessary))\n\n let retVal: typeof HKAuthorizationRequestStatus | undefined\n await act(async () => {\n const r = await result.current[1]() as unknown as typeof HKAuthorizationRequestStatus\n retVal = r\n })\n\n expect(result.current[0]).toBe(HKAuthorizationRequestStatus.unnecessary)\n expect(retVal).toBe(HKAuthorizationRequestStatus.unnecessary)\n })\n\n test('should return unnecessary', async () => {\n const { HKAuthorizationRequestStatus, HKCategoryTypeIdentifier, default: Native } = NativeTypes\n\n jest.spyOn(Native, 'getRequestStatusForAuthorization').mockReturnValue(Promise.resolve(HKAuthorizationRequestStatus.unnecessary))\n\n const { result } = renderHook(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]))\n\n await waitForNextUpdate()\n\n expect(result.current[0]).toBe(HKAuthorizationRequestStatus.unnecessary)\n })\n\n test('should return null before initalizing', async () => {\n const { HKCategoryTypeIdentifier } = NativeTypes\n\n const { result } = renderHook(() => useHealthkitAuthorization([HKCategoryTypeIdentifier.abdominalCramps]))\n\n expect(result.current[0]).toBe(null)\n\n await waitForNextUpdate()\n })\n})\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6C,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,wBAAAH,CAAA,EAAAI,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,uBAAA,YAAAA,CAAAH,CAAA,EAAAI,CAAA,SAAAA,CAAA,IAAAJ,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAQ,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAT,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAU,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAZ,CAAA,UAAAQ,CAAA,CAAAK,GAAA,CAAAb,CAAA,GAAAQ,CAAA,CAAAM,GAAA,CAAAd,CAAA,EAAAU,CAAA,gBAAAN,CAAA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AwB;MAAE3B,OAAO,EAAE4B;IAAO,CAAC,GAAGT,WAAW;IAE/FU,IAAI,CAACC,KAAK,CAACF,MAAM,EAAE,kCAAkC,CAAC,CAACG,eAAe,CAACT,OAAO,CAACC,OAAO,CAACG,4BAA4B,CAACe,WAAW,CAAC,CAAC;IAEjI,MAAM;MAAER;IAAO,CAAC,GAAG,IAAAC,uBAAU,EAAC,MAAMd,yBAAyB,CAAC,CAACO,wBAAwB,CAACQ,eAAe,CAAC,CAAC,CAAC;IAE1G,MAAM,IAAAC,kBAAiB,EAAC,CAAC;IAEzBC,MAAM,CAACJ,MAAM,CAACK,OAAO,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAACb,4BAA4B,CAACe,WAAW,CAAC;EAC1E,CAAC,CAAC;EAEFhB,IAAI,CAAC,uCAAuC,EAAE,YAAY;IACxD,MAAM;MAAEE;IAAyB,CAAC,GAAGR,WAAW;IAEhD,MAAM;MAAEc;IAAO,CAAC,GAAG,IAAAC,uBAAU,EAAC,MAAMd,yBAAyB,CAAC,CAACO,wBAAwB,CAACQ,eAAe,CAAC,CAAC,CAAC;IAE1GE,MAAM,CAACJ,MAAM,CAACK,OAAO,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;IAEpC,MAAM,IAAAH,kBAAiB,EAAC,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _nativeTypes = _interopRequireDefault(require("../native-types"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
* @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.
|
|
12
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple HealthKit isHealthDataAvailable}
|
|
13
|
-
* @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.
|
|
14
|
-
*/
|
|
15
|
-
const useIsHealthDataAvailable = () => {
|
|
16
|
-
const [isAvailable, setIsAvailable] = (0, _react.useState)(null);
|
|
17
|
-
(0, _react.useEffect)(() => {
|
|
18
|
-
const init = async () => {
|
|
19
|
-
const res = await _nativeTypes.default.isHealthDataAvailable();
|
|
20
|
-
setIsAvailable(res);
|
|
21
|
-
};
|
|
22
|
-
void init();
|
|
23
|
-
}, []);
|
|
24
|
-
return isAvailable;
|
|
25
|
-
};
|
|
26
|
-
var _default = exports.default = useIsHealthDataAvailable;
|
|
27
|
-
//# sourceMappingURL=useIsHealthDataAvailable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_nativeTypes","_interopRequireDefault","e","__esModule","default","useIsHealthDataAvailable","isAvailable","setIsAvailable","useState","useEffect","init","res","Native","isHealthDataAvailable","_default","exports"],"sources":["useIsHealthDataAvailable.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport Native from '../native-types'\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 Apple HealthKit isHealthDataAvailable}\n* @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n*/\nconst useIsHealthDataAvailable = (): boolean | null => {\n const [isAvailable, setIsAvailable] = useState<boolean | null>(null)\n\n useEffect(() => {\n const init = async () => {\n const res = await Native.isHealthDataAvailable()\n setIsAvailable(res)\n }\n void init()\n }, [])\n\n return isAvailable\n}\n\nexport default useIsHealthDataAvailable\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC;AACA;AACA;AACA;AACA;AACA,MAAMG,wBAAwB,GAAGA,CAAA,KAAsB;EACrD,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAAiB,IAAI,CAAC;EAEpE,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,IAAI,GAAG,MAAAA,CAAA,KAAY;MACvB,MAAMC,GAAG,GAAG,MAAMC,oBAAM,CAACC,qBAAqB,CAAC,CAAC;MAChDN,cAAc,CAACI,GAAG,CAAC;IACrB,CAAC;IACD,KAAKD,IAAI,CAAC,CAAC;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOJ,WAAW;AACpB,CAAC;AAAA,IAAAQ,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEcC,wBAAwB","ignoreList":[]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _reactNative = require("@testing-library/react-native");
|
|
4
|
-
var _testUtils = _interopRequireDefault(require("../test-utils"));
|
|
5
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
7
|
-
describe('useIsHealthDataAvailable', () => {
|
|
8
|
-
test('should return false', async () => {
|
|
9
|
-
const useIsHealthDataAvailable = (await Promise.resolve().then(() => _interopRequireWildcard(require('./useIsHealthDataAvailable')))).default;
|
|
10
|
-
const {
|
|
11
|
-
default: Native
|
|
12
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('../native-types')));
|
|
13
|
-
jest.spyOn(Native, 'isHealthDataAvailable').mockReturnValue(Promise.resolve(false));
|
|
14
|
-
const {
|
|
15
|
-
result
|
|
16
|
-
} = (0, _reactNative.renderHook)(useIsHealthDataAvailable);
|
|
17
|
-
await (0, _testUtils.default)();
|
|
18
|
-
expect(result.current).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
test('should return true', async () => {
|
|
21
|
-
const useIsHealthDataAvailable = (await Promise.resolve().then(() => _interopRequireWildcard(require('./useIsHealthDataAvailable')))).default;
|
|
22
|
-
const {
|
|
23
|
-
default: Native
|
|
24
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('../native-types')));
|
|
25
|
-
jest.spyOn(Native, 'isHealthDataAvailable').mockReturnValue(Promise.resolve(true));
|
|
26
|
-
const {
|
|
27
|
-
result
|
|
28
|
-
} = (0, _reactNative.renderHook)(useIsHealthDataAvailable);
|
|
29
|
-
await (0, _testUtils.default)();
|
|
30
|
-
expect(result.current).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
test('should return null before initalizing', async () => {
|
|
33
|
-
const useIsHealthDataAvailable = (await Promise.resolve().then(() => _interopRequireWildcard(require('./useIsHealthDataAvailable')))).default;
|
|
34
|
-
const {
|
|
35
|
-
result
|
|
36
|
-
} = (0, _reactNative.renderHook)(useIsHealthDataAvailable);
|
|
37
|
-
expect(result.current).toBe(null);
|
|
38
|
-
await (0, _testUtils.default)();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=useIsHealthDataAvailable.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_testUtils","_interopRequireDefault","e","__esModule","default","_interopRequireWildcard","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","describe","test","useIsHealthDataAvailable","Promise","resolve","then","Native","jest","spyOn","mockReturnValue","result","renderHook","waitForNextUpdate","expect","current","toBe"],"sources":["useIsHealthDataAvailable.test.ts"],"sourcesContent":["import { renderHook } from '@testing-library/react-native'\n\nimport waitForNextUpdate from '../test-utils'\n\ndescribe('useIsHealthDataAvailable', () => {\n test('should return false', async () => {\n const useIsHealthDataAvailable = (await import('./useIsHealthDataAvailable')).default\n const { default: Native } = await import('../native-types')\n jest.spyOn(Native, 'isHealthDataAvailable').mockReturnValue(Promise.resolve(false))\n\n const { result } = renderHook(useIsHealthDataAvailable)\n\n await waitForNextUpdate()\n\n expect(result.current).toBe(false)\n })\n\n test('should return true', async () => {\n const useIsHealthDataAvailable = (await import('./useIsHealthDataAvailable')).default\n const { default: Native } = await import('../native-types')\n jest.spyOn(Native, 'isHealthDataAvailable').mockReturnValue(Promise.resolve(true))\n\n const { result } = renderHook(useIsHealthDataAvailable)\n\n await waitForNextUpdate()\n\n expect(result.current).toBe(true)\n })\n\n test('should return null before initalizing', async () => {\n const useIsHealthDataAvailable = (await import('./useIsHealthDataAvailable')).default\n const { result } = renderHook(useIsHealthDataAvailable)\n\n expect(result.current).toBe(null)\n\n await waitForNextUpdate()\n })\n})\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6C,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,wBAAAH,CAAA,EAAAI,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,uBAAA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,IAAI,CAAC,IAAI,CAAC;IAEjC,MAAM,IAAAH,kBAAiB,EAAC,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _useSubscribeToChanges = _interopRequireDefault(require("./useSubscribeToChanges"));
|
|
9
|
-
var _getMostRecentCategorySample = _interopRequireDefault(require("../utils/getMostRecentCategorySample"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* @returns the most recent sample for the given category type.
|
|
13
|
-
*/
|
|
14
|
-
function useMostRecentCategorySample(identifier) {
|
|
15
|
-
const [category, setCategory] = (0, _react.useState)(null);
|
|
16
|
-
const updater = (0, _react.useCallback)(() => {
|
|
17
|
-
void (0, _getMostRecentCategorySample.default)(identifier).then(setCategory);
|
|
18
|
-
}, [identifier]);
|
|
19
|
-
(0, _useSubscribeToChanges.default)(identifier, updater);
|
|
20
|
-
return category;
|
|
21
|
-
}
|
|
22
|
-
var _default = exports.default = useMostRecentCategorySample;
|
|
23
|
-
//# sourceMappingURL=useMostRecentCategorySample.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_useSubscribeToChanges","_interopRequireDefault","_getMostRecentCategorySample","e","__esModule","default","useMostRecentCategorySample","identifier","category","setCategory","useState","updater","useCallback","getMostRecentCategorySample","then","useSubscribeToChanges","_default","exports"],"sources":["useMostRecentCategorySample.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nimport useSubscribeToChanges from './useSubscribeToChanges'\nimport getMostRecentCategorySample from '../utils/getMostRecentCategorySample'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\n/**\n * @returns the most recent sample for the given category type.\n */\nfunction useMostRecentCategorySample<\n TCategory extends HKCategoryTypeIdentifier\n>(identifier: TCategory) {\n const [category, setCategory] = useState<HKCategorySample<TCategory> | null>(\n null,\n )\n const updater = useCallback(() => {\n void getMostRecentCategorySample(identifier).then(setCategory)\n }, [identifier])\n\n useSubscribeToChanges(identifier, updater)\n\n return category\n}\n\nexport default useMostRecentCategorySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8E,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK9E;AACA;AACA;AACA,SAASG,2BAA2BA,CAElCC,UAAqB,EAAE;EACvB,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EACtC,IACF,CAAC;EACD,MAAMC,OAAO,GAAG,IAAAC,kBAAW,EAAC,MAAM;IAChC,KAAK,IAAAC,oCAA2B,EAACN,UAAU,CAAC,CAACO,IAAI,CAACL,WAAW,CAAC;EAChE,CAAC,EAAE,CAACF,UAAU,CAAC,CAAC;EAEhB,IAAAQ,8BAAqB,EAACR,UAAU,EAAEI,OAAO,CAAC;EAE1C,OAAOH,QAAQ;AACjB;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEcC,2BAA2B","ignoreList":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _ensureUnit = _interopRequireDefault(require("../utils/ensureUnit"));
|
|
9
|
-
var _getMostRecentQuantitySample = _interopRequireDefault(require("../utils/getMostRecentQuantitySample"));
|
|
10
|
-
var _subscribeToChanges = _interopRequireDefault(require("../utils/subscribeToChanges"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
/**
|
|
13
|
-
* @returns the most recent sample for the given quantity type.
|
|
14
|
-
*/
|
|
15
|
-
function useMostRecentQuantitySample(identifier, unit) {
|
|
16
|
-
const [lastSample, setLastSample] = (0, _react.useState)(null);
|
|
17
|
-
(0, _react.useEffect)(() => {
|
|
18
|
-
let cancelSubscription;
|
|
19
|
-
const init = async () => {
|
|
20
|
-
const actualUnit = await (0, _ensureUnit.default)(identifier, unit);
|
|
21
|
-
const value = await (0, _getMostRecentQuantitySample.default)(identifier, actualUnit);
|
|
22
|
-
setLastSample(value);
|
|
23
|
-
cancelSubscription = await (0, _subscribeToChanges.default)(identifier, async () => {
|
|
24
|
-
const value = await (0, _getMostRecentQuantitySample.default)(identifier, actualUnit);
|
|
25
|
-
setLastSample(value);
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
void init();
|
|
29
|
-
return () => {
|
|
30
|
-
var _cancelSubscription;
|
|
31
|
-
void ((_cancelSubscription = cancelSubscription) === null || _cancelSubscription === void 0 ? void 0 : _cancelSubscription());
|
|
32
|
-
};
|
|
33
|
-
}, [identifier, unit]);
|
|
34
|
-
return lastSample;
|
|
35
|
-
}
|
|
36
|
-
var _default = exports.default = useMostRecentQuantitySample;
|
|
37
|
-
//# sourceMappingURL=useMostRecentQuantitySample.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_ensureUnit","_interopRequireDefault","_getMostRecentQuantitySample","_subscribeToChanges","e","__esModule","default","useMostRecentQuantitySample","identifier","unit","lastSample","setLastSample","useState","useEffect","cancelSubscription","init","actualUnit","ensureUnit","value","getMostRecentQuantitySample","subscribeToChanges","_cancelSubscription","_default","exports"],"sources":["useMostRecentQuantitySample.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport ensureUnit from '../utils/ensureUnit'\nimport getMostRecentQuantitySample from '../utils/getMostRecentQuantitySample'\nimport subscribeToChanges from '../utils/subscribeToChanges'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\n/**\n * @returns the most recent sample for the given quantity type.\n */\nfunction useMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(identifier: TIdentifier, unit?: TUnit) {\n const [lastSample, setLastSample] = useState<HKQuantitySample<\n TIdentifier\n > | null>(null)\n\n useEffect(() => {\n let cancelSubscription: (() => Promise<boolean>) | undefined\n\n const init = async () => {\n const actualUnit = await ensureUnit(identifier, unit)\n\n const value = await getMostRecentQuantitySample(identifier, actualUnit)\n setLastSample(value)\n\n cancelSubscription = await subscribeToChanges(identifier, async () => {\n const value = await getMostRecentQuantitySample(identifier, actualUnit)\n setLastSample(value)\n })\n }\n void init()\n\n return () => {\n void cancelSubscription?.()\n }\n }, [identifier, unit])\n\n return lastSample\n}\n\nexport default useMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA4D,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK5D;AACA;AACA;AACA,SAASG,2BAA2BA,CAGlCC,UAAuB,EAAEC,IAAY,EAAE;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAElC,IAAI,CAAC;EAEf,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIC,kBA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