@kingstinct/react-native-healthkit 9.0.9 → 9.0.10
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.
|
@@ -169,9 +169,9 @@ class QuantityTypeModule: HybridQuantityTypeModuleSpec {
|
|
|
169
169
|
|
|
170
170
|
let quantityType = try initializeQuantityType(identifier.stringValue)
|
|
171
171
|
let predicate = try createPredicate(filter: options?.filter)
|
|
172
|
-
let unit = HKUnit.init(from: options?.unit ?? "count")
|
|
173
172
|
|
|
174
173
|
return Promise.async {
|
|
174
|
+
let unit = try await getUnitToUse(unitOverride: options?.unit, quantityType: quantityType)
|
|
175
175
|
return try await withCheckedThrowingContinuation { continuation in
|
|
176
176
|
let query = HKStatisticsQuery.init(
|
|
177
177
|
quantityType: quantityType,
|
|
@@ -254,7 +254,6 @@ class QuantityTypeModule: HybridQuantityTypeModuleSpec {
|
|
|
254
254
|
let quantityType = try initializeQuantityType(identifier.stringValue)
|
|
255
255
|
|
|
256
256
|
let predicate = try createPredicate(filter: options?.filter)
|
|
257
|
-
let unit = HKUnit.init(from: options?.unit ?? "count")
|
|
258
257
|
|
|
259
258
|
// Convert the anchor date string to Date
|
|
260
259
|
let dateFormatter = ISO8601DateFormatter()
|
|
@@ -284,6 +283,7 @@ class QuantityTypeModule: HybridQuantityTypeModuleSpec {
|
|
|
284
283
|
let opts = buildStatisticsOptions(statistics: statistics)
|
|
285
284
|
|
|
286
285
|
return Promise.async {
|
|
286
|
+
let unit = try await getUnitToUse(unitOverride: options?.unit, quantityType: quantityType)
|
|
287
287
|
return try await withCheckedThrowingContinuation { continuation in
|
|
288
288
|
let query = HKStatisticsCollectionQuery.init(
|
|
289
289
|
quantityType: quantityType,
|