@capgo/capacitor-health 8.1.2 → 8.1.4

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.
@@ -319,44 +319,40 @@ final class Health {
319
319
  return
320
320
  }
321
321
 
322
- if #available(iOS 12.0, *) {
323
- let group = DispatchGroup()
324
- let lock = NSLock()
325
- var authorized: [HealthDataType] = []
326
- var denied: [HealthDataType] = []
327
-
328
- for type in types {
329
- guard let objectType = try? type.sampleType() else {
330
- denied.append(type)
331
- continue
332
- }
322
+ let group = DispatchGroup()
323
+ let lock = NSLock()
324
+ var authorized: [HealthDataType] = []
325
+ var denied: [HealthDataType] = []
326
+
327
+ for type in types {
328
+ guard let objectType = try? type.sampleType() else {
329
+ denied.append(type)
330
+ continue
331
+ }
333
332
 
334
- group.enter()
335
- let readSet = Set<HKObjectType>([objectType])
336
- healthStore.getRequestStatusForAuthorization(toShare: Set<HKSampleType>(), read: readSet) { status, error in
337
- defer { group.leave() }
333
+ group.enter()
334
+ let readSet = Set<HKObjectType>([objectType])
335
+ healthStore.getRequestStatusForAuthorization(toShare: Set<HKSampleType>(), read: readSet) { status, error in
336
+ defer { group.leave() }
338
337
 
339
- if error != nil {
340
- lock.lock(); denied.append(type); lock.unlock()
341
- return
342
- }
338
+ if error != nil {
339
+ lock.lock(); denied.append(type); lock.unlock()
340
+ return
341
+ }
343
342
 
344
- switch status {
345
- case .unnecessary:
346
- lock.lock(); authorized.append(type); lock.unlock()
347
- case .shouldRequest, .unknown:
348
- lock.lock(); denied.append(type); lock.unlock()
349
- @unknown default:
350
- lock.lock(); denied.append(type); lock.unlock()
351
- }
343
+ switch status {
344
+ case .unnecessary:
345
+ lock.lock(); authorized.append(type); lock.unlock()
346
+ case .shouldRequest, .unknown:
347
+ lock.lock(); denied.append(type); lock.unlock()
348
+ @unknown default:
349
+ lock.lock(); denied.append(type); lock.unlock()
352
350
  }
353
351
  }
352
+ }
354
353
 
355
- group.notify(queue: .main) {
356
- completion(authorized, denied)
357
- }
358
- } else {
359
- completion(types, [])
354
+ group.notify(queue: .main) {
355
+ completion(authorized, denied)
360
356
  }
361
357
  }
362
358
 
@@ -3,7 +3,7 @@ import Capacitor
3
3
 
4
4
  @objc(HealthPlugin)
5
5
  public class HealthPlugin: CAPPlugin, CAPBridgedPlugin {
6
- private let pluginVersion: String = "8.1.2"
6
+ private let pluginVersion: String = "8.1.4"
7
7
  public let identifier = "HealthPlugin"
8
8
  public let jsName = "Health"
9
9
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-health",
3
- "version": "8.1.2",
3
+ "version": "8.1.4",
4
4
  "description": "Capacitor plugin to interact with data from Apple HealthKit and Health Connect",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -38,7 +38,7 @@
38
38
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
39
39
  "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
40
40
  "eslint": "eslint . --ext ts",
41
- "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41
+ "prettier": "prettier-pretty-check \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
42
42
  "swiftlint": "node-swiftlint",
43
43
  "docgen": "docgen --api HealthPlugin --output-readme README.md --output-json dist/docs.json",
44
44
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
@@ -62,7 +62,8 @@
62
62
  "rimraf": "^6.1.0",
63
63
  "rollup": "^4.53.2",
64
64
  "swiftlint": "^2.0.0",
65
- "typescript": "^5.9.3"
65
+ "typescript": "^5.9.3",
66
+ "prettier-pretty-check": "^0.2.0"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "@capacitor/core": ">=8.0.0"