@kingstinct/react-native-healthkit 8.2.0 → 8.3.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/README.md +18 -4
- package/ios/Constants.swift +4 -0
- package/ios/Helpers.swift +81 -0
- package/ios/ReactNativeHealthkit.m +15 -0
- package/ios/ReactNativeHealthkit.swift +104 -2
- package/ios/Serializers.swift +18 -0
- package/lib/commonjs/index.ios.js +18 -0
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.native.js +15 -1
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-types.js +14 -1
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/test-setup.js +3 -1
- package/lib/commonjs/test-setup.js.map +1 -1
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js +16 -0
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js.map +1 -0
- package/lib/commonjs/utils/startWatchApp.js +11 -0
- package/lib/commonjs/utils/startWatchApp.js.map +1 -0
- package/lib/module/index.ios.js +6 -2
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.native.js +13 -1
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-types.js +15 -0
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/test-setup.js +3 -1
- package/lib/module/test-setup.js.map +1 -1
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js +9 -0
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js.map +1 -0
- package/lib/module/utils/startWatchApp.js +4 -0
- package/lib/module/utils/startWatchApp.js.map +1 -0
- package/lib/typescript/src/index.ios.d.ts +6 -2
- package/lib/typescript/src/index.native.d.ts +11 -3
- package/lib/typescript/src/native-types.d.ts +29 -1
- package/lib/typescript/src/utils/queryStatisticsCollectionForQuantity.d.ts +3 -0
- package/lib/typescript/src/utils/startWatchApp.d.ts +3 -0
- package/package.json +1 -1
- package/src/index.ios.tsx +7 -0
- package/src/index.native.tsx +16 -0
- package/src/native-types.ts +45 -1
- package/src/test-setup.ts +2 -0
- package/src/utils/queryStatisticsCollectionForQuantity.ts +38 -0
- package/src/utils/startWatchApp.ts +7 -0
package/README.md
CHANGED
|
@@ -91,12 +91,26 @@ Some imperative examples:
|
|
|
91
91
|
console.log(quantity) // 17.5
|
|
92
92
|
console.log(unit) // %
|
|
93
93
|
|
|
94
|
-
/* Listen to data */
|
|
95
94
|
await HealthKit.requestAuthorization([HKQuantityTypeIdentifier.heartRate]); // request read permission for heart rate
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
/* Subscribe to data (Make sure to request permissions before subscribing to changes) */
|
|
97
|
+
const [hasRequestedAuthorization, setHasRequestedAuthorization] = useState(false);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
HealthKit.requestAuthorization([HKQuantityTypeIdentifier.heartRate]).then(() => {
|
|
101
|
+
setHasRequestedAuthorization(true);
|
|
102
|
+
});
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (hasRequestedAuthorization) {
|
|
107
|
+
const unsubscribe = HealthKit.subscribeToChanges(HKQuantityTypeIdentifier.heartRate, () => {
|
|
108
|
+
// refetch data as needed
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return () => unsubscribe();
|
|
113
|
+
}, [hasRequestedAuthorization]);
|
|
100
114
|
|
|
101
115
|
/* write data */
|
|
102
116
|
await HealthKit.requestAuthorization([], [HKQuantityTypeIdentifier.insulinDelivery]); // request write permission for insulin delivery
|
package/ios/Constants.swift
CHANGED
|
@@ -11,6 +11,7 @@ import HealthKit
|
|
|
11
11
|
let INIT_ERROR = "HEALTHKIT_INIT_ERROR"
|
|
12
12
|
let INIT_ERROR_MESSAGE = "HealthKit not initialized"
|
|
13
13
|
let TYPE_IDENTIFIER_ERROR = "HEALTHKIT_TYPE_IDENTIFIER_NOT_RECOGNIZED_ERROR"
|
|
14
|
+
let QUERY_ERROR = "HEALTHKIT_QUERY_ERROR"
|
|
14
15
|
let GENERIC_ERROR = "HEALTHKIT_ERROR"
|
|
15
16
|
|
|
16
17
|
let HKCharacteristicTypeIdentifier_PREFIX = "HKCharacteristicTypeIdentifier"
|
|
@@ -23,6 +24,9 @@ let HKWorkoutTypeIdentifier = "HKWorkoutTypeIdentifier"
|
|
|
23
24
|
let HKWorkoutRouteTypeIdentifier = "HKWorkoutRouteTypeIdentifier"
|
|
24
25
|
let HKDataTypeIdentifierHeartbeatSeries = "HKDataTypeIdentifierHeartbeatSeries"
|
|
25
26
|
|
|
27
|
+
let HKWorkoutActivityTypePropertyName = "activityType"
|
|
28
|
+
let HKWorkoutSessionLocationTypePropertyName = "locationType"
|
|
29
|
+
|
|
26
30
|
let SpeedUnit = HKUnit(from: "m/s") // HKUnit.meter().unitDivided(by: HKUnit.second())
|
|
27
31
|
// Support for MET data: HKAverageMETs 8.24046 kcal/hr·kg
|
|
28
32
|
let METUnit = HKUnit(from: "kcal/hr·kg")
|
package/ios/Helpers.swift
CHANGED
|
@@ -156,3 +156,84 @@ func objectTypeFromString(typeIdentifier: String) -> HKObjectType? {
|
|
|
156
156
|
|
|
157
157
|
return nil
|
|
158
158
|
}
|
|
159
|
+
|
|
160
|
+
func hkStatisticsOptionsFromOptions(_ options: NSArray) -> HKStatisticsOptions {
|
|
161
|
+
var opts = HKStatisticsOptions()
|
|
162
|
+
|
|
163
|
+
for o in options {
|
|
164
|
+
guard let str = o as? String else { continue }
|
|
165
|
+
|
|
166
|
+
switch str {
|
|
167
|
+
case "cumulativeSum":
|
|
168
|
+
opts.insert(.cumulativeSum)
|
|
169
|
+
case "discreteAverage":
|
|
170
|
+
opts.insert(.discreteAverage)
|
|
171
|
+
case "discreteMax":
|
|
172
|
+
opts.insert(.discreteMax)
|
|
173
|
+
case "discreteMin":
|
|
174
|
+
opts.insert(.discreteMin)
|
|
175
|
+
case "discreteMostRecent":
|
|
176
|
+
if #available(iOS 12, *) {
|
|
177
|
+
opts.insert(.discreteMostRecent)
|
|
178
|
+
}
|
|
179
|
+
case "duration":
|
|
180
|
+
if #available(iOS 13, *) {
|
|
181
|
+
opts.insert(.duration)
|
|
182
|
+
}
|
|
183
|
+
case "mostRecent":
|
|
184
|
+
if #available(iOS 13, *) {
|
|
185
|
+
opts.insert(.mostRecent)
|
|
186
|
+
}
|
|
187
|
+
case "separateBySource":
|
|
188
|
+
opts.insert(.separateBySource)
|
|
189
|
+
default:
|
|
190
|
+
continue
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return opts
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
func componentsFromInterval(_ interval: NSDictionary) -> DateComponents {
|
|
198
|
+
let componentKeys: [String: WritableKeyPath<DateComponents, Int?>] = [
|
|
199
|
+
"minute": \.minute,
|
|
200
|
+
"hour": \.hour,
|
|
201
|
+
"day": \.day,
|
|
202
|
+
"month": \.month,
|
|
203
|
+
"year": \.year
|
|
204
|
+
]
|
|
205
|
+
|
|
206
|
+
var intervalComponents = DateComponents()
|
|
207
|
+
for (key, keyPath) in componentKeys {
|
|
208
|
+
if let value = interval[key] as? Int {
|
|
209
|
+
intervalComponents[keyPath: keyPath] = value
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return intervalComponents
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
func serializeQuantityIfExists(unit: HKUnit, quantity: HKQuantity?) -> [String: Any]? {
|
|
216
|
+
guard let quantity = quantity else { return nil }
|
|
217
|
+
return serializeQuantity(unit: unit, quantity: quantity)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
func serializeStatisticIfExists(unit: HKUnit, quantity: HKQuantity?, stats: HKStatistics) -> [String: Any]? {
|
|
221
|
+
guard let quantity = quantity else { return nil }
|
|
222
|
+
return serializeStatistic(unit: unit, quantity: quantity, stats: stats)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
func parseWorkoutConfiguration(_ dict: NSDictionary) -> HKWorkoutConfiguration {
|
|
226
|
+
let configuration = HKWorkoutConfiguration()
|
|
227
|
+
|
|
228
|
+
if let activityTypeRaw = dict[HKWorkoutActivityTypePropertyName] as? UInt,
|
|
229
|
+
let activityType = HKWorkoutActivityType(rawValue: activityTypeRaw) {
|
|
230
|
+
configuration.activityType = activityType
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if let locationTypeRaw = dict[HKWorkoutSessionLocationTypePropertyName] as? Int,
|
|
234
|
+
let locationType = HKWorkoutSessionLocationType(rawValue: locationTypeRaw) {
|
|
235
|
+
configuration.locationType = locationType
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return configuration
|
|
239
|
+
}
|
|
@@ -214,6 +214,17 @@ RCT_EXTERN_METHOD(queryStatisticsForQuantity:(NSString)typeIdentifier
|
|
|
214
214
|
reject:(RCTPromiseRejectBlock)reject
|
|
215
215
|
)
|
|
216
216
|
|
|
217
|
+
RCT_EXTERN_METHOD(queryStatisticsCollectionForQuantity:(NSString)typeIdentifier
|
|
218
|
+
unitString:(NSString)unitString
|
|
219
|
+
options:(NSArray)options
|
|
220
|
+
anchorDate:(NSDate)anchorDate
|
|
221
|
+
interval:(NSDictionary)interval
|
|
222
|
+
startDate:(NSDate)startDate
|
|
223
|
+
endDate:(NSDate)endDate
|
|
224
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
225
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
226
|
+
)
|
|
227
|
+
|
|
217
228
|
RCT_EXTERN_METHOD(getWheelchairUse:(RCTPromiseResolveBlock)resolve
|
|
218
229
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
219
230
|
|
|
@@ -230,5 +241,9 @@ RCT_EXTERN_METHOD(getWorkoutPlanById:(NSString)workoutUUID
|
|
|
230
241
|
RCT_EXTERN_METHOD(isProtectedDataAvailable:(RCTPromiseResolveBlock)resolve
|
|
231
242
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
232
243
|
|
|
244
|
+
RCT_EXTERN_METHOD(startWatchAppWithWorkoutConfiguration:(NSDictionary)workoutConfiguration
|
|
245
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
246
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
247
|
+
)
|
|
233
248
|
|
|
234
249
|
@end
|
|
@@ -283,13 +283,13 @@ class ReactNativeHealthkit: RCTEventEmitter {
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
let identifier = HKQuantityTypeIdentifier.init(rawValue: typeIdentifier)
|
|
286
|
-
let sampleUuid = UUID.init(uuidString: uuid)!
|
|
287
286
|
|
|
288
287
|
guard let sampleType = HKObjectType.quantityType(forIdentifier: identifier) else {
|
|
289
288
|
return reject(TYPE_IDENTIFIER_ERROR, "Failed to initialize " + typeIdentifier, nil)
|
|
290
289
|
}
|
|
291
290
|
|
|
292
|
-
|
|
291
|
+
// https://developer.apple.com/documentation/healthkit/hkquery/1614783-predicateforobjectwithuuid
|
|
292
|
+
let samplePredicate: NSPredicate = NSPredicate(format: "%K == %@", HKPredicateKeyPathUUID, uuid)
|
|
293
293
|
|
|
294
294
|
store.deleteObjects(of: sampleType, predicate: samplePredicate) { (success: Bool, _: Int, error: Error?) in
|
|
295
295
|
guard let err = error else {
|
|
@@ -930,6 +930,85 @@ class ReactNativeHealthkit: RCTEventEmitter {
|
|
|
930
930
|
store.execute(query)
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
+
@objc(queryStatisticsCollectionForQuantity:unitString:options:anchorDate:interval:startDate:endDate:resolve:reject:)
|
|
934
|
+
func queryStatisticsCollectionForQuantity(
|
|
935
|
+
typeIdentifier: String,
|
|
936
|
+
unitString: String,
|
|
937
|
+
options: NSArray,
|
|
938
|
+
anchorDate: Date,
|
|
939
|
+
interval: NSDictionary,
|
|
940
|
+
startDate: Date,
|
|
941
|
+
endDate: Date,
|
|
942
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
943
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
944
|
+
) {
|
|
945
|
+
guard let store = _store else {
|
|
946
|
+
return reject(INIT_ERROR, INIT_ERROR_MESSAGE, nil)
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
guard let quantityType = HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier(rawValue: typeIdentifier)) else {
|
|
950
|
+
return reject(TYPE_IDENTIFIER_ERROR, "Failed to initialize quantity type for identifier: \(typeIdentifier)", nil)
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
let opts = hkStatisticsOptionsFromOptions(options)
|
|
954
|
+
let intervalComponents = componentsFromInterval(interval)
|
|
955
|
+
|
|
956
|
+
let query = HKStatisticsCollectionQuery(
|
|
957
|
+
quantityType: quantityType,
|
|
958
|
+
quantitySamplePredicate: nil, // We will use enumerateStatistics to filter with date
|
|
959
|
+
options: opts,
|
|
960
|
+
anchorDate: anchorDate,
|
|
961
|
+
intervalComponents: intervalComponents
|
|
962
|
+
)
|
|
963
|
+
|
|
964
|
+
query.initialResultsHandler = { _, statsCollection, error in
|
|
965
|
+
if let error = error {
|
|
966
|
+
return reject(QUERY_ERROR, error.localizedDescription, error)
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
var results = [[String: [String: Any]?]]()
|
|
970
|
+
|
|
971
|
+
guard let collection = statsCollection else {
|
|
972
|
+
return resolve(results)
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
let unit = HKUnit(from: unitString)
|
|
976
|
+
|
|
977
|
+
collection.enumerateStatistics(from: startDate, to: endDate) { stats, _ in
|
|
978
|
+
var dic = [String: [String: Any]?]()
|
|
979
|
+
|
|
980
|
+
let startDate = self._dateFormatter.string(from: stats.startDate)
|
|
981
|
+
let endDate = self._dateFormatter.string(from: stats.endDate)
|
|
982
|
+
|
|
983
|
+
dic["averageQuantity"] = serializeQuantityIfExists(unit: unit, quantity: stats.averageQuantity())
|
|
984
|
+
dic["maximumQuantity"] = serializeQuantityIfExists(unit: unit, quantity: stats.maximumQuantity())
|
|
985
|
+
dic["minimumQuantity"] = serializeQuantityIfExists(unit: unit, quantity: stats.minimumQuantity())
|
|
986
|
+
dic["sumQuantity"] = serializeStatisticIfExists(unit: unit, quantity: stats.sumQuantity(), stats: stats)
|
|
987
|
+
|
|
988
|
+
if #available(iOS 12, *) {
|
|
989
|
+
dic["mostRecentQuantity"] = serializeQuantityIfExists(unit: unit, quantity: stats.mostRecentQuantity())
|
|
990
|
+
if let mostRecentDateInterval = stats.mostRecentQuantityDateInterval() {
|
|
991
|
+
dic["mostRecentQuantityDateInterval"] = [
|
|
992
|
+
"start": self._dateFormatter.string(from: mostRecentDateInterval.start),
|
|
993
|
+
"end": self._dateFormatter.string(from: mostRecentDateInterval.end)
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
if #available(iOS 13, *) {
|
|
999
|
+
let durationUnit = HKUnit.second()
|
|
1000
|
+
dic["duration"] = serializeQuantityIfExists(unit: durationUnit, quantity: stats.duration())
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
results.append(dic)
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
resolve(results)
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
store.execute(query)
|
|
1010
|
+
}
|
|
1011
|
+
|
|
933
1012
|
func mapWorkout(
|
|
934
1013
|
workout: HKWorkout,
|
|
935
1014
|
distanceUnit: HKUnit,
|
|
@@ -2003,4 +2082,27 @@ class ReactNativeHealthkit: RCTEventEmitter {
|
|
|
2003
2082
|
}
|
|
2004
2083
|
}
|
|
2005
2084
|
|
|
2085
|
+
@available(iOS 17.0.0, *)
|
|
2086
|
+
@objc(startWatchAppWithWorkoutConfiguration:resolve:reject:)
|
|
2087
|
+
func startWatchAppWithWorkoutConfiguration(
|
|
2088
|
+
_ workoutConfiguration: NSDictionary,
|
|
2089
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
2090
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
2091
|
+
) {
|
|
2092
|
+
guard let store = _store else {
|
|
2093
|
+
return reject(INIT_ERROR, INIT_ERROR_MESSAGE, nil)
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
let configuration = parseWorkoutConfiguration(workoutConfiguration)
|
|
2097
|
+
|
|
2098
|
+
store.startWatchApp(with: configuration) { success, error in
|
|
2099
|
+
if let error {
|
|
2100
|
+
reject(INIT_ERROR, INIT_ERROR_MESSAGE, error)
|
|
2101
|
+
return
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
resolve(success)
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2006
2108
|
}
|
package/ios/Serializers.swift
CHANGED
|
@@ -218,3 +218,21 @@ func serializeAnchor(anchor: HKQueryAnchor?) -> String? {
|
|
|
218
218
|
|
|
219
219
|
return encoded
|
|
220
220
|
}
|
|
221
|
+
|
|
222
|
+
func serializeStatistic(unit: HKUnit, quantity: HKQuantity?, stats: HKStatistics?) -> [String: Any]? {
|
|
223
|
+
guard let q = quantity, let stats = stats else {
|
|
224
|
+
return nil
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
let endDate = _dateFormatter.string(from: stats.endDate)
|
|
228
|
+
let startDate = _dateFormatter.string(from: stats.startDate)
|
|
229
|
+
let quantityType = stats.quantityType.identifier
|
|
230
|
+
|
|
231
|
+
return [
|
|
232
|
+
"quantityType": quantityType,
|
|
233
|
+
"startDate": startDate,
|
|
234
|
+
"endDate": endDate,
|
|
235
|
+
"quantity": q.doubleValue(for: unit),
|
|
236
|
+
"unit": unit.unitString
|
|
237
|
+
]
|
|
238
|
+
}
|
|
@@ -43,6 +43,7 @@ var _exportNames = {
|
|
|
43
43
|
queryQuantitySamples: true,
|
|
44
44
|
queryQuantitySamplesWithAnchor: true,
|
|
45
45
|
querySources: true,
|
|
46
|
+
queryStatisticsCollectionForQuantity: true,
|
|
46
47
|
queryStatisticsForQuantity: true,
|
|
47
48
|
queryWorkoutSamples: true,
|
|
48
49
|
queryWorkoutSamplesWithAnchor: true,
|
|
@@ -52,6 +53,7 @@ var _exportNames = {
|
|
|
52
53
|
saveQuantitySample: true,
|
|
53
54
|
saveWorkoutRoute: true,
|
|
54
55
|
saveWorkoutSample: true,
|
|
56
|
+
startWatchApp: true,
|
|
55
57
|
subscribeToChanges: true
|
|
56
58
|
};
|
|
57
59
|
exports.default = exports.availableQuantityTypes = exports.authorizationStatusFor = void 0;
|
|
@@ -167,6 +169,12 @@ Object.defineProperty(exports, "querySources", {
|
|
|
167
169
|
return _querySources.default;
|
|
168
170
|
}
|
|
169
171
|
});
|
|
172
|
+
Object.defineProperty(exports, "queryStatisticsCollectionForQuantity", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () {
|
|
175
|
+
return _queryStatisticsCollectionForQuantity.default;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
170
178
|
Object.defineProperty(exports, "queryStatisticsForQuantity", {
|
|
171
179
|
enumerable: true,
|
|
172
180
|
get: function () {
|
|
@@ -222,6 +230,12 @@ Object.defineProperty(exports, "saveWorkoutSample", {
|
|
|
222
230
|
return _saveWorkoutSample.default;
|
|
223
231
|
}
|
|
224
232
|
});
|
|
233
|
+
Object.defineProperty(exports, "startWatchApp", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function () {
|
|
236
|
+
return _startWatchApp.default;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
225
239
|
Object.defineProperty(exports, "subscribeToChanges", {
|
|
226
240
|
enumerable: true,
|
|
227
241
|
get: function () {
|
|
@@ -304,6 +318,7 @@ var _queryHeartbeatSeriesSamplesWithAnchor = _interopRequireDefault(require("./u
|
|
|
304
318
|
var _queryQuantitySamples = _interopRequireDefault(require("./utils/queryQuantitySamples"));
|
|
305
319
|
var _queryQuantitySamplesWithAnchor = _interopRequireDefault(require("./utils/queryQuantitySamplesWithAnchor"));
|
|
306
320
|
var _querySources = _interopRequireDefault(require("./utils/querySources"));
|
|
321
|
+
var _queryStatisticsCollectionForQuantity = _interopRequireDefault(require("./utils/queryStatisticsCollectionForQuantity"));
|
|
307
322
|
var _queryStatisticsForQuantity = _interopRequireDefault(require("./utils/queryStatisticsForQuantity"));
|
|
308
323
|
var _queryWorkouts = _interopRequireDefault(require("./utils/queryWorkouts"));
|
|
309
324
|
var _queryWorkoutSamplesWithAnchor = _interopRequireDefault(require("./utils/queryWorkoutSamplesWithAnchor"));
|
|
@@ -313,6 +328,7 @@ var _saveCorrelationSample = _interopRequireDefault(require("./utils/saveCorrela
|
|
|
313
328
|
var _saveQuantitySample = _interopRequireDefault(require("./utils/saveQuantitySample"));
|
|
314
329
|
var _saveWorkoutRoute = _interopRequireDefault(require("./utils/saveWorkoutRoute"));
|
|
315
330
|
var _saveWorkoutSample = _interopRequireDefault(require("./utils/saveWorkoutSample"));
|
|
331
|
+
var _startWatchApp = _interopRequireDefault(require("./utils/startWatchApp"));
|
|
316
332
|
var _subscribeToChanges = _interopRequireDefault(require("./utils/subscribeToChanges"));
|
|
317
333
|
var _types = require("./types");
|
|
318
334
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -432,6 +448,7 @@ var _default = exports.default = {
|
|
|
432
448
|
queryQuantitySamples: _queryQuantitySamples.default,
|
|
433
449
|
queryQuantitySamplesWithAnchor: _queryQuantitySamplesWithAnchor.default,
|
|
434
450
|
queryStatisticsForQuantity: _queryStatisticsForQuantity.default,
|
|
451
|
+
queryStatisticsCollectionForQuantity: _queryStatisticsCollectionForQuantity.default,
|
|
435
452
|
/**
|
|
436
453
|
* @deprecated Use queryWorkoutSamples instead
|
|
437
454
|
*/
|
|
@@ -455,6 +472,7 @@ var _default = exports.default = {
|
|
|
455
472
|
saveWorkoutRoute: _saveWorkoutRoute.default,
|
|
456
473
|
// subscriptions
|
|
457
474
|
subscribeToChanges: _subscribeToChanges.default,
|
|
475
|
+
startWatchApp: _startWatchApp.default,
|
|
458
476
|
/**
|
|
459
477
|
* @returns the most recent sample for the given category type.
|
|
460
478
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_useHealthkitAuthorization","_interopRequireDefault","_useIsHealthDataAvailable","_useMostRecentCategorySample","_useMostRecentQuantitySample","_useMostRecentWorkout","_useSources","_useStatisticsForQuantity","_useSubscribeToChanges","_nativeTypes","_interopRequireWildcard","_deleteQuantitySample","_deleteSamples","_getDateOfBirth","_getMostRecentCategorySample","_getMostRecentQuantitySample","_getMostRecentWorkout","_getPreferredUnit","_getPreferredUnits","_getRequestStatusForAuthorization","_getWorkoutPlanById","_queryCategorySamples","_queryCategorySamplesWithAnchor","_queryCorrelationSamples","_queryHeartbeatSeriesSamples","_queryHeartbeatSeriesSamplesWithAnchor","_queryQuantitySamples","_queryQuantitySamplesWithAnchor","_querySources","_queryStatisticsForQuantity","_queryWorkouts","_queryWorkoutSamplesWithAnchor","_requestAuthorization","_saveCategorySample","_saveCorrelationSample","_saveQuantitySample","_saveWorkoutRoute","_saveWorkoutSample","_subscribeToChanges","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","currentMajorVersionIOS","Platform","OS","parseInt","Version","allQuantityTypesList","values","HKQuantityTypeIdentifier","availableQuantityTypes","majorVersionIOS","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","Native","bind","isHealthDataAvailable","isProtectedDataAvailable","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","_default","getDateOfBirth","getMostRecentQuantitySample","getMostRecentCategorySample","getMostRecentWorkout","getWorkoutPlanById","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","queryWorkouts","queryWorkoutSamples","queryWorkoutSamplesWithAnchor","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useIsHealthDataAvailable","useHealthkitAuthorization","useSources","useStatisticsForQuantity"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSources from './hooks/useSources'\nimport useStatisticsForQuantity from './hooks/useStatisticsForQuantity'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkoutSamples from './utils/queryWorkouts'\nimport queryWorkoutSamplesWithAnchor from './utils/queryWorkoutSamplesWithAnchor'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\nconst isProtectedDataAvailable = Native.isProtectedDataAvailable.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n /**\n * @deprecated Use queryWorkoutSamples instead\n */\n queryWorkouts: queryWorkoutSamples,\n queryWorkoutSamples,\n queryWorkoutSamplesWithAnchor,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n useSources,\n useStatisticsForQuantity,\n}\n\nconst queryWorkouts = queryWorkoutSamples\n\nexport {\n authorizationStatusFor,\n availableQuantityTypes,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n /**\n * @deprecated Use queryWorkoutSamples instead\n */\n queryWorkouts,\n queryWorkoutSamples,\n queryWorkoutSamplesWithAnchor,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n useSources,\n useStatisticsForQuantity,\n isProtectedDataAvailable,\n}\n\nexport * from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,4BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,4BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,yBAAA,GAAAN,sBAAA,CAA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,YAAY,EAAZA,qBAAY;EAEZC,oBAAoB,EAApBA,6BAAoB;EAEpB;EACAC,oBAAoB,EAApBA,6BAAoB;EACpBC,aAAa,EAAbA,sBAAa;EAEb;EACA;AACF;AACA;AACA;EACEC,kBAAkB,EAAlBA,2BAAkB;EAClBC,qBAAqB,EAArBA,8BAAqB;EACrBC,kBAAkB,EAAlBA,2BAAkB;EAClBC,iBAAiB,EAAjBA,0BAAiB;EACjBC,gBAAgB,EAAhBA,yBAAgB;EAEhB;EACAC,kBAAkB,EAAlBA,2BAAkB;EAElB;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,8BAAqB;EACrB;AACF;AACA;AACA;AACA;EACEC,wBAAwB,EAAxBA,iCAAwB;EACxB;AACF;AACA;AACA;AACA;EACEC,yBAAyB,EAAzBA,kCAAyB;EACzBC,UAAU,EAAVA,mBAAU;EACVC,wBAAwB,EAAxBA;AACF,CAAC;AAED,MAAMpB,aAAa,GAAApE,OAAA,CAAAoE,aAAA,GAAGC,sBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useHealthkitAuthorization","_interopRequireDefault","_useIsHealthDataAvailable","_useMostRecentCategorySample","_useMostRecentQuantitySample","_useMostRecentWorkout","_useSources","_useStatisticsForQuantity","_useSubscribeToChanges","_nativeTypes","_interopRequireWildcard","_deleteQuantitySample","_deleteSamples","_getDateOfBirth","_getMostRecentCategorySample","_getMostRecentQuantitySample","_getMostRecentWorkout","_getPreferredUnit","_getPreferredUnits","_getRequestStatusForAuthorization","_getWorkoutPlanById","_queryCategorySamples","_queryCategorySamplesWithAnchor","_queryCorrelationSamples","_queryHeartbeatSeriesSamples","_queryHeartbeatSeriesSamplesWithAnchor","_queryQuantitySamples","_queryQuantitySamplesWithAnchor","_querySources","_queryStatisticsCollectionForQuantity","_queryStatisticsForQuantity","_queryWorkouts","_queryWorkoutSamplesWithAnchor","_requestAuthorization","_saveCategorySample","_saveCorrelationSample","_saveQuantitySample","_saveWorkoutRoute","_saveWorkoutSample","_startWatchApp","_subscribeToChanges","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","currentMajorVersionIOS","Platform","OS","parseInt","Version","allQuantityTypesList","values","HKQuantityTypeIdentifier","availableQuantityTypes","majorVersionIOS","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","Native","bind","isHealthDataAvailable","isProtectedDataAvailable","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","_default","getDateOfBirth","getMostRecentQuantitySample","getMostRecentCategorySample","getMostRecentWorkout","getWorkoutPlanById","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","queryStatisticsCollectionForQuantity","queryWorkouts","queryWorkoutSamples","queryWorkoutSamplesWithAnchor","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","startWatchApp","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useIsHealthDataAvailable","useHealthkitAuthorization","useSources","useStatisticsForQuantity"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSources from './hooks/useSources'\nimport useStatisticsForQuantity from './hooks/useStatisticsForQuantity'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsCollectionForQuantity from './utils/queryStatisticsCollectionForQuantity'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkoutSamples from './utils/queryWorkouts'\nimport queryWorkoutSamplesWithAnchor from './utils/queryWorkoutSamplesWithAnchor'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport startWatchApp from './utils/startWatchApp'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\nconst isProtectedDataAvailable = Native.isProtectedDataAvailable.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryStatisticsCollectionForQuantity,\n /**\n * @deprecated Use queryWorkoutSamples instead\n */\n queryWorkouts: queryWorkoutSamples,\n queryWorkoutSamples,\n queryWorkoutSamplesWithAnchor,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n startWatchApp,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n useSources,\n useStatisticsForQuantity,\n}\n\nconst queryWorkouts = queryWorkoutSamples\n\nexport {\n authorizationStatusFor,\n availableQuantityTypes,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryStatisticsCollectionForQuantity,\n /**\n * @deprecated Use queryWorkoutSamples instead\n */\n queryWorkouts,\n queryWorkoutSamples,\n queryWorkoutSamplesWithAnchor,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n startWatchApp,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n useSources,\n useStatisticsForQuantity,\n isProtectedDataAvailable,\n}\n\nexport * from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,4BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,4BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,yBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,sBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,YAAA,GAAAC,uBAAA,CAAAX,OAAA;AACA,IAAAY,qBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,cAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,eAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,4BAAA,GAAAb,sBAAA,CAAAF,OAAA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AAlBA,2BAAkB;EAClBC,qBAAqB,EAArBA,8BAAqB;EACrBC,kBAAkB,EAAlBA,2BAAkB;EAClBC,iBAAiB,EAAjBA,0BAAiB;EACjBC,gBAAgB,EAAhBA,yBAAgB;EAEhB;EACAC,kBAAkB,EAAlBA,2BAAkB;EAElBC,aAAa,EAAbA,sBAAa;EAEb;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,8BAAqB;EACrB;AACF;AACA;AACA;AACA;EACEC,wBAAwB,EAAxBA,iCAAwB;EACxB;AACF;AACA;AACA;AACA;EACEC,yBAAyB,EAAzBA,kCAAyB;EACzBC,UAAU,EAAVA,mBAAU;EACVC,wBAAwB,EAAxBA;AACF,CAAC;AAED,MAAMrB,aAAa,GAAArE,OAAA,CAAAqE,aAAA,GAAGC,sBAAmB","ignoreList":[]}
|
|
@@ -35,6 +35,7 @@ var _exportNames = {
|
|
|
35
35
|
queryQuantitySamplesWithAnchor: true,
|
|
36
36
|
querySources: true,
|
|
37
37
|
queryStatisticsForQuantity: true,
|
|
38
|
+
queryStatisticsCollectionForQuantity: true,
|
|
38
39
|
queryWorkouts: true,
|
|
39
40
|
queryWorkoutSamples: true,
|
|
40
41
|
queryWorkoutSamplesWithAnchor: true,
|
|
@@ -45,6 +46,7 @@ var _exportNames = {
|
|
|
45
46
|
saveWorkoutRoute: true,
|
|
46
47
|
saveWorkoutSample: true,
|
|
47
48
|
subscribeToChanges: true,
|
|
49
|
+
startWatchApp: true,
|
|
48
50
|
useHealthkitAuthorization: true,
|
|
49
51
|
useIsHealthDataAvailable: true,
|
|
50
52
|
useMostRecentCategorySample: true,
|
|
@@ -54,7 +56,7 @@ var _exportNames = {
|
|
|
54
56
|
useStatisticsForQuantity: true,
|
|
55
57
|
useSubscribeToChanges: true
|
|
56
58
|
};
|
|
57
|
-
exports.useSubscribeToChanges = exports.useStatisticsForQuantity = exports.useSources = exports.useMostRecentWorkout = exports.useMostRecentQuantitySample = exports.useMostRecentCategorySample = exports.useIsHealthDataAvailable = exports.useHealthkitAuthorization = exports.subscribeToChanges = exports.saveWorkoutSample = exports.saveWorkoutRoute = exports.saveQuantitySample = exports.saveCorrelationSample = exports.saveCategorySample = exports.requestAuthorization = exports.queryWorkouts = exports.queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamples = exports.queryStatisticsForQuantity = exports.querySources = exports.queryQuantitySamplesWithAnchor = exports.queryQuantitySamples = exports.queryHeartbeatSeriesSamplesWithAnchor = exports.queryHeartbeatSeriesSamples = exports.queryCorrelationSamples = exports.queryCategorySamplesWithAnchor = exports.queryCategorySamples = exports.isProtectedDataAvailable = exports.isHealthDataAvailable = exports.getWorkoutRoutes = exports.getWorkoutPlanById = exports.getWheelchairUse = exports.getRequestStatusForAuthorization = exports.getPreferredUnits = exports.getPreferredUnit = exports.getMostRecentWorkout = exports.getMostRecentQuantitySample = exports.getMostRecentCategorySample = exports.getFitzpatrickSkinType = exports.getDateOfBirth = exports.getBloodType = exports.getBiologicalSex = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = exports.deleteSamples = exports.deleteQuantitySample = exports.default = exports.availableQuantityTypes = exports.authorizationStatusFor = void 0;
|
|
59
|
+
exports.useSubscribeToChanges = exports.useStatisticsForQuantity = exports.useSources = exports.useMostRecentWorkout = exports.useMostRecentQuantitySample = exports.useMostRecentCategorySample = exports.useIsHealthDataAvailable = exports.useHealthkitAuthorization = exports.subscribeToChanges = exports.startWatchApp = exports.saveWorkoutSample = exports.saveWorkoutRoute = exports.saveQuantitySample = exports.saveCorrelationSample = exports.saveCategorySample = exports.requestAuthorization = exports.queryWorkouts = exports.queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamples = exports.queryStatisticsForQuantity = exports.queryStatisticsCollectionForQuantity = exports.querySources = exports.queryQuantitySamplesWithAnchor = exports.queryQuantitySamples = exports.queryHeartbeatSeriesSamplesWithAnchor = exports.queryHeartbeatSeriesSamples = exports.queryCorrelationSamples = exports.queryCategorySamplesWithAnchor = exports.queryCategorySamples = exports.isProtectedDataAvailable = exports.isHealthDataAvailable = exports.getWorkoutRoutes = exports.getWorkoutPlanById = exports.getWheelchairUse = exports.getRequestStatusForAuthorization = exports.getPreferredUnits = exports.getPreferredUnit = exports.getMostRecentWorkout = exports.getMostRecentQuantitySample = exports.getMostRecentCategorySample = exports.getFitzpatrickSkinType = exports.getDateOfBirth = exports.getBloodType = exports.getBiologicalSex = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = exports.deleteSamples = exports.deleteQuantitySample = exports.default = exports.availableQuantityTypes = exports.authorizationStatusFor = void 0;
|
|
58
60
|
var _reactNative = require("react-native");
|
|
59
61
|
var _nativeTypes = require("./native-types");
|
|
60
62
|
var _types = require("./types");
|
|
@@ -129,6 +131,15 @@ const authorizationStatusFor = exports.authorizationStatusFor = UnavailableFn(Pr
|
|
|
129
131
|
mostRecentQuantityDateInterval: undefined,
|
|
130
132
|
duration: undefined
|
|
131
133
|
})),
|
|
134
|
+
queryStatisticsCollectionForQuantity = exports.queryStatisticsCollectionForQuantity = UnavailableFn(Promise.resolve([{
|
|
135
|
+
averageQuantity: undefined,
|
|
136
|
+
maximumQuantity: undefined,
|
|
137
|
+
minimumQuantity: undefined,
|
|
138
|
+
sumQuantity: undefined,
|
|
139
|
+
mostRecentQuantity: undefined,
|
|
140
|
+
mostRecentQuantityDateInterval: undefined,
|
|
141
|
+
duration: undefined
|
|
142
|
+
}])),
|
|
132
143
|
queryWorkouts = exports.queryWorkouts = UnavailableFn(Promise.resolve([])),
|
|
133
144
|
queryWorkoutSamples = exports.queryWorkoutSamples = UnavailableFn(Promise.resolve([])),
|
|
134
145
|
queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamplesWithAnchor = UnavailableFn(Promise.resolve({
|
|
@@ -147,6 +158,7 @@ const authorizationStatusFor = exports.authorizationStatusFor = UnavailableFn(Pr
|
|
|
147
158
|
saveWorkoutSample = exports.saveWorkoutSample = UnavailableFn(Promise.resolve(null)),
|
|
148
159
|
saveWorkoutRoute = exports.saveWorkoutRoute = UnavailableFn(Promise.resolve(false)),
|
|
149
160
|
subscribeToChanges = exports.subscribeToChanges = UnavailableFn(Promise.resolve(async () => Promise.resolve(false))),
|
|
161
|
+
startWatchApp = exports.startWatchApp = UnavailableFn(async () => Promise.resolve(false)),
|
|
150
162
|
useMostRecentCategorySample = exports.useMostRecentCategorySample = UnavailableFn(null),
|
|
151
163
|
useMostRecentQuantitySample = exports.useMostRecentQuantitySample = UnavailableFn(null),
|
|
152
164
|
useMostRecentWorkout = exports.useMostRecentWorkout = UnavailableFn(null),
|
|
@@ -189,6 +201,7 @@ const Healthkit = {
|
|
|
189
201
|
queryQuantitySamplesWithAnchor,
|
|
190
202
|
querySources,
|
|
191
203
|
queryStatisticsForQuantity,
|
|
204
|
+
queryStatisticsCollectionForQuantity,
|
|
192
205
|
queryWorkouts,
|
|
193
206
|
queryWorkoutSamples,
|
|
194
207
|
queryWorkoutSamplesWithAnchor,
|
|
@@ -199,6 +212,7 @@ const Healthkit = {
|
|
|
199
212
|
saveWorkoutRoute,
|
|
200
213
|
saveWorkoutSample,
|
|
201
214
|
subscribeToChanges,
|
|
215
|
+
startWatchApp,
|
|
202
216
|
useHealthkitAuthorization,
|
|
203
217
|
useIsHealthDataAvailable,
|
|
204
218
|
useMostRecentCategorySample,
|