@kingstinct/react-native-healthkit 12.1.2 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/CategoryTypeModule.swift +49 -97
- package/ios/CharacteristicTypeModule.swift +77 -63
- package/ios/CoreModule.swift +324 -280
- package/ios/CorrelationTypeModule.swift +192 -144
- package/ios/ElectrocardiogramModule.swift +185 -194
- package/ios/HeartbeatSeriesModule.swift +123 -171
- package/ios/Helpers.swift +312 -571
- package/ios/MedicationModule.swift +259 -0
- package/ios/PredicateHelpers.swift +334 -0
- package/ios/QuantityTypeModule.swift +297 -378
- package/ios/Serializers.swift +273 -210
- package/ios/SourceProxy.swift +2 -2
- package/ios/StateOfMindModule.swift +179 -125
- package/ios/WorkoutProxy.swift +235 -112
- package/ios/WorkoutsModule.swift +214 -262
- package/lib/commonjs/healthkit.ios.js +22 -2
- package/lib/commonjs/healthkit.js +35 -5
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -1
- package/lib/commonjs/hooks/useSubscribeToCategorySamples.js +20 -0
- package/lib/commonjs/modules.js +2 -1
- package/lib/commonjs/specs/MedicationModule.nitro.js +27 -0
- package/lib/commonjs/types/Constants.js +2 -1
- package/lib/commonjs/types/QuantityType.js +8 -1
- package/lib/commonjs/types/QueryOptions.js +18 -0
- package/lib/commonjs/types/WeatherCondition.js +32 -32
- package/lib/commonjs/types/Workouts.js +1 -50
- package/lib/commonjs/utils/getCategorySampleById.js +1 -1
- package/lib/commonjs/utils/getQuantitySampleById.js +1 -1
- package/lib/commonjs/utils/getWorkoutById.js +1 -1
- package/lib/commonjs/utils/subscribeToCategorySamples.js +29 -0
- package/lib/commonjs/utils/subscribeToQuantitySamples.js +8 -25
- package/lib/module/healthkit.ios.js +20 -2
- package/lib/module/healthkit.js +32 -2
- package/lib/module/hooks/useStatisticsForQuantity.js +1 -1
- package/lib/module/hooks/useSubscribeToCategorySamples.js +17 -0
- package/lib/module/modules.js +1 -0
- package/lib/module/specs/MedicationModule.nitro.js +26 -0
- package/lib/module/types/Constants.js +1 -0
- package/lib/module/types/QuantityType.js +7 -0
- package/lib/module/types/QueryOptions.js +17 -1
- package/lib/module/types/WeatherCondition.js +31 -31
- package/lib/module/types/Workouts.js +0 -49
- package/lib/module/utils/getCategorySampleById.js +1 -1
- package/lib/module/utils/getQuantitySampleById.js +1 -1
- package/lib/module/utils/getWorkoutById.js +1 -1
- package/lib/module/utils/subscribeToCategorySamples.js +26 -0
- package/lib/module/utils/subscribeToQuantitySamples.js +8 -25
- package/lib/typescript/healthkit.d.ts +18 -9
- package/lib/typescript/healthkit.ios.d.ts +33 -15
- package/lib/typescript/hooks/useSubscribeToCategorySamples.d.ts +3 -0
- package/lib/typescript/modules.d.ts +2 -0
- package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +2 -2
- package/lib/typescript/specs/CoreModule.nitro.d.ts +2 -1
- package/lib/typescript/specs/CorrelationTypeModule.nitro.d.ts +4 -2
- package/lib/typescript/specs/ElectrocardiogramModule.nitro.d.ts +1 -1
- package/lib/typescript/specs/HeartbeatSeriesModule.nitro.d.ts +1 -1
- package/lib/typescript/specs/MedicationModule.nitro.d.ts +56 -0
- package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +4 -4
- package/lib/typescript/specs/StateOfMindModule.nitro.d.ts +4 -3
- package/lib/typescript/types/CategoryType.d.ts +10 -20
- package/lib/typescript/types/Constants.d.ts +1 -0
- package/lib/typescript/types/CorrelationType.d.ts +8 -10
- package/lib/typescript/types/ElectrocardiogramSample.d.ts +2 -12
- package/lib/typescript/types/HeartbeatSeries.d.ts +2 -14
- package/lib/typescript/types/QuantitySample.d.ts +2 -8
- package/lib/typescript/types/QuantityType.d.ts +7 -8
- package/lib/typescript/types/QuantityTypeIdentifier.d.ts +23 -23
- package/lib/typescript/types/QueryOptions.d.ts +43 -28
- package/lib/typescript/types/Shared.d.ts +52 -7
- package/lib/typescript/types/StateOfMind.d.ts +7 -10
- package/lib/typescript/types/Subscriptions.d.ts +12 -3
- package/lib/typescript/types/WeatherCondition.d.ts +1 -1
- package/lib/typescript/types/Workouts.d.ts +28 -81
- package/lib/typescript/utils/subscribeToCategorySamples.d.ts +5 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +592 -389
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +65 -30
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +8 -0
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +15 -0
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +32 -26
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +36 -37
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +55 -2
- package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +36 -30
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +35 -29
- package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +181 -0
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +48 -42
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +59 -36
- package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +150 -29
- package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +13 -28
- package/nitrogen/generated/ios/swift/AggregationStyle.swift +48 -0
- package/nitrogen/generated/ios/swift/CategorySample.swift +571 -24
- package/nitrogen/generated/ios/swift/ComparisonPredicateOperator.swift +2 -2
- package/nitrogen/generated/ios/swift/CorrelationSample.swift +640 -17
- package/nitrogen/generated/ios/swift/{PredicateWithStartAndEnd.swift → DateFilter.swift} +5 -5
- package/nitrogen/generated/ios/swift/ECGQueryOptionsWithAnchor.swift +11 -91
- package/nitrogen/generated/ios/swift/ECGQueryOptionsWithSortOrder.swift +11 -91
- package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +570 -72
- package/nitrogen/generated/ios/swift/FilterForSamples.swift +349 -12
- package/nitrogen/generated/ios/swift/FilterForSamplesBase.swift +234 -0
- package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +366 -0
- package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +240 -0
- package/nitrogen/generated/ios/swift/Func_void_MedicationDoseEventsWithAnchorResponse.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryCorrelationSamplesWithAnchorResponse.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_StateOfMindSamplesWithAnchorResponse.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_MedicationDoseEvent_.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UserAnnotatedMedication_.swift +47 -0
- package/nitrogen/generated/ios/swift/GeneralForm.swift +104 -0
- package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +44 -0
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +565 -37
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +19 -31
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +21 -2
- package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec_cxx.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec_cxx.swift +208 -0
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +9 -43
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +21 -2
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +34 -6
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +376 -36
- package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +40 -0
- package/nitrogen/generated/ios/swift/MedicationConcept.swift +80 -0
- package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +781 -0
- package/nitrogen/generated/ios/swift/MedicationDoseEventLogStatus.swift +56 -0
- package/nitrogen/generated/ios/swift/MedicationDoseEventScheduleType.swift +40 -0
- package/nitrogen/generated/ios/swift/MedicationDoseEventsWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +16 -16
- package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +7 -7
- package/nitrogen/generated/ios/swift/QuantitySample.swift +574 -27
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +16 -16
- package/nitrogen/generated/ios/swift/QueryCorrelationSamplesWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +11 -91
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +11 -91
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +11 -91
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +11 -91
- package/nitrogen/generated/ios/swift/RelatedCoding.swift +76 -0
- package/nitrogen/generated/ios/swift/SampleType.swift +68 -0
- package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +16 -16
- package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +0 -16
- package/nitrogen/generated/ios/swift/StateOfMindSample.swift +586 -58
- package/nitrogen/generated/ios/swift/StateOfMindSamplesWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +7 -75
- package/nitrogen/generated/ios/swift/UserAnnotatedMedication.swift +87 -0
- package/nitrogen/generated/ios/swift/WeatherCondition.swift +144 -0
- package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +11 -105
- package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +11 -105
- package/nitrogen/generated/ios/swift/WorkoutSample.swift +751 -78
- package/nitrogen/generated/shared/c++/AggregationStyle.hpp +64 -0
- package/nitrogen/generated/shared/c++/CategorySample.hpp +126 -23
- package/nitrogen/generated/shared/c++/CorrelationSample.hpp +134 -12
- package/nitrogen/generated/shared/c++/{PredicateWithStartAndEnd.hpp → DateFilter.hpp} +10 -10
- package/nitrogen/generated/shared/c++/ECGQueryOptionsWithAnchor.hpp +12 -31
- package/nitrogen/generated/shared/c++/ECGQueryOptionsWithSortOrder.hpp +12 -31
- package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +135 -36
- package/nitrogen/generated/shared/c++/FilterForSamples.hpp +124 -0
- package/nitrogen/generated/shared/c++/FilterForSamplesBase.hpp +109 -0
- package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +131 -0
- package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +116 -0
- package/nitrogen/generated/shared/c++/GeneralForm.hpp +140 -0
- package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +67 -0
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +131 -28
- package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +1 -2
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +10 -28
- package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +11 -1
- package/nitrogen/generated/shared/c++/HybridElectrocardiogramModuleSpec.hpp +1 -2
- package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +1 -2
- package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +6 -25
- package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +9 -2
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +33 -5
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +56 -16
- package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +62 -0
- package/nitrogen/generated/shared/c++/MedicationConcept.hpp +93 -0
- package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +240 -0
- package/nitrogen/generated/shared/c++/MedicationDoseEventLogStatus.hpp +66 -0
- package/nitrogen/generated/shared/c++/MedicationDoseEventScheduleType.hpp +62 -0
- package/nitrogen/generated/shared/c++/MedicationDoseEventsWithAnchorResponse.hpp +89 -0
- package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +105 -105
- package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +8 -8
- package/nitrogen/generated/shared/c++/QuantitySample.hpp +130 -27
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +105 -105
- package/nitrogen/generated/shared/c++/QueryCorrelationSamplesWithAnchorResponse.hpp +89 -0
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +12 -31
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +12 -31
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +12 -31
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +12 -31
- package/nitrogen/generated/shared/c++/RelatedCoding.hpp +84 -0
- package/nitrogen/generated/shared/c++/SampleType.hpp +87 -0
- package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +105 -105
- package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +105 -121
- package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +139 -36
- package/nitrogen/generated/shared/c++/StateOfMindSamplesWithAnchorResponse.hpp +89 -0
- package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +8 -27
- package/nitrogen/generated/shared/c++/UserAnnotatedMedication.hpp +90 -0
- package/nitrogen/generated/shared/c++/WeatherCondition.hpp +88 -0
- package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +12 -37
- package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +12 -37
- package/nitrogen/generated/shared/c++/WorkoutSample.hpp +159 -35
- package/package.json +1 -1
- package/src/healthkit.ios.ts +30 -0
- package/src/healthkit.ts +68 -3
- package/src/hooks/useStatisticsForQuantity.ts +1 -1
- package/src/hooks/useSubscribeToCategorySamples.ts +31 -0
- package/src/modules.ts +4 -0
- package/src/specs/CategoryTypeModule.nitro.ts +2 -2
- package/src/specs/CoreModule.nitro.ts +3 -0
- package/src/specs/CorrelationTypeModule.nitro.ts +11 -3
- package/src/specs/ElectrocardiogramModule.nitro.ts +1 -1
- package/src/specs/HeartbeatSeriesModule.nitro.ts +1 -1
- package/src/specs/MedicationModule.nitro.ts +140 -0
- package/src/specs/QuantityTypeModule.nitro.ts +4 -7
- package/src/specs/StateOfMindModule.nitro.ts +10 -2
- package/src/types/CategoryType.ts +15 -22
- package/src/types/Constants.ts +3 -0
- package/src/types/CorrelationType.ts +10 -15
- package/src/types/ElectrocardiogramSample.ts +2 -14
- package/src/types/HeartbeatSeries.ts +2 -15
- package/src/types/QuantitySample.ts +2 -8
- package/src/types/QuantityType.ts +8 -17
- package/src/types/QuantityTypeIdentifier.ts +25 -25
- package/src/types/QueryOptions.ts +54 -43
- package/src/types/Shared.ts +74 -17
- package/src/types/StateOfMind.ts +8 -10
- package/src/types/Subscriptions.ts +19 -3
- package/src/types/WeatherCondition.ts +1 -1
- package/src/types/Workouts.ts +28 -91
- package/src/utils/getCategorySampleById.ts +1 -1
- package/src/utils/getQuantitySampleById.ts +1 -1
- package/src/utils/getWorkoutById.ts +1 -2
- package/src/utils/subscribeToCategorySamples.ts +38 -0
- package/src/utils/subscribeToQuantitySamples.ts +12 -37
- package/nitrogen/generated/ios/swift/FilterForSamplesAnd.swift +0 -94
- package/nitrogen/generated/ios/swift/FilterForSamplesOr.swift +0 -94
- package/nitrogen/generated/ios/swift/PredicateForSamples.swift +0 -21
- package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +0 -23
- package/nitrogen/generated/ios/swift/PredicateForWorkoutsAnd.swift +0 -108
- package/nitrogen/generated/ios/swift/PredicateForWorkoutsOr.swift +0 -108
- package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +0 -45
- package/nitrogen/generated/ios/swift/PredicateWithMetadataOperator.swift +0 -48
- package/nitrogen/generated/ios/swift/PredicateWithUUID.swift +0 -35
- package/nitrogen/generated/ios/swift/PredicateWithUUIDs.swift +0 -47
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +0 -23
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +0 -25
- package/nitrogen/generated/ios/swift/WorkoutActivityTypePredicate.swift +0 -35
- package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +0 -90
- package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +0 -90
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +0 -96
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +0 -96
- package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +0 -77
- package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +0 -84
- package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +0 -75
- package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +0 -76
- package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +0 -76
package/ios/WorkoutsModule.swift
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import HealthKit
|
|
2
1
|
import CoreLocation
|
|
2
|
+
import HealthKit
|
|
3
3
|
import NitroModules
|
|
4
4
|
|
|
5
5
|
#if canImport(WorkoutKit)
|
|
@@ -7,290 +7,242 @@ import WorkoutKit
|
|
|
7
7
|
#endif
|
|
8
8
|
|
|
9
9
|
func mapLocations(from locations: [LocationForSaving]) -> [CLLocation] {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
return locations.compactMap { location in
|
|
11
|
+
let latitude = location.latitude
|
|
12
|
+
let longitude = location.longitude
|
|
13
|
+
let altitude = location.altitude
|
|
14
|
+
let horizontalAccuracy = location.horizontalAccuracy
|
|
15
|
+
let verticalAccuracy = location.verticalAccuracy
|
|
16
|
+
let course = location.course
|
|
17
|
+
let speed = location.speed
|
|
18
|
+
let timestamp = location.date
|
|
19
|
+
|
|
20
|
+
let clLocation = CLLocation(
|
|
21
|
+
coordinate: CLLocationCoordinate2D(
|
|
22
|
+
latitude: latitude,
|
|
23
|
+
longitude: longitude
|
|
24
|
+
),
|
|
25
|
+
altitude: altitude,
|
|
26
|
+
horizontalAccuracy: horizontalAccuracy,
|
|
27
|
+
verticalAccuracy: verticalAccuracy,
|
|
28
|
+
course: course,
|
|
29
|
+
speed: speed,
|
|
30
|
+
timestamp: timestamp
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return clLocation
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
class WorkoutsModule: HybridWorkoutsModuleSpec {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
func startWatchAppWithWorkoutConfiguration(workoutConfiguration: WorkoutConfiguration) -> Promise<
|
|
39
|
+
Bool
|
|
40
|
+
> {
|
|
41
|
+
let configuration = parseWorkoutConfiguration(workoutConfiguration)
|
|
42
|
+
|
|
43
|
+
return Promise.async {
|
|
44
|
+
try await withCheckedThrowingContinuation { continuation in
|
|
45
|
+
store.startWatchApp(with: configuration) { success, error in
|
|
46
|
+
if let error {
|
|
47
|
+
continuation.resume(
|
|
48
|
+
throwing: error
|
|
49
|
+
)
|
|
50
|
+
}
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
52
|
+
continuation.resume(returning: success)
|
|
51
53
|
}
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return continuation.resume(throwing: error)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
guard let samples = samples else {
|
|
72
|
-
return continuation.resume(throwing: RuntimeError.error(withMessage: "Empty response"))
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
let workoutProxies = samples.compactMap { s in
|
|
76
|
-
if let workout = s as? HKWorkout {
|
|
77
|
-
return WorkoutProxy.init(
|
|
78
|
-
workout: workout
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
return nil
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return continuation.resume(returning: workoutProxies)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
store.execute(q)
|
|
88
|
-
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func queryWorkoutSamples(options: WorkoutQueryOptions) -> Promise<[HybridWorkoutProxySpec]> {
|
|
59
|
+
return Promise.async {
|
|
60
|
+
let predicate = createPredicateForWorkout(options.filter)
|
|
61
|
+
return try await sampleQueryAsync(
|
|
62
|
+
sampleType: .workoutType(),
|
|
63
|
+
limit: options.limit,
|
|
64
|
+
predicate: predicate,
|
|
65
|
+
sortDescriptors: getSortDescriptors(ascending: options.ascending)
|
|
66
|
+
).compactMap { s in
|
|
67
|
+
if let workout = s as? HKWorkout {
|
|
68
|
+
return WorkoutProxy.init(
|
|
69
|
+
workout: workout
|
|
70
|
+
)
|
|
89
71
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
func saveWorkoutSample(
|
|
93
|
-
workoutActivityType: WorkoutActivityType,
|
|
94
|
-
quantities: [QuantitySampleForSaving],
|
|
95
|
-
startDate: Date,
|
|
96
|
-
endDate: Date,
|
|
97
|
-
totals: WorkoutTotals?,
|
|
98
|
-
metadata: AnyMap?
|
|
99
|
-
) throws -> Promise<HybridWorkoutProxySpec> {
|
|
72
|
+
return nil
|
|
73
|
+
}
|
|
100
74
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
func saveWorkoutSample(
|
|
79
|
+
workoutActivityType: WorkoutActivityType,
|
|
80
|
+
quantities: [QuantitySampleForSaving],
|
|
81
|
+
startDate: Date,
|
|
82
|
+
endDate: Date,
|
|
83
|
+
totals: WorkoutTotals?,
|
|
84
|
+
metadata: AnyMap?
|
|
85
|
+
) -> Promise<HybridWorkoutProxySpec> {
|
|
86
|
+
return Promise.async {
|
|
87
|
+
let type = try initializeWorkoutActivityType(UInt(workoutActivityType.rawValue))
|
|
88
|
+
|
|
89
|
+
// ensure that start date is before end date
|
|
90
|
+
if startDate > endDate {
|
|
91
|
+
throw runtimeErrorWithPrefix("endDate must not be less than startDate")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let metadataDeserialized = metadata != nil ? anyMapToDictionary(metadata!) : nil
|
|
95
|
+
|
|
96
|
+
var totalEnergyBurned: HKQuantity?
|
|
97
|
+
var totalDistance: HKQuantity?
|
|
98
|
+
var totalSwimmingStrokeCount: HKQuantity?
|
|
99
|
+
var totalFlightsClimbed: HKQuantity?
|
|
100
|
+
// generating quantity samples
|
|
101
|
+
let initializedSamples = try quantities.map { quantity in
|
|
102
|
+
let type = try initializeQuantityType(quantity.quantityType.stringValue)
|
|
103
|
+
let unitStr = quantity.unit
|
|
104
|
+
let quantityVal = quantity.quantity
|
|
105
|
+
let quantityStart = quantity.startDate
|
|
106
|
+
let quantityEnd = quantity.endDate
|
|
107
|
+
let unit = HKUnit.init(from: unitStr)
|
|
108
|
+
let quantity = HKQuantity.init(unit: unit, doubleValue: quantityVal)
|
|
109
|
+
|
|
110
|
+
if quantity.is(compatibleWith: HKUnit.kilocalorie()) {
|
|
111
|
+
totalEnergyBurned = quantity
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var totalEnergyBurned: HKQuantity?
|
|
111
|
-
var totalDistance: HKQuantity?
|
|
112
|
-
var totalSwimmingStrokeCount: HKQuantity?
|
|
113
|
-
var totalFlightsClimbed: HKQuantity?
|
|
114
|
-
// generating quantity samples
|
|
115
|
-
let initializedSamples = try quantities.map { quantity in
|
|
116
|
-
let type = try initializeQuantityType(quantity.quantityType.stringValue)
|
|
117
|
-
let unitStr = quantity.unit
|
|
118
|
-
let quantityVal = quantity.quantity
|
|
119
|
-
let quantityStart = quantity.startDate
|
|
120
|
-
let quantityEnd = quantity.endDate
|
|
121
|
-
let unit = HKUnit.init(from: unitStr)
|
|
122
|
-
let quantity = HKQuantity.init(unit: unit, doubleValue: quantityVal)
|
|
123
|
-
|
|
124
|
-
if quantity.is(compatibleWith: HKUnit.kilocalorie()) {
|
|
125
|
-
totalEnergyBurned = quantity
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if quantity.is(compatibleWith: HKUnit.meter()) {
|
|
129
|
-
totalDistance = quantity
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if type.identifier == HKWorkoutSortIdentifierTotalSwimmingStrokeCount {
|
|
133
|
-
totalSwimmingStrokeCount = quantity
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if type.identifier == HKWorkoutSortIdentifierTotalFlightsClimbed {
|
|
137
|
-
totalFlightsClimbed = quantity
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return HKQuantitySample.init(
|
|
141
|
-
type: type,
|
|
142
|
-
quantity: quantity,
|
|
143
|
-
start: quantityStart,
|
|
144
|
-
end: quantityEnd,
|
|
145
|
-
metadata: metadataDeserialized
|
|
146
|
-
)
|
|
114
|
+
if quantity.is(compatibleWith: HKUnit.meter()) {
|
|
115
|
+
totalDistance = quantity
|
|
147
116
|
}
|
|
148
117
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
let rawTotalEnergy = totals?.energyBurned ?? 0.0
|
|
152
|
-
|
|
153
|
-
if rawTotalDistance != 0.0 {
|
|
154
|
-
totalDistance = HKQuantity(unit: .meter(), doubleValue: rawTotalDistance)
|
|
118
|
+
if type.identifier == HKWorkoutSortIdentifierTotalSwimmingStrokeCount {
|
|
119
|
+
totalSwimmingStrokeCount = quantity
|
|
155
120
|
}
|
|
156
|
-
if rawTotalEnergy != 0.0 {
|
|
157
|
-
totalEnergyBurned = HKQuantity(unit: .kilocalorie(), doubleValue: rawTotalEnergy)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// creating workout
|
|
161
|
-
var workout: HKWorkout?
|
|
162
121
|
|
|
163
|
-
if
|
|
164
|
-
|
|
165
|
-
activityType: type,
|
|
166
|
-
start: startDate,
|
|
167
|
-
end: endDate,
|
|
168
|
-
workoutEvents: nil,
|
|
169
|
-
totalEnergyBurned: totalEnergyBurned,
|
|
170
|
-
totalDistance: totalDistance,
|
|
171
|
-
totalSwimmingStrokeCount: totalSwimmingStrokeCount,
|
|
172
|
-
device: nil,
|
|
173
|
-
metadata: metadataDeserialized
|
|
174
|
-
)
|
|
175
|
-
} else {
|
|
176
|
-
if #available(iOS 11, *) {
|
|
177
|
-
if let totalFlightsClimbed = totalFlightsClimbed {
|
|
178
|
-
workout = HKWorkout.init(
|
|
179
|
-
activityType: type,
|
|
180
|
-
start: startDate,
|
|
181
|
-
end: endDate,
|
|
182
|
-
workoutEvents: nil,
|
|
183
|
-
totalEnergyBurned: totalEnergyBurned,
|
|
184
|
-
totalDistance: totalDistance,
|
|
185
|
-
totalFlightsClimbed: totalFlightsClimbed,
|
|
186
|
-
device: nil,
|
|
187
|
-
metadata: metadataDeserialized
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
122
|
+
if type.identifier == HKWorkoutSortIdentifierTotalFlightsClimbed {
|
|
123
|
+
totalFlightsClimbed = quantity
|
|
191
124
|
}
|
|
192
125
|
|
|
193
|
-
|
|
126
|
+
return HKQuantitySample.init(
|
|
127
|
+
type: type,
|
|
128
|
+
quantity: quantity,
|
|
129
|
+
start: quantityStart,
|
|
130
|
+
end: quantityEnd,
|
|
131
|
+
metadata: metadataDeserialized
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// if totals are provided override samples
|
|
136
|
+
let rawTotalDistance = totals?.distance ?? 0.0
|
|
137
|
+
let rawTotalEnergy = totals?.energyBurned ?? 0.0
|
|
138
|
+
|
|
139
|
+
if rawTotalDistance != 0.0 {
|
|
140
|
+
totalDistance = HKQuantity(unit: .meter(), doubleValue: rawTotalDistance)
|
|
141
|
+
}
|
|
142
|
+
if rawTotalEnergy != 0.0 {
|
|
143
|
+
totalEnergyBurned = HKQuantity(unit: .kilocalorie(), doubleValue: rawTotalEnergy)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// creating workout
|
|
147
|
+
var workout: HKWorkout?
|
|
148
|
+
|
|
149
|
+
if totalSwimmingStrokeCount != nil {
|
|
150
|
+
workout = HKWorkout.init(
|
|
151
|
+
activityType: type,
|
|
152
|
+
start: startDate,
|
|
153
|
+
end: endDate,
|
|
154
|
+
workoutEvents: nil,
|
|
155
|
+
totalEnergyBurned: totalEnergyBurned,
|
|
156
|
+
totalDistance: totalDistance,
|
|
157
|
+
totalSwimmingStrokeCount: totalSwimmingStrokeCount,
|
|
158
|
+
device: nil,
|
|
159
|
+
metadata: metadataDeserialized
|
|
160
|
+
)
|
|
161
|
+
} else {
|
|
162
|
+
if #available(iOS 11, *) {
|
|
163
|
+
if let totalFlightsClimbed = totalFlightsClimbed {
|
|
194
164
|
workout = HKWorkout.init(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
165
|
+
activityType: type,
|
|
166
|
+
start: startDate,
|
|
167
|
+
end: endDate,
|
|
168
|
+
workoutEvents: nil,
|
|
169
|
+
totalEnergyBurned: totalEnergyBurned,
|
|
170
|
+
totalDistance: totalDistance,
|
|
171
|
+
totalFlightsClimbed: totalFlightsClimbed,
|
|
172
|
+
device: nil,
|
|
173
|
+
metadata: metadataDeserialized
|
|
202
174
|
)
|
|
175
|
+
}
|
|
203
176
|
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if workout == nil {
|
|
180
|
+
workout = HKWorkout.init(
|
|
181
|
+
activityType: type,
|
|
182
|
+
start: startDate,
|
|
183
|
+
end: endDate,
|
|
184
|
+
workoutEvents: nil,
|
|
185
|
+
totalEnergyBurned: totalEnergyBurned,
|
|
186
|
+
totalDistance: totalDistance,
|
|
187
|
+
metadata: metadataDeserialized
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
guard let workout = workout else {
|
|
192
|
+
throw runtimeErrorWithPrefix("Failed to create workout")
|
|
193
|
+
}
|
|
194
|
+
try await withCheckedThrowingContinuation({ continuation in
|
|
195
|
+
// saving workout, samples and route
|
|
196
|
+
store.save(workout) { (_: Bool, error: Error?) in
|
|
197
|
+
if let error = error {
|
|
198
|
+
return continuation.resume(throwing: error)
|
|
199
|
+
} else if !initializedSamples.isEmpty {
|
|
200
|
+
store.add(initializedSamples, to: workout) { (_, error: Error?) in
|
|
201
|
+
if let error = error {
|
|
202
|
+
return continuation.resume(throwing: error)
|
|
203
|
+
}
|
|
204
|
+
return continuation.resume()
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
return continuation.resume()
|
|
208
|
+
}
|
|
204
209
|
|
|
205
|
-
guard let workout = workout else {
|
|
206
|
-
throw RuntimeError.error(withMessage: "Could not create workout")
|
|
207
210
|
}
|
|
211
|
+
}) as Void
|
|
208
212
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
store.save(workout) { (_: Bool, error: Error?) in
|
|
213
|
-
if let error = error {
|
|
214
|
-
return continuation.resume(throwing: error)
|
|
215
|
-
} else if !initializedSamples.isEmpty {
|
|
216
|
-
store.add(initializedSamples, to: workout) { (_, error: Error?) in
|
|
217
|
-
if let error = error {
|
|
218
|
-
return continuation.resume(throwing: error)
|
|
219
|
-
}
|
|
220
|
-
return continuation.resume()
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
return continuation.resume()
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
}) as Void
|
|
228
|
-
|
|
229
|
-
return WorkoutProxy.init(
|
|
230
|
-
workout: workout
|
|
231
|
-
)
|
|
232
|
-
}
|
|
213
|
+
return WorkoutProxy.init(
|
|
214
|
+
workout: workout
|
|
215
|
+
)
|
|
233
216
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
deletedSamples: [HKDeletedObject]?,
|
|
255
|
-
newAnchor: HKQueryAnchor?,
|
|
256
|
-
error: Error?
|
|
257
|
-
) in
|
|
258
|
-
if let error = error {
|
|
259
|
-
return continuation.resume(throwing: error)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
guard let samples = s, let newAnchor = newAnchor else {
|
|
263
|
-
return continuation.resume(
|
|
264
|
-
throwing: RuntimeError.error(
|
|
265
|
-
withMessage: "Empty response"
|
|
266
|
-
)
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
let workoutProxies = samples.compactMap { s in
|
|
271
|
-
if let workout = s as? HKWorkout {
|
|
272
|
-
return WorkoutProxy.init(
|
|
273
|
-
workout: workout,
|
|
274
|
-
)
|
|
275
|
-
}
|
|
276
|
-
return nil
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
let deletedSamples = deletedSamples?.map({ sample in
|
|
280
|
-
return serializeDeletedSample(sample: sample)
|
|
281
|
-
}) ?? []
|
|
282
|
-
|
|
283
|
-
let returnValue = QueryWorkoutSamplesWithAnchorResponse(
|
|
284
|
-
workouts: workoutProxies,
|
|
285
|
-
deletedSamples: deletedSamples,
|
|
286
|
-
newAnchor: serializeAnchor(anchor: newAnchor)!
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
return continuation.resume(returning: returnValue)
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
store.execute(q)
|
|
293
|
-
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
func queryWorkoutSamplesWithAnchor(options: WorkoutQueryOptionsWithAnchor) -> Promise<
|
|
220
|
+
QueryWorkoutSamplesWithAnchorResponse
|
|
221
|
+
> {
|
|
222
|
+
return Promise.async {
|
|
223
|
+
let predicate = createPredicateForWorkout(options.filter)
|
|
224
|
+
|
|
225
|
+
let response = try await sampleAnchoredQueryAsync(
|
|
226
|
+
sampleType: .workoutType(),
|
|
227
|
+
limit: options.limit,
|
|
228
|
+
queryAnchor: options.anchor,
|
|
229
|
+
predicate: predicate
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
let workoutProxies = response.samples.compactMap { s in
|
|
233
|
+
if let workout = s as? HKWorkout {
|
|
234
|
+
return WorkoutProxy.init(
|
|
235
|
+
workout: workout
|
|
236
|
+
)
|
|
294
237
|
}
|
|
238
|
+
return nil
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return QueryWorkoutSamplesWithAnchorResponse(
|
|
242
|
+
workouts: workoutProxies,
|
|
243
|
+
deletedSamples: response.deletedSamples,
|
|
244
|
+
newAnchor: response.newAnchor
|
|
245
|
+
)
|
|
295
246
|
}
|
|
247
|
+
}
|
|
296
248
|
}
|
|
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
exports.getWheelchairUseAsync = exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = exports.getBiologicalSexAsync = exports.areObjectTypesAvailableAsync = exports.areObjectTypesAvailable = exports.isObjectTypeAvailableAsync = exports.isObjectTypeAvailable = exports.isQuantityCompatibleWithUnit = exports.saveStateOfMindSample = exports.queryStateOfMindSamples = void 0;
|
|
20
|
+
exports.saveQuantitySample = exports.saveCorrelationSample = exports.saveCategorySample = exports.deleteObjects = exports.requestAuthorization = exports.querySources = exports.queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamples = exports.queryStatisticsCollectionForQuantity = exports.queryStatisticsForQuantity = exports.queryQuantitySamplesWithAnchor = exports.queryQuantitySamples = exports.queryElectrocardiogramSamplesWithAnchor = exports.queryElectrocardiogramSamples = exports.queryHeartbeatSeriesSamplesWithAnchor = exports.queryHeartbeatSeriesSamples = exports.queryCorrelationSamplesWithAnchor = exports.queryCorrelationSamples = exports.queryCategorySamplesWithAnchor = exports.queryCategorySamples = exports.isHealthDataAvailableAsync = exports.isHealthDataAvailable = exports.getWheelchairUse = exports.getRequestStatusForAuthorization = exports.getPreferredUnits = exports.getFitzpatrickSkinType = exports.getDateOfBirth = exports.getBloodType = exports.getBiologicalSex = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = exports.authorizationStatusFor = exports.useSubscribeToQuantitySamples = exports.useSubscribeToChanges = exports.useSubscribeToCategorySamples = exports.useStatisticsForQuantity = exports.useSources = exports.useMostRecentWorkout = exports.useMostRecentQuantitySample = exports.useMostRecentCategorySample = exports.useIsHealthDataAvailable = exports.useHealthkitAuthorization = exports.subscribeToQuantitySamples = exports.subscribeToChanges = exports.subscribeToCategorySamples = exports.getPreferredUnit = exports.getMostRecentWorkout = exports.getMostRecentQuantitySample = exports.getMostRecentCategorySample = void 0;
|
|
21
|
+
exports.getWheelchairUseAsync = exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = exports.getBiologicalSexAsync = exports.currentAppSource = exports.queryMedicationEventsWithAnchor = exports.queryMedicationEvents = exports.queryMedications = exports.requestMedicationsAuthorization = exports.areObjectTypesAvailableAsync = exports.areObjectTypesAvailable = exports.isObjectTypeAvailableAsync = exports.isObjectTypeAvailable = exports.isQuantityCompatibleWithUnit = exports.saveStateOfMindSample = exports.queryStateOfMindSamplesWithAnchor = exports.queryStateOfMindSamples = exports.isProtectedDataAvailable = exports.startWatchApp = exports.saveWorkoutSample = void 0;
|
|
22
22
|
const react_native_1 = require("react-native");
|
|
23
23
|
const useHealthkitAuthorization_1 = __importDefault(require("./hooks/useHealthkitAuthorization"));
|
|
24
24
|
exports.useHealthkitAuthorization = useHealthkitAuthorization_1.default;
|
|
@@ -34,6 +34,8 @@ const useSources_1 = __importDefault(require("./hooks/useSources"));
|
|
|
34
34
|
exports.useSources = useSources_1.default;
|
|
35
35
|
const useStatisticsForQuantity_1 = __importDefault(require("./hooks/useStatisticsForQuantity"));
|
|
36
36
|
exports.useStatisticsForQuantity = useStatisticsForQuantity_1.default;
|
|
37
|
+
const useSubscribeToCategorySamples_1 = __importDefault(require("./hooks/useSubscribeToCategorySamples"));
|
|
38
|
+
exports.useSubscribeToCategorySamples = useSubscribeToCategorySamples_1.default;
|
|
37
39
|
const useSubscribeToChanges_1 = __importDefault(require("./hooks/useSubscribeToChanges"));
|
|
38
40
|
exports.useSubscribeToChanges = useSubscribeToChanges_1.default;
|
|
39
41
|
const useSubscribeToQuantitySamples_1 = __importDefault(require("./hooks/useSubscribeToQuantitySamples"));
|
|
@@ -47,6 +49,8 @@ const getMostRecentWorkout_1 = __importDefault(require("./utils/getMostRecentWor
|
|
|
47
49
|
exports.getMostRecentWorkout = getMostRecentWorkout_1.default;
|
|
48
50
|
const getPreferredUnit_1 = __importDefault(require("./utils/getPreferredUnit"));
|
|
49
51
|
exports.getPreferredUnit = getPreferredUnit_1.default;
|
|
52
|
+
const subscribeToCategorySamples_1 = require("./utils/subscribeToCategorySamples");
|
|
53
|
+
Object.defineProperty(exports, "subscribeToCategorySamples", { enumerable: true, get: function () { return subscribeToCategorySamples_1.subscribeToCategorySamples; } });
|
|
50
54
|
const subscribeToChanges_1 = require("./utils/subscribeToChanges");
|
|
51
55
|
Object.defineProperty(exports, "subscribeToChanges", { enumerable: true, get: function () { return subscribeToChanges_1.subscribeToChanges; } });
|
|
52
56
|
const subscribeToQuantitySamples_1 = require("./utils/subscribeToQuantitySamples");
|
|
@@ -70,6 +74,7 @@ exports.isHealthDataAvailableAsync = modules_1.Core.isHealthDataAvailableAsync.b
|
|
|
70
74
|
exports.queryCategorySamples = modules_1.CategoryTypes.queryCategorySamples.bind(modules_1.CategoryTypes);
|
|
71
75
|
exports.queryCategorySamplesWithAnchor = modules_1.CategoryTypes.queryCategorySamplesWithAnchor.bind(modules_1.CategoryTypes);
|
|
72
76
|
exports.queryCorrelationSamples = modules_1.CorrelationTypes.queryCorrelationSamples.bind(modules_1.CorrelationTypes);
|
|
77
|
+
exports.queryCorrelationSamplesWithAnchor = modules_1.CorrelationTypes.queryCorrelationSamplesWithAnchor.bind(modules_1.CorrelationTypes);
|
|
73
78
|
exports.queryHeartbeatSeriesSamples = modules_1.HeartbeatSeries.queryHeartbeatSeriesSamples.bind(modules_1.HeartbeatSeries);
|
|
74
79
|
exports.queryHeartbeatSeriesSamplesWithAnchor = modules_1.HeartbeatSeries.queryHeartbeatSeriesSamplesWithAnchor.bind(modules_1.HeartbeatSeries);
|
|
75
80
|
exports.queryElectrocardiogramSamples = modules_1.Electrocardiograms.queryElectrocardiogramSamples.bind(modules_1.Electrocardiograms);
|
|
@@ -90,12 +95,18 @@ exports.saveWorkoutSample = modules_1.Workouts.saveWorkoutSample.bind(modules_1.
|
|
|
90
95
|
exports.startWatchApp = modules_1.Workouts.startWatchAppWithWorkoutConfiguration.bind(modules_1.Workouts);
|
|
91
96
|
exports.isProtectedDataAvailable = modules_1.Core.isProtectedDataAvailable.bind(modules_1.Core);
|
|
92
97
|
exports.queryStateOfMindSamples = modules_1.StateOfMind.queryStateOfMindSamples.bind(modules_1.StateOfMind);
|
|
98
|
+
exports.queryStateOfMindSamplesWithAnchor = modules_1.StateOfMind.queryStateOfMindSamplesWithAnchor.bind(modules_1.StateOfMind);
|
|
93
99
|
exports.saveStateOfMindSample = modules_1.StateOfMind.saveStateOfMindSample.bind(modules_1.StateOfMind);
|
|
94
100
|
exports.isQuantityCompatibleWithUnit = modules_1.QuantityTypes.isQuantityCompatibleWithUnit.bind(modules_1.QuantityTypes);
|
|
95
101
|
exports.isObjectTypeAvailable = modules_1.Core.isObjectTypeAvailable.bind(modules_1.Core);
|
|
96
102
|
exports.isObjectTypeAvailableAsync = modules_1.Core.isObjectTypeAvailableAsync.bind(modules_1.Core);
|
|
97
103
|
exports.areObjectTypesAvailable = modules_1.Core.areObjectTypesAvailable.bind(modules_1.Core);
|
|
98
104
|
exports.areObjectTypesAvailableAsync = modules_1.Core.areObjectTypesAvailableAsync.bind(modules_1.Core);
|
|
105
|
+
exports.requestMedicationsAuthorization = modules_1.Medication.requestMedicationsAuthorization.bind(modules_1.Medication);
|
|
106
|
+
exports.queryMedications = modules_1.Medication.queryMedications.bind(modules_1.Medication);
|
|
107
|
+
exports.queryMedicationEvents = modules_1.Medication.queryMedicationEvents.bind(modules_1.Medication);
|
|
108
|
+
exports.queryMedicationEventsWithAnchor = modules_1.Medication.queryMedicationEventsWithAnchor.bind(modules_1.Medication);
|
|
109
|
+
exports.currentAppSource = modules_1.Core.currentAppSource.bind(modules_1.Core);
|
|
99
110
|
exports.getBiologicalSexAsync = modules_1.Characteristics.getBiologicalSexAsync.bind(modules_1.Characteristics);
|
|
100
111
|
exports.getBloodTypeAsync = modules_1.Characteristics.getBloodTypeAsync.bind(modules_1.Characteristics);
|
|
101
112
|
exports.getDateOfBirthAsync = modules_1.Characteristics.getDateOfBirthAsync.bind(modules_1.Characteristics);
|
|
@@ -132,6 +143,7 @@ exports.default = {
|
|
|
132
143
|
queryCategorySamples: exports.queryCategorySamples,
|
|
133
144
|
queryCategorySamplesWithAnchor: exports.queryCategorySamplesWithAnchor,
|
|
134
145
|
queryCorrelationSamples: exports.queryCorrelationSamples,
|
|
146
|
+
queryCorrelationSamplesWithAnchor: exports.queryCorrelationSamplesWithAnchor,
|
|
135
147
|
queryHeartbeatSeriesSamples: exports.queryHeartbeatSeriesSamples,
|
|
136
148
|
queryHeartbeatSeriesSamplesWithAnchor: exports.queryHeartbeatSeriesSamplesWithAnchor,
|
|
137
149
|
queryElectrocardiogramSamples: exports.queryElectrocardiogramSamples,
|
|
@@ -154,7 +166,15 @@ exports.default = {
|
|
|
154
166
|
startWatchApp: exports.startWatchApp,
|
|
155
167
|
isProtectedDataAvailable: exports.isProtectedDataAvailable,
|
|
156
168
|
queryStateOfMindSamples: exports.queryStateOfMindSamples,
|
|
169
|
+
queryStateOfMindSamplesWithAnchor: exports.queryStateOfMindSamplesWithAnchor,
|
|
157
170
|
saveStateOfMindSample: exports.saveStateOfMindSample,
|
|
171
|
+
requestMedicationsAuthorization: exports.requestMedicationsAuthorization,
|
|
172
|
+
currentAppSource: exports.currentAppSource,
|
|
173
|
+
queryMedicationEventsWithAnchor: exports.queryMedicationEventsWithAnchor,
|
|
174
|
+
queryMedicationEvents: exports.queryMedicationEvents,
|
|
175
|
+
queryMedications: exports.queryMedications,
|
|
176
|
+
subscribeToCategorySamples: subscribeToCategorySamples_1.subscribeToCategorySamples,
|
|
177
|
+
useSubscribeToCategorySamples: useSubscribeToCategorySamples_1.default,
|
|
158
178
|
// hooks
|
|
159
179
|
useMostRecentCategorySample: useMostRecentCategorySample_1.default,
|
|
160
180
|
useMostRecentQuantitySample: useMostRecentQuantitySample_1.default,
|