@flomentumsolutions/capacitor-health-extended 0.0.18 → 0.1.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.
@@ -12,9 +12,9 @@ Pod::Spec.new do |s|
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  # Only include Swift/Obj-C source files that belong to the plugin
14
14
  s.source_files = 'ios/Sources/HealthPluginPlugin/**/*.{swift,h,m}'
15
- s.ios.deployment_target = '13.0'
16
- s.dependency 'Capacitor', '~> 6.2'
17
- s.dependency 'CapacitorCordova', '~> 6.2'
18
- # Match the Swift shipped with Xcode 16 (use 5.9 for Xcode 15.x)
19
- s.swift_version = '5.9'
15
+ s.ios.deployment_target = '14.0'
16
+ s.dependency 'Capacitor', '~> 7.0'
17
+ s.dependency 'CapacitorCordova', '~> 7.0'
18
+ # Match the Swift shipped with Xcode 16
19
+ s.swift_version = '5.10'
20
20
  end
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # capacitor-health-extended
2
2
 
3
- Capacitor plugin to query data from Apple Health and Google Health Connect
3
+ Cross‑platform Capacitor plugin for reading data from Apple HealthKit and
4
+ Google Health Connect. The plugin requires **Node.js 20+** and is compatible
5
+ with **Capacitor 7**.
4
6
 
5
7
  ## Thanks and attribution
6
8
 
@@ -10,6 +12,19 @@ Forked from [capacitor-health](https://github.,com/mley/capacitor-health) and as
10
12
 
11
13
  Thanks [@mley](https://github.com/mley) for the ground work. The goal of this fork is to extend functionality and datapoints and keep up with the ever-changing brand-new Android Health Connect Platform. I'm hoping to create platform parity for capacitor API-based health data access.
12
14
 
15
+ ## Requirements
16
+
17
+ - Node.js 20 or newer
18
+ - Capacitor 7
19
+
20
+ ## Features
21
+
22
+ - Check if health functionality is available on the device
23
+ - Request and verify health permissions
24
+ - Query aggregated data like steps or calories
25
+ - Retrieve workout sessions with optional route and heart rate data
26
+ - Fetch the latest sample for steps, heart‑rate, or weight
27
+
13
28
  ## Install
14
29
 
15
30
  ```bash
@@ -98,10 +113,9 @@ npx cap sync
98
113
  ```
99
114
 
100
115
  This setup ensures your WebView will load HTTPS content securely and complies with Android's default network security policy.
101
- ```
102
116
 
103
117
  ## API
104
-
118
+ ```
105
119
  <docgen-index>
106
120
 
107
121
  * [`isHealthAvailable()`](#ishealthavailable)
@@ -121,7 +135,7 @@ This setup ensures your WebView will load HTTPS content securely and complies wi
121
135
  * [Type Aliases](#type-aliases)
122
136
 
123
137
  </docgen-index>
124
-
138
+ ```
125
139
  <docgen-api>
126
140
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
127
141
 
@@ -42,11 +42,11 @@ android {
42
42
  abortOnError false
43
43
  }
44
44
  compileOptions {
45
- sourceCompatibility JavaVersion.VERSION_17
46
- targetCompatibility JavaVersion.VERSION_17
45
+ sourceCompatibility JavaVersion.VERSION_21
46
+ targetCompatibility JavaVersion.VERSION_21
47
47
  }
48
48
  kotlinOptions {
49
- jvmTarget = '17'
49
+ jvmTarget = '21'
50
50
  }
51
51
  }
52
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface HealthPlugin {\n /**\n * Checks if health API is available.\n * Android: If false is returned, the Google Health Connect app is probably not installed.\n * See showHealthConnectInPlayStore()\n *\n */\n isHealthAvailable(): Promise<{ available: boolean }>;\n\n /**\n * Android only: Returns for each given permission, if it was granted by the underlying health API\n * @param permissions permissions to query\n */\n checkHealthPermissions(permissions: PermissionsRequest): Promise<PermissionResponse>;\n\n /**\n * Requests the permissions from the user.\n *\n * Android: Apps can ask only a few times for permissions, after that the user has to grant them manually in\n * the Health Connect app. See openHealthConnectSettings()\n *\n * iOS: If the permissions are already granted or denied, this method will just return without asking the user. In iOS\n * we can't really detect if a user granted or denied a permission. The return value reflects the assumption that all\n * permissions were granted.\n *\n * @param permissions permissions to request\n */\n requestHealthPermissions(permissions: PermissionsRequest): Promise<PermissionResponse>;\n\n /**\n * Opens the apps settings, which is kind of wrong, because health permissions are configured under:\n * Settings > Apps > (Apple) Health > Access and Devices > [app-name]\n * But we can't go there directly.\n */\n openAppleHealthSettings(): Promise<void>;\n\n /**\n * Opens the Google Health Connect app\n */\n openHealthConnectSettings(): Promise<void>;\n\n /**\n * Opens the Google Health Connect app in PlayStore\n */\n showHealthConnectInPlayStore(): Promise<void>;\n\n /**\n * Query aggregated data\n * @param request\n */\n queryAggregated(request: QueryAggregatedRequest): Promise<QueryAggregatedResponse>;\n\n /**\n * Query workouts\n * @param request\n */\n queryWorkouts(request: QueryWorkoutRequest): Promise<QueryWorkoutResponse>;\n\n /**\n * Query latest sample for a specific data type\n * @param request\n */\n queryLatestSample(request: { dataType: string }): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest weight sample\n */\n queryWeight(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest height sample\n */\n queryHeight(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest heart rate sample\n */\n queryHeartRate(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest steps sample\n */\n querySteps(): Promise<QueryLatestSampleResponse>;\n}\n\nexport declare type HealthPermission =\n | 'READ_STEPS'\n | 'READ_WORKOUTS'\n | 'READ_ACTIVE_CALORIES'\n | 'READ_TOTAL_CALORIES'\n | 'READ_DISTANCE'\n | 'READ_WEIGHT'\n | 'READ_HEIGHT'\n | 'READ_HEART_RATE'\n | 'READ_ROUTE'\n | 'READ_MINDFULNESS'\n | 'READ_HRV'\n | 'READ_BLOOD_PRESSURE';\n\nexport interface PermissionsRequest {\n permissions: HealthPermission[];\n}\n\nexport interface PermissionResponse {\n permissions: { [key: string]: boolean }[];\n}\n\nexport interface QueryWorkoutRequest {\n startDate: string;\n endDate: string;\n includeHeartRate: boolean;\n includeRoute: boolean;\n includeSteps: boolean;\n}\n\nexport interface HeartRateSample {\n timestamp: string;\n bpm: number;\n}\n\nexport interface RouteSample {\n timestamp: string;\n lat: number;\n lng: number;\n alt?: number;\n}\n\nexport interface QueryWorkoutResponse {\n workouts: Workout[];\n}\n\nexport interface Workout {\n startDate: string;\n endDate: string;\n workoutType: string;\n sourceName: string;\n id?: string;\n duration: number;\n distance?: number;\n steps?: number;\n calories: number;\n sourceBundleId: string;\n route?: RouteSample[];\n heartRate?: HeartRateSample[];\n}\n\nexport interface QueryAggregatedRequest {\n startDate: string;\n endDate: string;\n dataType: 'steps' | 'active-calories' | 'mindfulness' | 'hrv' | 'blood-pressure';\n bucket: string;\n}\n\nexport interface QueryAggregatedResponse {\n aggregatedData: AggregatedSample[];\n}\n\nexport interface AggregatedSample {\n startDate: string;\n endDate: string;\n value: number;\n}\n\nexport interface QueryLatestSampleResponse {\n value?: number;\n systolic?: number;\n diastolic?: number;\n timestamp: number;\n unit: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface HealthPlugin {\n /**\n * Checks if health API is available.\n * Android: If false is returned, the Google Health Connect app is probably not installed.\n * See showHealthConnectInPlayStore()\n *\n */\n isHealthAvailable(): Promise<{ available: boolean }>;\n\n /**\n * Android only: Returns for each given permission, if it was granted by the underlying health API\n * @param permissions permissions to query\n */\n checkHealthPermissions(permissions: PermissionsRequest): Promise<PermissionResponse>;\n\n /**\n * Requests the permissions from the user.\n *\n * Android: Apps can ask only a few times for permissions, after that the user has to grant them manually in\n * the Health Connect app. See openHealthConnectSettings()\n *\n * iOS: If the permissions are already granted or denied, this method will just return without asking the user. In iOS\n * we can't really detect if a user granted or denied a permission. The return value reflects the assumption that all\n * permissions were granted.\n *\n * @param permissions permissions to request\n */\n requestHealthPermissions(permissions: PermissionsRequest): Promise<PermissionResponse>;\n\n /**\n * Opens the apps settings, which is kind of wrong, because health permissions are configured under:\n * Settings > Apps > (Apple) Health > Access and Devices > [app-name]\n * But we can't go there directly.\n */\n openAppleHealthSettings(): Promise<void>;\n\n /**\n * Opens the Google Health Connect app\n */\n openHealthConnectSettings(): Promise<void>;\n\n /**\n * Opens the Google Health Connect app in PlayStore\n */\n showHealthConnectInPlayStore(): Promise<void>;\n\n /**\n * Query aggregated data\n * @param request\n */\n queryAggregated(request: QueryAggregatedRequest): Promise<QueryAggregatedResponse>;\n\n /**\n * Query workouts\n * @param request\n */\n queryWorkouts(request: QueryWorkoutRequest): Promise<QueryWorkoutResponse>;\n\n /**\n * Query latest sample for a specific data type\n * @param request\n */\n queryLatestSample(request: { dataType: string }): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest weight sample\n */\n queryWeight(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest height sample\n */\n queryHeight(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest heart rate sample\n */\n queryHeartRate(): Promise<QueryLatestSampleResponse>;\n\n /**\n * Query latest steps sample\n */\n querySteps(): Promise<QueryLatestSampleResponse>;\n}\n\nexport declare type HealthPermission =\n | 'READ_STEPS'\n | 'READ_WORKOUTS'\n | 'READ_ACTIVE_CALORIES'\n | 'READ_TOTAL_CALORIES'\n | 'READ_DISTANCE'\n | 'READ_WEIGHT'\n | 'READ_HEIGHT'\n | 'READ_HEART_RATE'\n | 'READ_ROUTE'\n | 'READ_MINDFULNESS'\n | 'READ_HRV'\n | 'READ_BLOOD_PRESSURE';\n\nexport interface PermissionsRequest {\n permissions: HealthPermission[];\n}\n\nexport interface PermissionResponse {\n permissions: { [key: string]: boolean }[];\n}\n\nexport interface QueryWorkoutRequest {\n startDate: string;\n endDate: string;\n includeHeartRate: boolean;\n includeRoute: boolean;\n includeSteps: boolean;\n}\n\nexport interface HeartRateSample {\n timestamp: string;\n bpm: number;\n}\n\nexport interface RouteSample {\n timestamp: string;\n lat: number;\n lng: number;\n alt?: number;\n}\n\nexport interface QueryWorkoutResponse {\n workouts: Workout[];\n}\n\nexport interface Workout {\n startDate: string;\n endDate: string;\n workoutType: string;\n sourceName: string;\n id?: string;\n duration: number;\n distance?: number;\n steps?: number;\n calories: number;\n sourceBundleId: string;\n route?: RouteSample[];\n heartRate?: HeartRateSample[];\n}\n\nexport interface QueryAggregatedRequest {\n startDate: string;\n endDate: string;\n dataType: 'steps' | 'active-calories' | 'mindfulness' | 'hrv' | 'blood-pressure';\n bucket: string;\n}\n\nexport interface QueryAggregatedResponse {\n aggregatedData: AggregatedSample[];\n}\n\nexport interface AggregatedSample {\n startDate: string;\n endDate: string;\n value: number;\n}\n\nexport interface QueryLatestSampleResponse {\n value?: number;\n systolic?: number;\n diastolic?: number;\n timestamp: number;\n unit: string;\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAe,cAAc,EAAE,EAAE,CAAC,CAAC;AAEvE,cAAc,eAAe,CAAA","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HealthPlugin } from './definitions';\n\nexport const Health = registerPlugin<HealthPlugin>('HealthPlugin', {});\n\nexport * from './definitions'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAe,cAAc,EAAE,EAAE,CAAC,CAAC;AAEvE,cAAc,eAAe,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HealthPlugin } from './definitions';\n\nexport const Health = registerPlugin<HealthPlugin>('HealthPlugin', {});\n\nexport * from './definitions';\n"]}
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  const Health = core.registerPlugin('HealthPlugin', {});
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const Health = registerPlugin('HealthPlugin', {});\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;;;AACY,MAAC,MAAM,GAAGA,mBAAc,CAAC,cAAc,EAAE,EAAE;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const Health = registerPlugin('HealthPlugin', {});\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;AACY,MAAC,MAAM,GAAGA,mBAAc,CAAC,cAAc,EAAE,EAAE;;;;"}
package/dist/plugin.js CHANGED
@@ -5,8 +5,6 @@ var capacitorHealthExtendedPlugin = (function (exports, core) {
5
5
 
6
6
  exports.Health = Health;
7
7
 
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
8
  return exports;
11
9
 
12
10
  })({}, capacitorExports);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const Health = registerPlugin('HealthPlugin', {});\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACY,OAAC,MAAM,GAAGA,mBAAc,CAAC,cAAc,EAAE,EAAE;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const Health = registerPlugin('HealthPlugin', {});\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACY,OAAC,MAAM,GAAGA,mBAAc,CAAC,cAAc,EAAE,EAAE;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flomentumsolutions/capacitor-health-extended",
3
- "version": "0.0.18",
3
+ "version": "0.1.0",
4
4
  "description": "Capacitor plugin for Apple HealthKit and Google Health Connect Platform",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -45,29 +45,29 @@
45
45
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
46
46
  "swiftlint": "node-swiftlint",
47
47
  "docgen": "docgen --api HealthPlugin --output-readme README.md --output-json dist/docs.json",
48
- "build": "npm run clean && tsc && rollup -c rollup.config.js",
48
+ "build": "npm run clean && tsc && rollup -c rollup.config.mjs",
49
49
  "clean": "rimraf ./dist",
50
50
  "watch": "tsc --watch",
51
51
  "prepublishOnly": "npm run build"
52
52
  },
53
53
  "devDependencies": {
54
- "@capacitor/android": "^6.0.0",
55
- "@capacitor/core": "^6.2.1",
56
- "@capacitor/docgen": "^0.2.2",
57
- "@capacitor/ios": "^6.0.0",
54
+ "@capacitor/android": "^7.0.0",
55
+ "@capacitor/core": "^7.0.0",
56
+ "@capacitor/docgen": "^0.3.0",
57
+ "@capacitor/ios": "^7.0.0",
58
58
  "@ionic/eslint-config": "^0.4.0",
59
59
  "@ionic/prettier-config": "^4.0.0",
60
- "@ionic/swiftlint-config": "^1.1.2",
60
+ "@ionic/swiftlint-config": "^2.0.0",
61
61
  "eslint": "^8.57.0",
62
- "prettier": "^3.3.3",
63
- "prettier-plugin-java": "^2.6.4",
64
- "rimraf": "^3.0.2",
65
- "rollup": "^2.32.0",
66
- "swiftlint": "^1.0.1",
62
+ "prettier": "^3.4.2",
63
+ "prettier-plugin-java": "^2.6.6",
64
+ "rimraf": "^6.0.1",
65
+ "rollup": "^4.30.1",
66
+ "swiftlint": "^2.0.0",
67
67
  "typescript": "~4.1.5"
68
68
  },
69
69
  "peerDependencies": {
70
- "@capacitor/core": "^6.0.0"
70
+ "@capacitor/core": ">=7.0.0"
71
71
  },
72
72
  "prettier": "@ionic/prettier-config",
73
73
  "swiftlint": "@ionic/swiftlint-config",