@flomentumsolutions/capacitor-health-extended 0.4.4 → 0.4.5
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/Package.swift
CHANGED
|
@@ -19,7 +19,9 @@ let package = Package(
|
|
|
19
19
|
.target(
|
|
20
20
|
name: "HealthPluginPlugin",
|
|
21
21
|
dependencies: [
|
|
22
|
-
.product(name: "Capacitor", package: "capacitor-swift-pm")
|
|
22
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
23
|
+
// Capacitor binary depends on Cordova; add it so Xcode/SPM can find the module.
|
|
24
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
23
25
|
],
|
|
24
26
|
path: "ios/Sources/HealthPluginPlugin"
|
|
25
27
|
)
|
|
@@ -177,15 +177,17 @@ public class HealthPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
let asleepValues: Set<Int> = {
|
|
180
|
-
var values: [Int] = [HKCategoryValueSleepAnalysis.asleepUnspecified.rawValue]
|
|
181
180
|
if #available(iOS 16.0, *) {
|
|
182
|
-
|
|
181
|
+
return Set([
|
|
182
|
+
HKCategoryValueSleepAnalysis.asleepUnspecified.rawValue,
|
|
183
183
|
HKCategoryValueSleepAnalysis.asleepCore.rawValue,
|
|
184
184
|
HKCategoryValueSleepAnalysis.asleepDeep.rawValue,
|
|
185
185
|
HKCategoryValueSleepAnalysis.asleepREM.rawValue
|
|
186
186
|
])
|
|
187
|
+
} else {
|
|
188
|
+
// Pre-iOS 16 only exposes the legacy "asleep" value.
|
|
189
|
+
return Set([HKCategoryValueSleepAnalysis.asleep.rawValue])
|
|
187
190
|
}
|
|
188
|
-
return Set(values)
|
|
189
191
|
}()
|
|
190
192
|
|
|
191
193
|
func isAsleep(_ value: Int) -> Bool {
|
|
@@ -597,7 +599,7 @@ public class HealthPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
597
599
|
if bucket == "day" {
|
|
598
600
|
startDate = calendar.startOfDay(for: rawStartDate)
|
|
599
601
|
let endDayStart = calendar.startOfDay(for: rawEndDate)
|
|
600
|
-
endDate = calendar.date(byAdding: .day, to: endDayStart) ?? endDayStart
|
|
602
|
+
endDate = calendar.date(byAdding: .day, value: 1, to: endDayStart) ?? endDayStart
|
|
601
603
|
}
|
|
602
604
|
if dataTypeString == "mindfulness" {
|
|
603
605
|
self.queryMindfulnessAggregated(startDate: startDate, endDate: endDate) { result, error in
|
package/package.json
CHANGED